Improve efficiency for CpuTimePerUidFreq
Tested on marlin. Shortly after boot, the total is 468 fileds with non zero time spent at frequency. It quickly swell to 1600+ though. It is some improvement compared to 2700+, but still an extremely large pulled atom. Bug: 74965273 Test: manual test Change-Id: Ibbeaa02f54d91c4958d75dd3aaafbb306d61f8d8
This commit is contained in:
@@ -720,11 +720,13 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
|
||||
long elapsedNanos = SystemClock.elapsedRealtimeNanos();
|
||||
mKernelUidCpuFreqTimeReader.readAbsolute((uid, cpuFreqTimeMs) -> {
|
||||
for (int freqIndex = 0; freqIndex < cpuFreqTimeMs.length; ++freqIndex) {
|
||||
StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 3);
|
||||
e.writeInt(uid);
|
||||
e.writeInt(freqIndex);
|
||||
e.writeLong(cpuFreqTimeMs[freqIndex]);
|
||||
pulledData.add(e);
|
||||
if(cpuFreqTimeMs[freqIndex] != 0) {
|
||||
StatsLogEventWrapper e = new StatsLogEventWrapper(elapsedNanos, tagId, 3);
|
||||
e.writeInt(uid);
|
||||
e.writeInt(freqIndex);
|
||||
e.writeLong(cpuFreqTimeMs[freqIndex]);
|
||||
pulledData.add(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user