Loading core/java/com/android/internal/app/ProcessStats.java +481 −18 File changed.Preview size limit exceeded, changes collapsed. Show changes core/java/com/android/internal/os/BatteryStatsImpl.java +3 −6 Original line number Diff line number Diff line Loading @@ -291,6 +291,7 @@ public final class BatteryStatsImpl extends BatteryStats { final StopwatchTimer[] mBluetoothStateTimer = new StopwatchTimer[NUM_BLUETOOTH_STATES]; int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW; long mMobileRadioActiveStartTime; StopwatchTimer mMobileRadioActiveTimer; StopwatchTimer mMobileRadioActivePerAppTimer; LongSamplingCounter mMobileRadioActiveAdjustedTime; Loading Loading @@ -1425,10 +1426,6 @@ public final class BatteryStatsImpl extends BatteryStats { return 0; } long getLastUpdateTimeMs() { return mUpdateTime; } void stopRunningLocked(long elapsedRealtimeMs) { // Ignore attempt to stop a timer that isn't running if (mNesting == 0) { Loading Loading @@ -2790,11 +2787,11 @@ public final class BatteryStatsImpl extends BatteryStats { powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM || powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH; if (active) { realElapsedRealtimeMs = elapsedRealtime; mMobileRadioActiveStartTime = realElapsedRealtimeMs = elapsedRealtime; mHistoryCur.states |= HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG; } else { realElapsedRealtimeMs = timestampNs / (1000*1000); long lastUpdateTimeMs = mMobileRadioActiveTimer.getLastUpdateTimeMs(); long lastUpdateTimeMs = mMobileRadioActiveStartTime; if (realElapsedRealtimeMs < lastUpdateTimeMs) { Slog.wtf(TAG, "Data connection inactive timestamp " + realElapsedRealtimeMs + " is before start time " + lastUpdateTimeMs); Loading services/core/java/com/android/server/am/ActiveServices.java +3 −2 Original line number Diff line number Diff line Loading @@ -1328,7 +1328,7 @@ public final class ActiveServices { + " app=" + app); if (app != null && app.thread != null) { try { app.addPackage(r.appInfo.packageName, mAm.mProcessStats); app.addPackage(r.appInfo.packageName, r.appInfo.versionCode, mAm.mProcessStats); realStartServiceLocked(r, app, execInFg); return null; } catch (RemoteException e) { Loading Loading @@ -1883,7 +1883,8 @@ public final class ActiveServices { mPendingServices.remove(i); i--; proc.addPackage(sr.appInfo.packageName, mAm.mProcessStats); proc.addPackage(sr.appInfo.packageName, sr.appInfo.versionCode, mAm.mProcessStats); realStartServiceLocked(sr, proc, sr.createdFromFg); didSomething = true; } Loading services/core/java/com/android/server/am/ActivityManagerService.java +65 −4 Original line number Diff line number Diff line Loading @@ -569,6 +569,12 @@ public final class ActivityManagerService extends ActivityManagerNative */ long mLastFullPssTime = SystemClock.uptimeMillis(); /** * If set, the next time we collect PSS data we should do a full collection * with data from native processes and the kernel. */ boolean mFullPssPending = false; /** * This is the process holding what we currently consider to be * the "home" activity. Loading Loading @@ -1801,8 +1807,49 @@ public final class ActivityManagerService extends ActivityManagerNative public void handleMessage(Message msg) { switch (msg.what) { case COLLECT_PSS_BG_MSG: { int i=0, num=0; long start = SystemClock.uptimeMillis(); MemInfoReader memInfo = null; synchronized (ActivityManagerService.this) { if (mFullPssPending) { mFullPssPending = false; memInfo = new MemInfoReader(); } } if (memInfo != null) { updateCpuStatsNow(); long nativeTotalPss = 0; synchronized (mProcessCpuThread) { final int N = mProcessCpuTracker.countStats(); for (int j=0; j<N; j++) { ProcessCpuTracker.Stats st = mProcessCpuTracker.getStats(j); if (st.vsize <= 0 || st.uid >= Process.FIRST_APPLICATION_UID || st.uid == Process.SYSTEM_UID) { // This is definitely an application process; skip it. continue; } synchronized (mPidsSelfLocked) { if (mPidsSelfLocked.indexOfKey(st.pid) >= 0) { // This is one of our own processes; skip it. continue; } } nativeTotalPss += Debug.getPss(st.pid, null); } } memInfo.readMemInfo(); synchronized (this) { if (DEBUG_PSS) Slog.d(TAG, "Collected native and kernel memory in " + (SystemClock.uptimeMillis()-start) + "ms"); mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(), memInfo.getFreeSizeKb(), memInfo.getSwapTotalSizeKb()-memInfo.getSwapFreeSizeKb(), memInfo.getBuffersSizeKb()+memInfo.getShmemSizeKb() +memInfo.getSlabSizeKb(), nativeTotalPss); } } int i=0, num=0; long[] tmp = new long[1]; do { ProcessRecord proc; Loading Loading @@ -2769,7 +2816,7 @@ public final class ActivityManagerService extends ActivityManagerNative // come up (we have a pid but not yet its thread), so keep it. if (DEBUG_PROCESSES) Slog.v(TAG, "App already running: " + app); // If this is a new package in the process, add the package to the list app.addPackage(info.packageName, mProcessStats); app.addPackage(info.packageName, info.versionCode, mProcessStats); return app; } Loading Loading @@ -2824,7 +2871,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } else { // If this is a new package in the process, add the package to the list app.addPackage(info.packageName, mProcessStats); app.addPackage(info.packageName, info.versionCode, mProcessStats); } // If the system is not ready yet, then hold off on starting this Loading Loading @@ -7780,7 +7827,8 @@ public final class ActivityManagerService extends ActivityManagerNative // to run in multiple processes, because this is actually // part of the framework so doesn't make sense to track as a // separate apk in the process. app.addPackage(cpi.applicationInfo.packageName, mProcessStats); app.addPackage(cpi.applicationInfo.packageName, cpi.applicationInfo.versionCode, mProcessStats); } ensurePackageDexOpt(cpi.applicationInfo.packageName); } Loading Loading @@ -12588,6 +12636,8 @@ public final class ActivityManagerService extends ActivityManagerNative } } long nativeProcTotalPss = 0; if (!isCheckinRequest && procs.size() > 1) { // If we are showing aggregations, also look for native processes to // include so that our aggregations are more accurate. Loading @@ -12609,6 +12659,7 @@ public final class ActivityManagerService extends ActivityManagerNative final long myTotalPss = mi.getTotalPss(); totalPss += myTotalPss; nativeProcTotalPss += myTotalPss; MemItem pssItem = new MemItem(st.name + " (pid " + st.pid + ")", st.name, myTotalPss, st.pid, false); Loading Loading @@ -12676,6 +12727,15 @@ public final class ActivityManagerService extends ActivityManagerNative } MemInfoReader memInfo = new MemInfoReader(); memInfo.readMemInfo(); if (nativeProcTotalPss > 0) { synchronized (this) { mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(), memInfo.getFreeSizeKb(), memInfo.getSwapTotalSizeKb()-memInfo.getSwapFreeSizeKb(), memInfo.getBuffersSizeKb()+memInfo.getShmemSizeKb()+memInfo.getSlabSizeKb(), nativeProcTotalPss); } } if (!brief) { if (!isCompact) { pw.print("Total RAM: "); pw.print(memInfo.getTotalSizeKb()); Loading Loading @@ -15456,6 +15516,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (DEBUG_PSS) Slog.d(TAG, "Requesting PSS of all procs! memLowered=" + memLowered); mLastFullPssTime = now; mFullPssPending = true; mPendingPssProcesses.ensureCapacity(mLruProcesses.size()); mPendingPssProcesses.clear(); for (int i=mLruProcesses.size()-1; i>=0; i--) { services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −1 Original line number Diff line number Diff line Loading @@ -1178,7 +1178,8 @@ public final class ActivityStackSupervisor implements DisplayListener { // to run in multiple processes, because this is actually // part of the framework so doesn't make sense to track as a // separate apk in the process. app.addPackage(r.info.packageName, mService.mProcessStats); app.addPackage(r.info.packageName, r.info.applicationInfo.versionCode, mService.mProcessStats); } realStartActivityLocked(r, app, andResume, checkConfig); return; Loading Loading
core/java/com/android/internal/app/ProcessStats.java +481 −18 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/java/com/android/internal/os/BatteryStatsImpl.java +3 −6 Original line number Diff line number Diff line Loading @@ -291,6 +291,7 @@ public final class BatteryStatsImpl extends BatteryStats { final StopwatchTimer[] mBluetoothStateTimer = new StopwatchTimer[NUM_BLUETOOTH_STATES]; int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW; long mMobileRadioActiveStartTime; StopwatchTimer mMobileRadioActiveTimer; StopwatchTimer mMobileRadioActivePerAppTimer; LongSamplingCounter mMobileRadioActiveAdjustedTime; Loading Loading @@ -1425,10 +1426,6 @@ public final class BatteryStatsImpl extends BatteryStats { return 0; } long getLastUpdateTimeMs() { return mUpdateTime; } void stopRunningLocked(long elapsedRealtimeMs) { // Ignore attempt to stop a timer that isn't running if (mNesting == 0) { Loading Loading @@ -2790,11 +2787,11 @@ public final class BatteryStatsImpl extends BatteryStats { powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_MEDIUM || powerState == DataConnectionRealTimeInfo.DC_POWER_STATE_HIGH; if (active) { realElapsedRealtimeMs = elapsedRealtime; mMobileRadioActiveStartTime = realElapsedRealtimeMs = elapsedRealtime; mHistoryCur.states |= HistoryItem.STATE_MOBILE_RADIO_ACTIVE_FLAG; } else { realElapsedRealtimeMs = timestampNs / (1000*1000); long lastUpdateTimeMs = mMobileRadioActiveTimer.getLastUpdateTimeMs(); long lastUpdateTimeMs = mMobileRadioActiveStartTime; if (realElapsedRealtimeMs < lastUpdateTimeMs) { Slog.wtf(TAG, "Data connection inactive timestamp " + realElapsedRealtimeMs + " is before start time " + lastUpdateTimeMs); Loading
services/core/java/com/android/server/am/ActiveServices.java +3 −2 Original line number Diff line number Diff line Loading @@ -1328,7 +1328,7 @@ public final class ActiveServices { + " app=" + app); if (app != null && app.thread != null) { try { app.addPackage(r.appInfo.packageName, mAm.mProcessStats); app.addPackage(r.appInfo.packageName, r.appInfo.versionCode, mAm.mProcessStats); realStartServiceLocked(r, app, execInFg); return null; } catch (RemoteException e) { Loading Loading @@ -1883,7 +1883,8 @@ public final class ActiveServices { mPendingServices.remove(i); i--; proc.addPackage(sr.appInfo.packageName, mAm.mProcessStats); proc.addPackage(sr.appInfo.packageName, sr.appInfo.versionCode, mAm.mProcessStats); realStartServiceLocked(sr, proc, sr.createdFromFg); didSomething = true; } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +65 −4 Original line number Diff line number Diff line Loading @@ -569,6 +569,12 @@ public final class ActivityManagerService extends ActivityManagerNative */ long mLastFullPssTime = SystemClock.uptimeMillis(); /** * If set, the next time we collect PSS data we should do a full collection * with data from native processes and the kernel. */ boolean mFullPssPending = false; /** * This is the process holding what we currently consider to be * the "home" activity. Loading Loading @@ -1801,8 +1807,49 @@ public final class ActivityManagerService extends ActivityManagerNative public void handleMessage(Message msg) { switch (msg.what) { case COLLECT_PSS_BG_MSG: { int i=0, num=0; long start = SystemClock.uptimeMillis(); MemInfoReader memInfo = null; synchronized (ActivityManagerService.this) { if (mFullPssPending) { mFullPssPending = false; memInfo = new MemInfoReader(); } } if (memInfo != null) { updateCpuStatsNow(); long nativeTotalPss = 0; synchronized (mProcessCpuThread) { final int N = mProcessCpuTracker.countStats(); for (int j=0; j<N; j++) { ProcessCpuTracker.Stats st = mProcessCpuTracker.getStats(j); if (st.vsize <= 0 || st.uid >= Process.FIRST_APPLICATION_UID || st.uid == Process.SYSTEM_UID) { // This is definitely an application process; skip it. continue; } synchronized (mPidsSelfLocked) { if (mPidsSelfLocked.indexOfKey(st.pid) >= 0) { // This is one of our own processes; skip it. continue; } } nativeTotalPss += Debug.getPss(st.pid, null); } } memInfo.readMemInfo(); synchronized (this) { if (DEBUG_PSS) Slog.d(TAG, "Collected native and kernel memory in " + (SystemClock.uptimeMillis()-start) + "ms"); mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(), memInfo.getFreeSizeKb(), memInfo.getSwapTotalSizeKb()-memInfo.getSwapFreeSizeKb(), memInfo.getBuffersSizeKb()+memInfo.getShmemSizeKb() +memInfo.getSlabSizeKb(), nativeTotalPss); } } int i=0, num=0; long[] tmp = new long[1]; do { ProcessRecord proc; Loading Loading @@ -2769,7 +2816,7 @@ public final class ActivityManagerService extends ActivityManagerNative // come up (we have a pid but not yet its thread), so keep it. if (DEBUG_PROCESSES) Slog.v(TAG, "App already running: " + app); // If this is a new package in the process, add the package to the list app.addPackage(info.packageName, mProcessStats); app.addPackage(info.packageName, info.versionCode, mProcessStats); return app; } Loading Loading @@ -2824,7 +2871,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } else { // If this is a new package in the process, add the package to the list app.addPackage(info.packageName, mProcessStats); app.addPackage(info.packageName, info.versionCode, mProcessStats); } // If the system is not ready yet, then hold off on starting this Loading Loading @@ -7780,7 +7827,8 @@ public final class ActivityManagerService extends ActivityManagerNative // to run in multiple processes, because this is actually // part of the framework so doesn't make sense to track as a // separate apk in the process. app.addPackage(cpi.applicationInfo.packageName, mProcessStats); app.addPackage(cpi.applicationInfo.packageName, cpi.applicationInfo.versionCode, mProcessStats); } ensurePackageDexOpt(cpi.applicationInfo.packageName); } Loading Loading @@ -12588,6 +12636,8 @@ public final class ActivityManagerService extends ActivityManagerNative } } long nativeProcTotalPss = 0; if (!isCheckinRequest && procs.size() > 1) { // If we are showing aggregations, also look for native processes to // include so that our aggregations are more accurate. Loading @@ -12609,6 +12659,7 @@ public final class ActivityManagerService extends ActivityManagerNative final long myTotalPss = mi.getTotalPss(); totalPss += myTotalPss; nativeProcTotalPss += myTotalPss; MemItem pssItem = new MemItem(st.name + " (pid " + st.pid + ")", st.name, myTotalPss, st.pid, false); Loading Loading @@ -12676,6 +12727,15 @@ public final class ActivityManagerService extends ActivityManagerNative } MemInfoReader memInfo = new MemInfoReader(); memInfo.readMemInfo(); if (nativeProcTotalPss > 0) { synchronized (this) { mProcessStats.addSysMemUsageLocked(memInfo.getCachedSizeKb(), memInfo.getFreeSizeKb(), memInfo.getSwapTotalSizeKb()-memInfo.getSwapFreeSizeKb(), memInfo.getBuffersSizeKb()+memInfo.getShmemSizeKb()+memInfo.getSlabSizeKb(), nativeProcTotalPss); } } if (!brief) { if (!isCompact) { pw.print("Total RAM: "); pw.print(memInfo.getTotalSizeKb()); Loading Loading @@ -15456,6 +15516,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (DEBUG_PSS) Slog.d(TAG, "Requesting PSS of all procs! memLowered=" + memLowered); mLastFullPssTime = now; mFullPssPending = true; mPendingPssProcesses.ensureCapacity(mLruProcesses.size()); mPendingPssProcesses.clear(); for (int i=mLruProcesses.size()-1; i>=0; i--) {
services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −1 Original line number Diff line number Diff line Loading @@ -1178,7 +1178,8 @@ public final class ActivityStackSupervisor implements DisplayListener { // to run in multiple processes, because this is actually // part of the framework so doesn't make sense to track as a // separate apk in the process. app.addPackage(r.info.packageName, mService.mProcessStats); app.addPackage(r.info.packageName, r.info.applicationInfo.versionCode, mService.mProcessStats); } realStartActivityLocked(r, app, andResume, checkConfig); return; Loading