[TimeStats] Track RenderEngine time per frame.
Bug: 144037240
Test: dumpsys SurfaceFlinger --timestats -dump
Change-Id: I7a4dd680ed08e3a7a05e3fd08d5e133e9d394193
diff --git a/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp b/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
index 83cd45a..7e43880 100644
--- a/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
+++ b/services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp
@@ -113,6 +113,8 @@
result.append(presentToPresent.toString());
StringAppendF(&result, "frameDuration histogram is as below:\n");
result.append(frameDuration.toString());
+ StringAppendF(&result, "renderEngineTiming histogram is as below:\n");
+ result.append(renderEngineTiming.toString());
const auto dumpStats = generateDumpStats(maxLayers);
for (const auto& ele : dumpStats) {
result.append(ele->toString());
@@ -165,6 +167,11 @@
histProto->set_time_millis(histEle.first);
histProto->set_frame_count(histEle.second);
}
+ for (const auto& histEle : renderEngineTiming.hist) {
+ SFTimeStatsHistogramBucketProto* histProto = globalProto.add_render_engine_timing();
+ histProto->set_time_millis(histEle.first);
+ histProto->set_frame_count(histEle.second);
+ }
const auto dumpStats = generateDumpStats(maxLayers);
for (const auto& ele : dumpStats) {
SFTimeStatsLayerProto* layerProto = globalProto.add_stats();
diff --git a/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h b/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
index 6b28970..bd97ecc 100644
--- a/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
+++ b/services/surfaceflinger/TimeStats/timestatsproto/include/timestatsproto/TimeStatsHelper.h
@@ -62,6 +62,7 @@
int64_t displayOnTime = 0;
Histogram presentToPresent;
Histogram frameDuration;
+ Histogram renderEngineTiming;
std::unordered_map<std::string, TimeStatsLayer> stats;
std::unordered_map<uint32_t, nsecs_t> refreshRateStats;
diff --git a/services/surfaceflinger/TimeStats/timestatsproto/timestats.proto b/services/surfaceflinger/TimeStats/timestatsproto/timestats.proto
index 96430b3..5fd4a39 100644
--- a/services/surfaceflinger/TimeStats/timestatsproto/timestats.proto
+++ b/services/surfaceflinger/TimeStats/timestatsproto/timestats.proto
@@ -25,7 +25,7 @@
// changes to these messages, and keep google3 side proto messages in sync if
// the end to end pipeline needs to be updated.
-// Next tag: 11
+// Next tag: 12
message SFTimeStatsGlobalProto {
// The stats start time in UTC as seconds since January 1, 1970
optional int64 stats_start = 1;
@@ -45,6 +45,8 @@
repeated SFTimeStatsHistogramBucketProto present_to_present = 8;
// Frame CPU duration histogram.
repeated SFTimeStatsHistogramBucketProto frame_duration = 10;
+ // Frame GPU duration histogram.
+ repeated SFTimeStatsHistogramBucketProto render_engine_timing = 11;
// Stats per layer. Apps could have multiple layers.
repeated SFTimeStatsLayerProto stats = 6;
}