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

Commit a0e1cd2d authored by Jeffrey Huang's avatar Jeffrey Huang
Browse files

Migrate ionHeapSize

Test: Ran adb shell cmd stats pull-source 10056
Test: Ran adb shell cmd stats pull-source 10061
Change-Id: I6501109a94875c69078dea0ac07dcce3bc9641e3
parent b1c16343
Loading
Loading
Loading
Loading
+0 −34
Original line number Diff line number Diff line
@@ -722,30 +722,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        pulledData.add(e);
    }

    private void pullSystemIonHeapSize(
            int tagId, long elapsedNanos, long wallClockNanos,
            List<StatsLogEventWrapper> pulledData) {
        final long systemIonHeapSizeInBytes = readSystemIonHeapSizeFromDebugfs();
        StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
        e.writeLong(systemIonHeapSizeInBytes);
        pulledData.add(e);
    }

    private void pullProcessSystemIonHeapSize(
            int tagId, long elapsedNanos, long wallClockNanos,
            List<StatsLogEventWrapper> pulledData) {
        List<IonAllocations> result = readProcessSystemIonHeapSizesFromDebugfs();
        for (IonAllocations allocations : result) {
            StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
            e.writeInt(getUidForPid(allocations.pid));
            e.writeString(readCmdlineFromProcfs(allocations.pid));
            e.writeInt((int) (allocations.totalSizeInBytes / 1024));
            e.writeInt(allocations.count);
            e.writeInt((int) (allocations.maxSizeInBytes / 1024));
            pulledData.add(e);
        }
    }

    private void pullBinderCallsStats(
            int tagId, long elapsedNanos, long wallClockNanos,
            List<StatsLogEventWrapper> pulledData) {
@@ -1697,16 +1673,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
                break;
            }

            case StatsLog.SYSTEM_ION_HEAP_SIZE: {
                pullSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret);
                break;
            }

            case StatsLog.PROCESS_SYSTEM_ION_HEAP_SIZE: {
                pullProcessSystemIonHeapSize(tagId, elapsedNanos, wallClockNanos, ret);
                break;
            }

            case StatsLog.BINDER_CALLS: {
                pullBinderCallsStats(tagId, elapsedNanos, wallClockNanos, ret);
                break;
+0 −8
Original line number Diff line number Diff line
@@ -95,14 +95,6 @@ std::map<PullerKey, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = {
        {{.atomTag = android::util::BATTERY_CYCLE_COUNT},
         {.puller = new ResourceHealthManagerPuller(android::util::BATTERY_CYCLE_COUNT)}},

        // system_ion_heap_size
        {{.atomTag = android::util::SYSTEM_ION_HEAP_SIZE},
         {.puller = new StatsCompanionServicePuller(android::util::SYSTEM_ION_HEAP_SIZE)}},

        // process_system_ion_heap_size
        {{.atomTag = android::util::PROCESS_SYSTEM_ION_HEAP_SIZE},
         {.puller = new StatsCompanionServicePuller(android::util::PROCESS_SYSTEM_ION_HEAP_SIZE)}},

        // temperature
        {{.atomTag = android::util::TEMPERATURE},
         {.puller = new StatsCompanionServicePuller(android::util::TEMPERATURE)}},
+36 −6
Original line number Diff line number Diff line
@@ -1208,11 +1208,23 @@ public class StatsPullAtomService extends SystemService {
    }

    private void registerSystemIonHeapSize() {
        // No op.
        int tagId = StatsLog.SYSTEM_ION_HEAP_SIZE;
        mStatsManager.registerPullAtomCallback(
                tagId,
                null, // use default PullAtomMetadata values
                (atomTag, data) -> pullSystemIonHeapSize(atomTag, data),
                BackgroundThread.getExecutor()
        );
    }

    private void pullSystemIonHeapSize() {
        // No op.
    private int pullSystemIonHeapSize(int atomTag, List<StatsEvent> pulledData) {
        final long systemIonHeapSizeInBytes = readSystemIonHeapSizeFromDebugfs();
        StatsEvent e = StatsEvent.newBuilder()
                .setAtomId(atomTag)
                .writeLong(systemIonHeapSizeInBytes)
                .build();
        pulledData.add(e);
        return StatsManager.PULL_SUCCESS;
    }

    private void registerIonHeapSize() {
@@ -1236,11 +1248,29 @@ public class StatsPullAtomService extends SystemService {
    }

    private void registerProcessSystemIonHeapSize() {
        // No op.
        int tagId = StatsLog.PROCESS_SYSTEM_ION_HEAP_SIZE;
        mStatsManager.registerPullAtomCallback(
                tagId,
                null, // use default PullAtomMetadata values
                (atomTag, data) -> pullProcessSystemIonHeapSize(atomTag, data),
                BackgroundThread.getExecutor()
        );
    }

    private void pullProcessSystemIonHeapSize() {
        // No op.
    private int pullProcessSystemIonHeapSize(int atomTag, List<StatsEvent> pulledData) {
        List<IonAllocations> result = readProcessSystemIonHeapSizesFromDebugfs();
        for (IonAllocations allocations : result) {
            StatsEvent e = StatsEvent.newBuilder()
                    .setAtomId(atomTag)
                    .writeInt(getUidForPid(allocations.pid))
                    .writeString(readCmdlineFromProcfs(allocations.pid))
                    .writeInt((int) (allocations.totalSizeInBytes / 1024))
                    .writeInt(allocations.count)
                    .writeInt((int) (allocations.maxSizeInBytes / 1024))
                    .build();
            pulledData.add(e);
        }
        return StatsManager.PULL_SUCCESS;
    }

    private void registerTemperature() {