Update to follow per-version proc stats change.

Change-Id: Iea44f1c7e9bd59a2eeaa1739bbaa5c0bdc349b0b
This commit is contained in:
Dianne Hackborn
2014-01-23 17:59:49 -08:00
parent e179bb0133
commit ab89566e82
2 changed files with 65 additions and 53 deletions

View File

@@ -23,6 +23,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseArray;
import com.android.internal.app.ProcessStats;
import java.util.ArrayList;
@@ -109,22 +110,26 @@ public final class ProcStatsEntry implements Parcelable {
// See if there is one significant package that was running here.
ArrayList<ProcStatsEntry> subProcs = new ArrayList<ProcStatsEntry>();
for (int ipkg=0; ipkg<mPackages.size(); ipkg++) {
ProcessStats.PackageState pkgState = stats.mPackages.get(mPackages.get(ipkg), mUid);
if (DEBUG) Log.d(TAG, "Eval pkg of " + mName + ", pkg "
+ mPackages.get(ipkg) + ":");
if (pkgState == null) {
Log.w(TAG, "No package state found for " + mPackages.get(ipkg) + "/"
+ mUid + " in process " + mName);
continue;
SparseArray<ProcessStats.PackageState> vpkgs
= stats.mPackages.get(mPackages.get(ipkg), mUid);
for (int ivers=0; ivers<vpkgs.size(); ivers++) {
ProcessStats.PackageState pkgState = vpkgs.valueAt(ivers);
if (DEBUG) Log.d(TAG, "Eval pkg of " + mName + ", pkg "
+ pkgState + ":");
if (pkgState == null) {
Log.w(TAG, "No package state found for " + mPackages.get(ipkg) + "/"
+ mUid + " in process " + mName);
continue;
}
ProcessStats.ProcessState pkgProc = pkgState.mProcesses.get(mName);
if (pkgProc == null) {
Log.w(TAG, "No process " + mName + " found in package state "
+ mPackages.get(ipkg) + "/" + mUid);
continue;
}
subProcs.add(new ProcStatsEntry(pkgProc, pkgState.mPackageName, totals, useUss,
weightWithTime));
}
ProcessStats.ProcessState pkgProc = pkgState.mProcesses.get(mName);
if (pkgProc == null) {
Log.w(TAG, "No process " + mName + " found in package state "
+ mPackages.get(ipkg) + "/" + mUid);
continue;
}
subProcs.add(new ProcStatsEntry(pkgProc, pkgState.mPackageName, totals, useUss,
weightWithTime));
}
if (subProcs.size() > 1) {
Collections.sort(subProcs, compare);