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

Commit 72a4075c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Migrate pullKernelWakelock"

parents 4e49a5d0 a6e5a9ba
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -744,23 +744,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        return null;
    }

    private void pullKernelWakelock(
            int tagId, long elapsedNanos, long wallClockNanos,
            List<StatsLogEventWrapper> pulledData) {
        final KernelWakelockStats wakelockStats =
                mKernelWakelockReader.readKernelWakelockStats(mTmpWakelockStats);
        for (Map.Entry<String, KernelWakelockStats.Entry> ent : wakelockStats.entrySet()) {
            String name = ent.getKey();
            KernelWakelockStats.Entry kws = ent.getValue();
            StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
            e.writeString(name);
            e.writeInt(kws.mCount);
            e.writeInt(kws.mVersion);
            e.writeLong(kws.mTotalTime);
            pulledData.add(e);
        }
    }

    private void pullWifiActivityInfo(
            int tagId, long elapsedNanos, long wallClockNanos,
            List<StatsLogEventWrapper> pulledData) {
@@ -2027,11 +2010,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        long wallClockNanos = SystemClock.currentTimeMicro() * 1000L;
        switch (tagId) {

            case StatsLog.KERNEL_WAKELOCK: {
                pullKernelWakelock(tagId, elapsedNanos, wallClockNanos, ret);
                break;
            }

            case StatsLog.WIFI_ACTIVITY_INFO: {
                pullWifiActivityInfo(tagId, elapsedNanos, wallClockNanos, ret);
                break;
+0 −4
Original line number Diff line number Diff line
@@ -60,10 +60,6 @@ const int64_t NO_ALARM_UPDATE = INT64_MAX;

std::map<PullerKey, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {

        // kernel_wakelock
        {{.atomTag = android::util::KERNEL_WAKELOCK},
         {.puller = new StatsCompanionServicePuller(android::util::KERNEL_WAKELOCK)}},

        // subsystem_sleep_state
        {{.atomTag = android::util::SUBSYSTEM_SLEEP_STATE},
         {.puller = new SubsystemSleepStatePuller()}},
+26 −3
Original line number Diff line number Diff line
@@ -622,12 +622,35 @@ public class StatsPullAtomService extends SystemService {
        return StatsManager.PULL_SUCCESS;
    }

    private final KernelWakelockReader mKernelWakelockReader = new KernelWakelockReader();
    private final KernelWakelockStats mTmpWakelockStats = new KernelWakelockStats();

    private void registerKernelWakelock() {
        // No op.
        int tagId = StatsLog.KERNEL_WAKELOCK;
        mStatsManager.registerPullAtomCallback(
                tagId,
                /* PullAtomMetadata */ null,
                (atomTag, data) -> pullKernelWakelock(atomTag, data),
                Executors.newSingleThreadExecutor()
        );
    }

    private void pullKernelWakelock() {
        // No op.
    private int pullKernelWakelock(int atomTag, List<StatsEvent> pulledData) {
        final KernelWakelockStats wakelockStats =
                mKernelWakelockReader.readKernelWakelockStats(mTmpWakelockStats);
        for (Map.Entry<String, KernelWakelockStats.Entry> ent : wakelockStats.entrySet()) {
            String name = ent.getKey();
            KernelWakelockStats.Entry kws = ent.getValue();
            StatsEvent e = StatsEvent.newBuilder()
                    .setAtomId(atomTag)
                    .writeString(name)
                    .writeInt(kws.mCount)
                    .writeInt(kws.mVersion)
                    .writeLong(kws.mTotalTime)
                    .build();
            pulledData.add(e);
        }
        return StatsManager.PULL_SUCCESS;
    }

    private KernelCpuSpeedReader[] mKernelCpuSpeedReaders;