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

Commit 94501710 authored by Marcin Oczeretko's avatar Marcin Oczeretko
Browse files

CpuStats - Do not write debug entries to dump output

Test: manually verified dumpsys output
Change-Id: I4054d6f4344d07c900b15a5bb3bb634b4291eab5
parent 735b19b7
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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))
+2 −1
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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,