Add refresh rate stats to TimeStats.
Bug: 122905821
Test: libsurfaceflinger_test
Test: dumpsys SurfaceFlinger --timestats -dump --proto
Change-Id: I99b38497f054f86bebba0813134f1c1eaf632b47
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index bfe5da5..026f7c7 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -47,6 +47,8 @@
int configId;
// Human readable name of the refresh rate.
std::string name;
+ // Refresh rate in frames per second, rounded to the nearest integer.
+ uint32_t fps = 0;
};
// TODO(b/122916473): Get this information from configs prepared by vendors, instead of
@@ -63,7 +65,7 @@
void init(const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs) {
// This is the rate that HWC encapsulates right now when the device is in DOZE mode.
mRefreshRates.push_back(
- RefreshRate{RefreshRateType::POWER_SAVING, SCREEN_OFF_CONFIG_ID, "ScreenOff"});
+ RefreshRate{RefreshRateType::POWER_SAVING, SCREEN_OFF_CONFIG_ID, "ScreenOff", 0});
if (configs.size() < 1) {
ALOGE("Device does not have valid configs. Config size is 0.");
@@ -86,10 +88,11 @@
nsecs_t vsyncPeriod = configIdToVsyncPeriod[0].second;
if (vsyncPeriod != 0) {
const float fps = 1e9 / vsyncPeriod;
- mRefreshRates.push_back(RefreshRate{RefreshRateType::DEFAULT,
- configIdToVsyncPeriod[0].first,
- base::StringPrintf("%2.ffps", fps)});
+ mRefreshRates.push_back(
+ RefreshRate{RefreshRateType::DEFAULT, configIdToVsyncPeriod[0].first,
+ base::StringPrintf("%2.ffps", fps), static_cast<uint32_t>(fps)});
}
+
if (configs.size() < 2) {
return;
}
@@ -99,9 +102,9 @@
vsyncPeriod = configIdToVsyncPeriod[1].second;
if (vsyncPeriod != 0) {
const float fps = 1e9 / vsyncPeriod;
- mRefreshRates.push_back(RefreshRate{RefreshRateType::PERFORMANCE,
- configIdToVsyncPeriod[1].first,
- base::StringPrintf("%2.ffps", fps)});
+ mRefreshRates.push_back(
+ RefreshRate{RefreshRateType::PERFORMANCE, configIdToVsyncPeriod[1].first,
+ base::StringPrintf("%2.ffps", fps), static_cast<uint32_t>(fps)});
}
}
@@ -109,4 +112,4 @@
};
} // namespace scheduler
-} // namespace android
\ No newline at end of file
+} // namespace android