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_manager.h>
|
||||||
#include <android/binder_process.h>
|
#include <android/binder_process.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
||||||
|
@ -37,14 +38,21 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
||||||
|
|
||||||
void addDisplay(std::shared_ptr<PowerStats> p) {
|
void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||||
// Add display residency stats
|
// Add display residency stats
|
||||||
std::vector<std::string> states = {
|
struct stat buffer;
|
||||||
"Off",
|
if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &buffer)) {
|
||||||
"On: 1600x2560@60",
|
// time_in_state exists
|
||||||
"HBM: 1600x2560@60"};
|
addDisplayMrr(p);
|
||||||
|
} else {
|
||||||
|
// time_in_state doesn't exist
|
||||||
|
std::vector<std::string> states = {
|
||||||
|
"Off",
|
||||||
|
"On: 1600x2560@60",
|
||||||
|
"HBM: 1600x2560@60"};
|
||||||
|
|
||||||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||||
"/sys/class/backlight/panel0-backlight/state",
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
states));
|
states));
|
||||||
|
}
|
||||||
|
|
||||||
// Add display energy consumer
|
// Add display energy consumer
|
||||||
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue