Loading cmds/statsd/src/atoms.proto +21 −4 Original line number Diff line number Diff line Loading @@ -3331,10 +3331,27 @@ message CpuTimePerThreadFreq { optional string process_name = 4; // Name of the thread taken from `/proc/$PID/task/$TID/comm` optional string thread_name = 5; // What frequency the CPU was running at, in KHz optional int32 frequency_khz = 6; // Time spent in frequency in milliseconds, since thread start. optional int32 time_millis = 7; // Report eight different frequencies, and how much time is spent in each frequency. Frequencies // are given in KHz, and time is given in milliseconds since the thread started. All eight // frequencies are given here as the alternative is sending eight separate atoms. This method // significantly reduces the amount of data created optional int32 frequency1_khz = 6; optional int32 time1_millis = 7; optional int32 frequency2_khz = 8; optional int32 time2_millis = 9; optional int32 frequency3_khz = 10; optional int32 time3_millis = 11; optional int32 frequency4_khz = 12; optional int32 time4_millis = 13; optional int32 frequency5_khz = 14; optional int32 time5_millis = 15; optional int32 frequency6_khz = 16; optional int32 time6_millis = 17; optional int32 frequency7_khz = 18; optional int32 time7_millis = 19; optional int32 frequency8_khz = 20; optional int32 time8_millis = 21; } /** Loading cmds/statsd/src/external/StatsPullerManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { 5 * NS_PER_SEC /* min cool-down in seconds*/, new StatsCompanionServicePuller(android::util::PROCESS_CPU_TIME)}}, {android::util::CPU_TIME_PER_THREAD_FREQ, {{7}, {{7, 9, 11, 13, 15, 17, 19, 21}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::CPU_TIME_PER_THREAD_FREQ)}}, // DeviceCalculatedPowerUse. Loading services/core/java/com/android/server/stats/StatsCompanionService.java +15 −9 Original line number Diff line number Diff line Loading @@ -201,6 +201,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { // "zygote64", }; private static final int CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES = 8; static final class CompanionHandler extends Handler { CompanionHandler(Looper looper) { Loading Loading @@ -1654,6 +1655,11 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { return; } int[] cpuFrequencies = mKernelCpuThreadReader.getCpuFrequenciesKhz(); if (cpuFrequencies.length != CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES) { Slog.w(TAG, "Expected " + CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES + " frequencies, but got " + cpuFrequencies.length); return; } for (int i = 0; i < processCpuUsages.size(); i++) { KernelCpuThreadReader.ProcessCpuUsage processCpuUsage = processCpuUsages.get(i); ArrayList<KernelCpuThreadReader.ThreadCpuUsage> threadCpuUsages = Loading @@ -1667,7 +1673,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { continue; } for (int k = 0; k < threadCpuUsage.usageTimesMillis.length; k++) { StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(processCpuUsage.uid); Loading @@ -1675,10 +1680,11 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { e.writeInt(threadCpuUsage.threadId); e.writeString(processCpuUsage.processName); e.writeString(threadCpuUsage.threadName); for (int k = 0; k < CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES; k++) { e.writeInt(cpuFrequencies[k]); e.writeInt(threadCpuUsage.usageTimesMillis[k]); pulledData.add(e); } pulledData.add(e); } } } Loading Loading
cmds/statsd/src/atoms.proto +21 −4 Original line number Diff line number Diff line Loading @@ -3331,10 +3331,27 @@ message CpuTimePerThreadFreq { optional string process_name = 4; // Name of the thread taken from `/proc/$PID/task/$TID/comm` optional string thread_name = 5; // What frequency the CPU was running at, in KHz optional int32 frequency_khz = 6; // Time spent in frequency in milliseconds, since thread start. optional int32 time_millis = 7; // Report eight different frequencies, and how much time is spent in each frequency. Frequencies // are given in KHz, and time is given in milliseconds since the thread started. All eight // frequencies are given here as the alternative is sending eight separate atoms. This method // significantly reduces the amount of data created optional int32 frequency1_khz = 6; optional int32 time1_millis = 7; optional int32 frequency2_khz = 8; optional int32 time2_millis = 9; optional int32 frequency3_khz = 10; optional int32 time3_millis = 11; optional int32 frequency4_khz = 12; optional int32 time4_millis = 13; optional int32 frequency5_khz = 14; optional int32 time5_millis = 15; optional int32 frequency6_khz = 16; optional int32 time6_millis = 17; optional int32 frequency7_khz = 18; optional int32 time7_millis = 19; optional int32 frequency8_khz = 20; optional int32 time8_millis = 21; } /** Loading
cmds/statsd/src/external/StatsPullerManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,7 @@ const std::map<int, PullAtomInfo> StatsPullerManager::kAllPullAtomInfo = { 5 * NS_PER_SEC /* min cool-down in seconds*/, new StatsCompanionServicePuller(android::util::PROCESS_CPU_TIME)}}, {android::util::CPU_TIME_PER_THREAD_FREQ, {{7}, {{7, 9, 11, 13, 15, 17, 19, 21}, 1 * NS_PER_SEC, new StatsCompanionServicePuller(android::util::CPU_TIME_PER_THREAD_FREQ)}}, // DeviceCalculatedPowerUse. Loading
services/core/java/com/android/server/stats/StatsCompanionService.java +15 −9 Original line number Diff line number Diff line Loading @@ -201,6 +201,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { // "zygote64", }; private static final int CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES = 8; static final class CompanionHandler extends Handler { CompanionHandler(Looper looper) { Loading Loading @@ -1654,6 +1655,11 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { return; } int[] cpuFrequencies = mKernelCpuThreadReader.getCpuFrequenciesKhz(); if (cpuFrequencies.length != CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES) { Slog.w(TAG, "Expected " + CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES + " frequencies, but got " + cpuFrequencies.length); return; } for (int i = 0; i < processCpuUsages.size(); i++) { KernelCpuThreadReader.ProcessCpuUsage processCpuUsage = processCpuUsages.get(i); ArrayList<KernelCpuThreadReader.ThreadCpuUsage> threadCpuUsages = Loading @@ -1667,7 +1673,6 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { continue; } for (int k = 0; k < threadCpuUsage.usageTimesMillis.length; k++) { StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(processCpuUsage.uid); Loading @@ -1675,10 +1680,11 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { e.writeInt(threadCpuUsage.threadId); e.writeString(processCpuUsage.processName); e.writeString(threadCpuUsage.threadName); for (int k = 0; k < CPU_TIME_PER_THREAD_FREQ_NUM_FREQUENCIES; k++) { e.writeInt(cpuFrequencies[k]); e.writeInt(threadCpuUsage.usageTimesMillis[k]); pulledData.add(e); } pulledData.add(e); } } } Loading