CpuStats - Do not write debug entries to dump output

Test: manually verified dumpsys output
Change-Id: I4054d6f4344d07c900b15a5bb3bb634b4291eab5
This commit is contained in:
Marcin Oczeretko
2018-12-17 18:03:45 +00:00
parent 735b19b731
commit 9450171068
3 changed files with 12 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
public static final boolean DETAILED_TRACKING_DEFAULT = true;
public static final int PERIODIC_SAMPLING_INTERVAL_DEFAULT = 100;
public static final int MAX_BINDER_CALL_STATS_COUNT_DEFAULT = 5000;
private static final String DEBUG_ENTRY_PREFIX = "__DEBUG_";
private static class OverflowBinder extends Binder {}
@@ -347,7 +348,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
callStat.callingUid = uid;
callStat.recordedCallCount = 1;
callStat.callCount = 1;
callStat.methodName = "__DEBUG_" + variableName;
callStat.methodName = DEBUG_ENTRY_PREFIX + variableName;
callStat.latencyMicros = value;
return callStat;
}
@@ -398,6 +399,10 @@ public class BinderCallsStats implements BinderInternal.Observer {
final List<ExportedCallStat> exportedCallStats = getExportedCallStats();
exportedCallStats.sort(BinderCallsStats::compareByCpuDesc);
for (ExportedCallStat e : exportedCallStats) {
if (e.methodName.startsWith(DEBUG_ENTRY_PREFIX)) {
// Do not dump debug entries.
continue;
}
sb.setLength(0);
sb.append(" ")
.append(packageMap.mapUid(e.callingUid))

View File

@@ -37,6 +37,7 @@ import java.util.concurrent.ThreadLocalRandom;
* @hide Only for use within the system server.
*/
public class LooperStats implements Looper.Observer {
public static final String DEBUG_ENTRY_PREFIX = "__DEBUG_";
private static final int SESSION_POOL_SIZE = 50;
@GuardedBy("mLock")
@@ -165,7 +166,7 @@ public class LooperStats implements Looper.Observer {
}
private ExportedEntry createDebugEntry(String variableName, long value) {
final Entry entry = new Entry("__DEBUG_" + variableName);
final Entry entry = new Entry(DEBUG_ENTRY_PREFIX + variableName);
entry.messageCount = 1;
entry.recordedMessageCount = 1;
entry.totalLatencyMicro = value;

View File

@@ -122,6 +122,10 @@ public class LooperStatsService extends Binder {
"exception_count"));
pw.println(header);
for (LooperStats.ExportedEntry entry : entries) {
if (entry.messageName.startsWith(LooperStats.DEBUG_ENTRY_PREFIX)) {
// Do not dump debug entries.
continue;
}
pw.printf("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n",
packageMap.mapUid(entry.workSourceUid),
entry.threadName,