powerstats: use display MRR state residency data provider
Bug: 317193845 Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest Change-Id: If0b226c02eeee67f3dbc3bd0f7551ccb1f13bfee Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
ca3359d2e4
commit
ec47f620fe
2 changed files with 57 additions and 41 deletions
|
@ -26,6 +26,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::DisplayStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
||||||
|
@ -33,37 +34,44 @@ 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/backlight/panel0-backlight/time_in_state", &buffer)) {
|
||||||
"LP: 1008x2244@1",
|
// time_in_state doesn't exist
|
||||||
"LP: 1008x2244@30",
|
std::vector<std::string> states = {
|
||||||
"On: 1008x2244@1",
|
"Off",
|
||||||
"On: 1008x2244@10",
|
"LP: 1008x2244@1",
|
||||||
"On: 1008x2244@30",
|
"LP: 1008x2244@30",
|
||||||
"On: 1008x2244@60",
|
"On: 1008x2244@1",
|
||||||
"On: 1008x2244@120",
|
"On: 1008x2244@10",
|
||||||
"HBM: 1008x2244@1",
|
"On: 1008x2244@30",
|
||||||
"HBM: 1008x2244@10",
|
"On: 1008x2244@60",
|
||||||
"HBM: 1008x2244@30",
|
"On: 1008x2244@120",
|
||||||
"HBM: 1008x2244@60",
|
"HBM: 1008x2244@1",
|
||||||
"HBM: 1008x2244@120",
|
"HBM: 1008x2244@10",
|
||||||
"LP: 1344x2992@1",
|
"HBM: 1008x2244@30",
|
||||||
"LP: 1344x2992@30",
|
"HBM: 1008x2244@60",
|
||||||
"On: 1344x2992@1",
|
"HBM: 1008x2244@120",
|
||||||
"On: 1344x2992@10",
|
"LP: 1344x2992@1",
|
||||||
"On: 1344x2992@30",
|
"LP: 1344x2992@30",
|
||||||
"On: 1344x2992@60",
|
"On: 1344x2992@1",
|
||||||
"On: 1344x2992@120",
|
"On: 1344x2992@10",
|
||||||
"HBM: 1344x2992@1",
|
"On: 1344x2992@30",
|
||||||
"HBM: 1344x2992@10",
|
"On: 1344x2992@60",
|
||||||
"HBM: 1344x2992@30",
|
"On: 1344x2992@120",
|
||||||
"HBM: 1344x2992@60",
|
"HBM: 1344x2992@1",
|
||||||
"HBM: 1344x2992@120"};
|
"HBM: 1344x2992@10",
|
||||||
|
"HBM: 1344x2992@30",
|
||||||
|
"HBM: 1344x2992@60",
|
||||||
|
"HBM: 1344x2992@120"};
|
||||||
|
|
||||||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
||||||
"Display",
|
"Display",
|
||||||
"/sys/class/backlight/panel0-backlight/state",
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
states));
|
states));
|
||||||
|
} else {
|
||||||
|
// time_in_state exists
|
||||||
|
addDisplayMRR(p);
|
||||||
|
}
|
||||||
|
|
||||||
// Add display energy consumer
|
// Add display energy consumer
|
||||||
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
||||||
|
|
|
@ -26,6 +26,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::DisplayStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
||||||
|
@ -33,18 +34,25 @@ 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/backlight/panel0-backlight/time_in_state", &buffer)) {
|
||||||
"LP: 1080x2400@30",
|
// time_in_state doesn't exist
|
||||||
"On: 1080x2400@60",
|
std::vector<std::string> states = {
|
||||||
"On: 1080x2400@120",
|
"Off",
|
||||||
"HBM: 1080x2400@60",
|
"LP: 1080x2400@30",
|
||||||
"HBM: 1080x2400@120"};
|
"On: 1080x2400@60",
|
||||||
|
"On: 1080x2400@120",
|
||||||
|
"HBM: 1080x2400@60",
|
||||||
|
"HBM: 1080x2400@120"};
|
||||||
|
|
||||||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
||||||
"Display",
|
"Display",
|
||||||
"/sys/class/backlight/panel0-backlight/state",
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
states));
|
states));
|
||||||
|
} else {
|
||||||
|
// time_in_state exists
|
||||||
|
addDisplayMRR(p);
|
||||||
|
}
|
||||||
|
|
||||||
// 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