Zero out newer metrics as first commit.
We have to report these metrics in a very specific order, so drop in a
commit to zero them out so that if there's parallel iteration doesn't
collide.
Bug: 171309796
Test: libsurfaceflinger_unittest
Change-Id: Ia8ab285ef8747e48d5be95472c483198fdef01a3
diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp
index f4a0319..5d387d6 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.cpp
+++ b/services/surfaceflinger/TimeStats/TimeStats.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <unordered_map>
#undef LOG_TAG
#define LOG_TAG "TimeStats"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
@@ -87,6 +88,18 @@
proto.serializeToString(&byteString);
return byteString;
}
+
+std::string frameRateVoteToProtoByteString(float refreshRate, int frameRateCompatibility,
+ int seamlessness) {
+ util::ProtoOutputStream proto;
+ proto.write(android::util::FIELD_TYPE_FLOAT | 1 /* field id */, refreshRate);
+ proto.write(android::util::FIELD_TYPE_ENUM | 2 /* field id */, frameRateCompatibility);
+ proto.write(android::util::FIELD_TYPE_ENUM | 3 /* field id */, seamlessness);
+
+ std::string byteString;
+ proto.serializeToString(&byteString);
+ return byteString;
+}
} // namespace
AStatsManager_PullAtomCallbackReturn TimeStats::populateGlobalAtom(AStatsEventList* data) {
@@ -121,6 +134,23 @@
mStatsDelegate->statsEventWriteInt32(event, mTimeStats.jankPayload.totalSFLongGpu);
mStatsDelegate->statsEventWriteInt32(event, mTimeStats.jankPayload.totalSFUnattributed);
mStatsDelegate->statsEventWriteInt32(event, mTimeStats.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, 0); // display_refresh_rate_bucket
+ std::string sfDeadlineMissedBytes =
+ histogramToProtoByteString(std::unordered_map<int32_t, int32_t>(),
+ mMaxPulledHistogramBuckets);
+ mStatsDelegate->statsEventWriteByteArray(event, (const uint8_t*)sfDeadlineMissedBytes.c_str(),
+ sfDeadlineMissedBytes.size()); // sf_deadline_misses
+ std::string sfPredictionErrorBytes =
+ histogramToProtoByteString(std::unordered_map<int32_t, int32_t>(),
+ mMaxPulledHistogramBuckets);
+ mStatsDelegate->statsEventWriteByteArray(event, (const uint8_t*)sfPredictionErrorBytes.c_str(),
+ sfPredictionErrorBytes.size()); // sf_prediction_errors
+ mStatsDelegate->statsEventWriteInt32(event, 0); // render_rate_bucket
mStatsDelegate->statsEventBuild(event);
clearGlobalLocked();
@@ -174,6 +204,22 @@
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, 0); // display_refresh_rate_bucket
+ mStatsDelegate->statsEventWriteInt32(event, 0); // render_rate_bucket
+ std::string frameRateVoteBytes = frameRateVoteToProtoByteString(0.0, 0, 0);
+ mStatsDelegate->statsEventWriteByteArray(event, (const uint8_t*)frameRateVoteBytes.c_str(),
+ frameRateVoteBytes.size()); // set_frame_rate_vote
+ std::string appDeadlineMissedBytes =
+ histogramToProtoByteString(std::unordered_map<int32_t, int32_t>(),
+ mMaxPulledHistogramBuckets);
+ mStatsDelegate
+ ->statsEventWriteByteArray(event, (const uint8_t*)appDeadlineMissedBytes.c_str(),
+ appDeadlineMissedBytes.size()); // app_deadline_misses
+
mStatsDelegate->statsEventBuild(event);
}
clearLayersLocked();