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

Commit a4054125 authored by Mohamad Mahmoud's avatar Mohamad Mahmoud Committed by Android (Google) Code Review
Browse files

Merge "Limit the number of dumped processes in the CPU usage section in dropbox files to 10"

parents 40348095 b51fd80f
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -841,7 +841,19 @@ public class ProcessCpuTracker {
        return sw.toString();
    }

    final public String printCurrentState(long now) {
    /**
     * Returns current CPU state with all the processes as a String, sorted by load
     * in descending order.
     */
    public final String printCurrentState(long now) {
        return printCurrentState(now, Integer.MAX_VALUE);
    }

    /**
     * Returns current CPU state with the top {@code maxProcessesToDump} highest load
     * processes as a String, sorted by load in descending order.
     */
    public final String printCurrentState(long now, int maxProcessesToDump) {
        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

        buildWorkingProcs();
@@ -883,8 +895,8 @@ public class ProcessCpuTracker {
        if (DEBUG) Slog.i(TAG, "totalTime " + totalTime + " over sample time "
                + (mCurrentSampleTime-mLastSampleTime));

        int N = mWorkingProcs.size();
        for (int i=0; i<N; i++) {
        int dumpedProcessCount = Math.min(maxProcessesToDump, mWorkingProcs.size());
        for (int i = 0; i < dumpedProcessCount; i++) {
            Stats st = mWorkingProcs.get(i);
            printProcessCPU(pw, st.added ? " +" : (st.removed ? " -": "  "),
                    st.pid, st.name, (int)st.rel_uptime,
+2 −1
Original line number Diff line number Diff line
@@ -2314,7 +2314,8 @@ public class AppProfiler {

    void printCurrentCpuState(StringBuilder report, long time) {
        synchronized (mProcessCpuTracker) {
            report.append(mProcessCpuTracker.printCurrentState(time));
            // Only print the first 10 processes
            report.append(mProcessCpuTracker.printCurrentState(time, /* maxProcesses= */10));
        }
    }