Migrate pullPowerProfile
Bug: 145565211 Test: No Cts test. Ran adb shell cmd stats pull-source 10033
This commit is contained in:
@@ -1671,21 +1671,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private void pullPowerProfile(
|
||||
int tagId, long elapsedNanos, long wallClockNanos,
|
||||
List<StatsLogEventWrapper> pulledData) {
|
||||
PowerProfile powerProfile = new PowerProfile(mContext);
|
||||
Objects.requireNonNull(powerProfile);
|
||||
|
||||
StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos,
|
||||
wallClockNanos);
|
||||
ProtoOutputStream proto = new ProtoOutputStream();
|
||||
powerProfile.dumpDebug(proto);
|
||||
proto.flush();
|
||||
e.writeStorage(proto.getBytes());
|
||||
pulledData.add(e);
|
||||
}
|
||||
|
||||
private void pullBuildInformation(int tagId,
|
||||
long elapsedNanos, long wallClockNanos, List<StatsLogEventWrapper> pulledData) {
|
||||
StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
|
||||
@@ -2455,11 +2440,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
break;
|
||||
}
|
||||
|
||||
case StatsLog.POWER_PROFILE: {
|
||||
pullPowerProfile(tagId, elapsedNanos, wallClockNanos, ret);
|
||||
break;
|
||||
}
|
||||
|
||||
case StatsLog.BUILD_INFORMATION: {
|
||||
pullBuildInformation(tagId, elapsedNanos, wallClockNanos, ret);
|
||||
break;
|
||||
|
||||
@@ -249,10 +249,6 @@ std::map<PullerKey, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
|
||||
.coolDownNs = 3 * NS_PER_SEC,
|
||||
.puller = new StatsCompanionServicePuller(android::util::DISK_IO)}},
|
||||
|
||||
// PowerProfile constants for power model calculations.
|
||||
{{.atomTag = android::util::POWER_PROFILE},
|
||||
{.puller = new StatsCompanionServicePuller(android::util::POWER_PROFILE)}},
|
||||
|
||||
// Process cpu stats. Min cool-down is 5 sec, inline with what AcitivityManagerService uses.
|
||||
{{.atomTag = android::util::PROCESS_CPU_TIME},
|
||||
{.coolDownNs = 5 * NS_PER_SEC /* min cool-down in seconds*/,
|
||||
|
||||
@@ -695,11 +695,26 @@ public class StatsPullAtomService extends SystemService {
|
||||
}
|
||||
|
||||
private void registerPowerProfile() {
|
||||
// No op.
|
||||
int tagId = StatsLog.POWER_PROFILE;
|
||||
mStatsManager.registerPullAtomCallback(
|
||||
tagId,
|
||||
/* PullAtomMetadata */ null,
|
||||
(atomTag, data) -> pullPowerProfile(atomTag, data),
|
||||
Executors.newSingleThreadExecutor()
|
||||
);
|
||||
}
|
||||
|
||||
private void pullPowerProfile() {
|
||||
// No op.
|
||||
private int pullPowerProfile(int atomTag, List<StatsEvent> pulledData) {
|
||||
PowerProfile powerProfile = new PowerProfile(mContext);
|
||||
ProtoOutputStream proto = new ProtoOutputStream();
|
||||
powerProfile.dumpDebug(proto);
|
||||
proto.flush();
|
||||
StatsEvent e = StatsEvent.newBuilder()
|
||||
.setAtomId(atomTag)
|
||||
.writeByteArray(proto.getBytes())
|
||||
.build();
|
||||
pulledData.add(e);
|
||||
return StatsManager.PULL_SUCCESS;
|
||||
}
|
||||
|
||||
private void registerProcessCpuTime() {
|
||||
|
||||
Reference in New Issue
Block a user