Update to follow per-version proc stats change.
Change-Id: Iea44f1c7e9bd59a2eeaa1739bbaa5c0bdc349b0b
This commit is contained in:
@@ -23,6 +23,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.SparseArray;
|
||||||
import com.android.internal.app.ProcessStats;
|
import com.android.internal.app.ProcessStats;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -109,9 +110,12 @@ public final class ProcStatsEntry implements Parcelable {
|
|||||||
// See if there is one significant package that was running here.
|
// See if there is one significant package that was running here.
|
||||||
ArrayList<ProcStatsEntry> subProcs = new ArrayList<ProcStatsEntry>();
|
ArrayList<ProcStatsEntry> subProcs = new ArrayList<ProcStatsEntry>();
|
||||||
for (int ipkg=0; ipkg<mPackages.size(); ipkg++) {
|
for (int ipkg=0; ipkg<mPackages.size(); ipkg++) {
|
||||||
ProcessStats.PackageState pkgState = stats.mPackages.get(mPackages.get(ipkg), mUid);
|
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 "
|
if (DEBUG) Log.d(TAG, "Eval pkg of " + mName + ", pkg "
|
||||||
+ mPackages.get(ipkg) + ":");
|
+ pkgState + ":");
|
||||||
if (pkgState == null) {
|
if (pkgState == null) {
|
||||||
Log.w(TAG, "No package state found for " + mPackages.get(ipkg) + "/"
|
Log.w(TAG, "No package state found for " + mPackages.get(ipkg) + "/"
|
||||||
+ mUid + " in process " + mName);
|
+ mUid + " in process " + mName);
|
||||||
@@ -126,6 +130,7 @@ public final class ProcStatsEntry implements Parcelable {
|
|||||||
subProcs.add(new ProcStatsEntry(pkgProc, pkgState.mPackageName, totals, useUss,
|
subProcs.add(new ProcStatsEntry(pkgProc, pkgState.mPackageName, totals, useUss,
|
||||||
weightWithTime));
|
weightWithTime));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (subProcs.size() > 1) {
|
if (subProcs.size() > 1) {
|
||||||
Collections.sort(subProcs, compare);
|
Collections.sort(subProcs, compare);
|
||||||
if (subProcs.get(0).mWeight > (subProcs.get(1).mWeight*3)) {
|
if (subProcs.get(0).mWeight > (subProcs.get(1).mWeight*3)) {
|
||||||
|
@@ -466,10 +466,12 @@ public class ProcessStatsUi extends PreferenceFragment
|
|||||||
|
|
||||||
final ProcessMap<ProcStatsEntry> entriesMap = new ProcessMap<ProcStatsEntry>();
|
final ProcessMap<ProcStatsEntry> entriesMap = new ProcessMap<ProcStatsEntry>();
|
||||||
for (int ipkg=0, N=mStats.mPackages.getMap().size(); ipkg<N; ipkg++) {
|
for (int ipkg=0, N=mStats.mPackages.getMap().size(); ipkg<N; ipkg++) {
|
||||||
final SparseArray<ProcessStats.PackageState> pkgUids
|
final SparseArray<SparseArray<ProcessStats.PackageState>> pkgUids
|
||||||
= mStats.mPackages.getMap().valueAt(ipkg);
|
= mStats.mPackages.getMap().valueAt(ipkg);
|
||||||
for (int iu=0; iu<pkgUids.size(); iu++) {
|
for (int iu=0; iu<pkgUids.size(); iu++) {
|
||||||
final ProcessStats.PackageState st = pkgUids.valueAt(iu);
|
final SparseArray<ProcessStats.PackageState> vpkgs = pkgUids.valueAt(iu);
|
||||||
|
for (int iv=0; iv<vpkgs.size(); iv++) {
|
||||||
|
final ProcessStats.PackageState st = vpkgs.valueAt(iv);
|
||||||
for (int iproc=0; iproc<st.mProcesses.size(); iproc++) {
|
for (int iproc=0; iproc<st.mProcesses.size(); iproc++) {
|
||||||
final ProcessStats.ProcessState pkgProc = st.mProcesses.valueAt(iproc);
|
final ProcessStats.ProcessState pkgProc = st.mProcesses.valueAt(iproc);
|
||||||
final ProcessStats.ProcessState proc = mStats.mProcesses.get(pkgProc.mName,
|
final ProcessStats.ProcessState proc = mStats.mProcesses.get(pkgProc.mName,
|
||||||
@@ -497,15 +499,19 @@ public class ProcessStatsUi extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "-------------------- MAPPING SERVICES");
|
if (DEBUG) Log.d(TAG, "-------------------- MAPPING SERVICES");
|
||||||
|
|
||||||
// Add in service info.
|
// Add in service info.
|
||||||
if (mStatsType == MENU_TYPE_BACKGROUND) {
|
if (mStatsType == MENU_TYPE_BACKGROUND) {
|
||||||
for (int ip=0, N=mStats.mPackages.getMap().size(); ip<N; ip++) {
|
for (int ip=0, N=mStats.mPackages.getMap().size(); ip<N; ip++) {
|
||||||
SparseArray<ProcessStats.PackageState> uids = mStats.mPackages.getMap().valueAt(ip);
|
SparseArray<SparseArray<ProcessStats.PackageState>> uids
|
||||||
|
= mStats.mPackages.getMap().valueAt(ip);
|
||||||
for (int iu=0; iu<uids.size(); iu++) {
|
for (int iu=0; iu<uids.size(); iu++) {
|
||||||
ProcessStats.PackageState ps = uids.valueAt(iu);
|
SparseArray<ProcessStats.PackageState> vpkgs = uids.valueAt(iu);
|
||||||
|
for (int iv=0; iv<vpkgs.size(); iv++) {
|
||||||
|
ProcessStats.PackageState ps = vpkgs.valueAt(iv);
|
||||||
for (int is=0, NS=ps.mServices.size(); is<NS; is++) {
|
for (int is=0, NS=ps.mServices.size(); is<NS; is++) {
|
||||||
ProcessStats.ServiceState ss = ps.mServices.valueAt(is);
|
ProcessStats.ServiceState ss = ps.mServices.valueAt(is);
|
||||||
if (ss.mProcessName != null) {
|
if (ss.mProcessName != null) {
|
||||||
@@ -524,6 +530,7 @@ public class ProcessStatsUi extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SparseArray<ArrayMap<String, ProcStatsEntry>> processes
|
SparseArray<ArrayMap<String, ProcStatsEntry>> processes
|
||||||
|
Reference in New Issue
Block a user