Loading core/java/com/android/internal/os/LooperStats.java +7 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ public class LooperStats implements Looper.Observer { private final int mEntriesSizeCap; private int mSamplingInterval; private CachedDeviceState.Readonly mDeviceState; private long mStartTime = System.currentTimeMillis(); public LooperStats(int samplingInterval, int entriesSizeCap) { this.mSamplingInterval = samplingInterval; Loading Loading @@ -144,6 +145,11 @@ public class LooperStats implements Looper.Observer { return exportedEntries; } /** Returns a timestamp indicating when the statistics were last reset. */ public long getStartTimeMillis() { return mStartTime; } private void maybeAddSpecialEntry(List<ExportedEntry> exportedEntries, Entry specialEntry) { synchronized (specialEntry) { if (specialEntry.messageCount > 0 || specialEntry.exceptionCount > 0) { Loading @@ -163,6 +169,7 @@ public class LooperStats implements Looper.Observer { synchronized (mOverflowEntry) { mOverflowEntry.reset(); } mStartTime = System.currentTimeMillis(); } public void setSamplingInterval(int samplingInterval) { Loading services/core/java/com/android/server/LooperStatsService.java +4 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.ShellCommand; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.text.format.DateFormat; import android.util.KeyValueListParser; import android.util.Slog; Loading Loading @@ -91,7 +92,9 @@ public class LooperStatsService extends Binder { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; List<LooperStats.ExportedEntry> entries = mStats.getEntries(); pw.print("Start time: "); pw.println(DateFormat.format("yyyy-MM-dd HH:mm:ss", mStats.getStartTimeMillis())); final List<LooperStats.ExportedEntry> entries = mStats.getEntries(); entries.sort(Comparator .comparing((LooperStats.ExportedEntry entry) -> entry.workSourceUid) .thenComparing(entry -> entry.threadName) Loading Loading
core/java/com/android/internal/os/LooperStats.java +7 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ public class LooperStats implements Looper.Observer { private final int mEntriesSizeCap; private int mSamplingInterval; private CachedDeviceState.Readonly mDeviceState; private long mStartTime = System.currentTimeMillis(); public LooperStats(int samplingInterval, int entriesSizeCap) { this.mSamplingInterval = samplingInterval; Loading Loading @@ -144,6 +145,11 @@ public class LooperStats implements Looper.Observer { return exportedEntries; } /** Returns a timestamp indicating when the statistics were last reset. */ public long getStartTimeMillis() { return mStartTime; } private void maybeAddSpecialEntry(List<ExportedEntry> exportedEntries, Entry specialEntry) { synchronized (specialEntry) { if (specialEntry.messageCount > 0 || specialEntry.exceptionCount > 0) { Loading @@ -163,6 +169,7 @@ public class LooperStats implements Looper.Observer { synchronized (mOverflowEntry) { mOverflowEntry.reset(); } mStartTime = System.currentTimeMillis(); } public void setSamplingInterval(int samplingInterval) { Loading
services/core/java/com/android/server/LooperStatsService.java +4 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.os.ShellCommand; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.text.format.DateFormat; import android.util.KeyValueListParser; import android.util.Slog; Loading Loading @@ -91,7 +92,9 @@ public class LooperStatsService extends Binder { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return; List<LooperStats.ExportedEntry> entries = mStats.getEntries(); pw.print("Start time: "); pw.println(DateFormat.format("yyyy-MM-dd HH:mm:ss", mStats.getStartTimeMillis())); final List<LooperStats.ExportedEntry> entries = mStats.getEntries(); entries.sort(Comparator .comparing((LooperStats.ExportedEntry entry) -> entry.workSourceUid) .thenComparing(entry -> entry.threadName) Loading