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

Commit a4cc205e authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

More procstats work.

The historical data is now a more central part of the stats.
When a checkin happens, the data is not deleted, just marked
as checked in so we can continue to access it.

The default procstats dump is now a new "summary" mode that
shows a more useful set of data for all of the running processes.
By default the current and all committed states are shown; you
use "--current" to only show the current.  Use "--details" to
get the previous more detailed data (which now includes detailed
process data like the per-package data).

Also tweaked uid printing to be a little more compact.

Change-Id: I5414ea7c07134ebd5dc83f6f7b9f6e30151eda85
parent ef50a1a0
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1803,8 +1803,8 @@ public abstract class BatteryStats implements Parcelable {
            for (int i=0; i<timers.size(); i++) {
                TimerEntry timer = timers.get(i);
                sb.setLength(0);
                sb.append("  Wake lock #");
                sb.append(timer.mId);
                sb.append("  Wake lock ");
                UserHandle.formatUid(sb, timer.mId);
                sb.append(" ");
                sb.append(timer.mName);
                printWakeLock(sb, timer.mTimer, batteryRealtime, null, which, ": ");
@@ -1823,7 +1823,10 @@ public abstract class BatteryStats implements Parcelable {
            
            Uid u = uidStats.valueAt(iu);

            pw.println(prefix + "  #" + uid + ":");
            pw.print(prefix);
            pw.print("  ");
            UserHandle.formatUid(pw, uid);
            pw.println(":");
            boolean uidActivity = false;
            
            long mobileRxBytes = u.getNetworkActivityCount(NETWORK_MOBILE_RX_BYTES, which);
+8 −2
Original line number Diff line number Diff line
@@ -168,8 +168,11 @@ public final class UserHandle implements Parcelable {
            if (appId >= Process.FIRST_ISOLATED_UID && appId <= Process.LAST_ISOLATED_UID) {
                sb.append('i');
                sb.append(appId - Process.FIRST_ISOLATED_UID);
            } else {
            } else if (appId >= Process.FIRST_APPLICATION_UID) {
                sb.append('a');
                sb.append(appId - Process.FIRST_APPLICATION_UID);
            } else {
                sb.append('s');
                sb.append(appId);
            }
        }
@@ -190,8 +193,11 @@ public final class UserHandle implements Parcelable {
            if (appId >= Process.FIRST_ISOLATED_UID && appId <= Process.LAST_ISOLATED_UID) {
                pw.print('i');
                pw.print(appId - Process.FIRST_ISOLATED_UID);
            } else {
            } else if (appId >= Process.FIRST_APPLICATION_UID) {
                pw.print('a');
                pw.print(appId - Process.FIRST_APPLICATION_UID);
            } else {
                pw.print('s');
                pw.print(appId);
            }
        }
+2 −8
Original line number Diff line number Diff line
@@ -1795,7 +1795,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                return;
            }
            mActivityManagerService.dumpProcessTracker(fd, pw, args);
            mActivityManagerService.mProcessTracker.dump(fd, pw, args);
        }
    }
@@ -1821,7 +1821,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                : mBatteryStatsService.getActiveStatistics().getIsOnBattery();
        mBatteryStatsService.getActiveStatistics().setCallback(this);
        mProcessTracker = new ProcessTracker(new File(systemDir, "procstats"));
        mProcessTracker = new ProcessTracker(this, new File(systemDir, "procstats"));
        mUsageStatsService = new UsageStatsService(new File(systemDir, "usagestats").toString());
        mAppOpsService = new AppOpsService(new File(systemDir, "appops.xml"));
@@ -11345,12 +11345,6 @@ public final class ActivityManagerService extends ActivityManagerNative
        return false;
    }
    final void dumpProcessTracker(FileDescriptor fd, PrintWriter pw, String[] args) {
        synchronized (this) {
            mProcessTracker.dumpLocked(fd, pw, args);
        }
    }
    private final boolean removeDyingProviderLocked(ProcessRecord proc,
            ContentProviderRecord cpr, boolean always) {
        final boolean inLaunching = mLaunchingProviders.contains(cpr);
+8 −2
Original line number Diff line number Diff line
@@ -425,8 +425,14 @@ final class ProcessRecord {
        } else {
            sb.append('u');
            sb.append(userId);
            int appId = UserHandle.getAppId(info.uid);
            if (appId >= Process.FIRST_APPLICATION_UID) {
                sb.append('a');
            sb.append(UserHandle.getAppId(info.uid));
                sb.append(appId - Process.FIRST_APPLICATION_UID);
            } else {
                sb.append('s');
                sb.append(appId);
            }
            if (uid != info.uid) {
                sb.append('i');
                sb.append(UserHandle.getAppId(uid) - Process.FIRST_ISOLATED_UID);
+330 −114

File changed.

Preview size limit exceeded, changes collapsed.