Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89932ee6 authored by Jeffrey Huang's avatar Jeffrey Huang Committed by Android (Google) Code Review
Browse files

Merge "Migrate pullPowerProfile"

parents 9afd7086 1a3935c8
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -1502,21 +1502,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);
@@ -2261,11 +2246,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;
+0 −4
Original line number Diff line number Diff line
@@ -224,10 +224,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*/,
+18 −3
Original line number Diff line number Diff line
@@ -911,11 +911,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() {