Update jank reasons in timestats
This change populates the following jank reasons into timestats
* SF Scheduling
* Prediction Error
* Buffer Stuffing
Bug: 177944020
Test: TimeStatsTest, FrameTimelineTest
Change-Id: Ibd72e7b0055ccd505871b419f77ff67b7bc874c8
diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp
index b93f30e..100354a 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.cpp
+++ b/services/surfaceflinger/TimeStats/TimeStats.cpp
@@ -140,11 +140,12 @@
globalSlice.second.jankPayload.totalSFUnattributed);
mStatsDelegate->statsEventWriteInt32(event,
globalSlice.second.jankPayload.totalAppUnattributed);
-
- // TODO: populate these with real values
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_janky_frames_sf_scheduling
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_jank_frames_sf_prediction_error
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_jank_frames_app_buffer_stuffing
+ mStatsDelegate->statsEventWriteInt32(event,
+ globalSlice.second.jankPayload.totalSFScheduling);
+ mStatsDelegate->statsEventWriteInt32(event,
+ globalSlice.second.jankPayload.totalSFPredictionError);
+ mStatsDelegate->statsEventWriteInt32(event,
+ globalSlice.second.jankPayload.totalAppBufferStuffing);
mStatsDelegate->statsEventWriteInt32(event, globalSlice.first.displayRefreshRateBucket);
std::string sfDeadlineMissedBytes =
histogramToProtoByteString(globalSlice.second.displayDeadlineDeltas.hist,
@@ -222,11 +223,9 @@
mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalSFLongGpu);
mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalSFUnattributed);
mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalAppUnattributed);
-
- // TODO: populate these with real values
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_janky_frames_sf_scheduling
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_jank_frames_sf_prediction_error
- mStatsDelegate->statsEventWriteInt32(event, 0); // total_jank_frames_app_buffer_stuffing
+ mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalSFScheduling);
+ mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalSFPredictionError);
+ mStatsDelegate->statsEventWriteInt32(event, layer->jankPayload.totalAppBufferStuffing);
mStatsDelegate->statsEventWriteInt32(
event, layer->displayRefreshRateBucket); // display_refresh_rate_bucket
mStatsDelegate->statsEventWriteInt32(event, layer->renderRateBucket); // render_rate_bucket
@@ -772,9 +771,10 @@
flushAvailableRecordsToStatsLocked(layerId, displayRefreshRate, renderRate);
}
-static const constexpr int32_t kValidJankyReason = JankType::SurfaceFlingerCpuDeadlineMissed |
- JankType::SurfaceFlingerGpuDeadlineMissed | JankType::AppDeadlineMissed |
- JankType::DisplayHAL;
+static const constexpr int32_t kValidJankyReason = JankType::DisplayHAL |
+ JankType::SurfaceFlingerCpuDeadlineMissed | JankType::SurfaceFlingerGpuDeadlineMissed |
+ JankType::AppDeadlineMissed | JankType::PredictionError |
+ JankType::SurfaceFlingerScheduling | JankType::BufferStuffing;
template <class T>
static void updateJankPayload(T& t, int32_t reasons) {
@@ -794,6 +794,15 @@
if ((reasons & JankType::AppDeadlineMissed) != 0) {
t.jankPayload.totalAppUnattributed++;
}
+ if ((reasons & JankType::PredictionError) != 0) {
+ t.jankPayload.totalSFPredictionError++;
+ }
+ if ((reasons & JankType::SurfaceFlingerScheduling) != 0) {
+ t.jankPayload.totalSFScheduling++;
+ }
+ if ((reasons & JankType::BufferStuffing) != 0) {
+ t.jankPayload.totalAppBufferStuffing++;
+ }
}
}
diff --git a/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp b/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
index 814f046..d116b02 100644
--- a/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
+++ b/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
@@ -83,8 +83,11 @@
StringAppendF(&result, "jankyFrames = %d\n", totalJankyFrames);
StringAppendF(&result, "sfLongCpuJankyFrames = %d\n", totalSFLongCpu);
StringAppendF(&result, "sfLongGpuJankyFrames = %d\n", totalSFLongGpu);
- StringAppendF(&result, "sfUnattributedJankyFrame = %d\n", totalSFUnattributed);
- StringAppendF(&result, "appUnattributedJankyFrame = %d\n", totalAppUnattributed);
+ StringAppendF(&result, "sfUnattributedJankyFrames = %d\n", totalSFUnattributed);
+ StringAppendF(&result, "appUnattributedJankyFrames = %d\n", totalAppUnattributed);
+ StringAppendF(&result, "sfSchedulingJankyFrames = %d\n", totalSFScheduling);
+ StringAppendF(&result, "sfPredictionErrorJankyFrames = %d\n", totalSFPredictionError);
+ StringAppendF(&result, "appBufferStuffingJankyFrames = %d\n", totalAppBufferStuffing);
return result;
}
diff --git a/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h b/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
index 38ee888..4556bad 100644
--- a/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
+++ b/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
@@ -48,6 +48,9 @@
int32_t totalSFLongGpu = 0;
int32_t totalSFUnattributed = 0;
int32_t totalAppUnattributed = 0;
+ int32_t totalSFScheduling = 0;
+ int32_t totalSFPredictionError = 0;
+ int32_t totalAppBufferStuffing = 0;
std::string toString() const;
};