powerstats: use display MRR state residency data provider
Bug: 322457937 Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest Change-Id: I65f2f1d8818295ac76525c1ebf4bbdd36ce0b5ff Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
cb44b9b0b1
commit
83e6cc5af1
1 changed files with 15 additions and 7 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <log/log.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
|
||||
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
||||
|
@ -37,6 +38,12 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
|||
|
||||
void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||
// Add display residency stats
|
||||
struct stat buffer;
|
||||
if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &buffer)) {
|
||||
// time_in_state exists
|
||||
addDisplayMrr(p);
|
||||
} else {
|
||||
// time_in_state doesn't exist
|
||||
std::vector<std::string> states = {
|
||||
"Off",
|
||||
"On: 1600x2560@60",
|
||||
|
@ -45,6 +52,7 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
|
|||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||
"/sys/class/backlight/panel0-backlight/state",
|
||||
states));
|
||||
}
|
||||
|
||||
// Add display energy consumer
|
||||
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue