Allow tapping on memory status regions to filter proc stats.
Change-Id: Iade56907df648a95600919578154635c49ac9dce
This commit is contained in:
@@ -31,7 +31,8 @@
|
|||||||
android:layout_toStartOf="@+id/value"
|
android:layout_toStartOf="@+id/value"
|
||||||
android:layout_marginBottom="4dip"
|
android:layout_marginBottom="4dip"
|
||||||
android:layout_marginTop="4dip"
|
android:layout_marginTop="4dip"
|
||||||
android:layout_marginStart="4dip" />
|
android:layout_marginStart="4dip"
|
||||||
|
android:layout_marginEnd="4dip"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/value"
|
android:id="@+id/value"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@@ -14,17 +14,21 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<com.android.settings.applications.LinearColorBar
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:paddingEnd="?android:attr/scrollbarSize">
|
||||||
android:gravity="center_vertical"
|
<com.android.settings.applications.LinearColorBar
|
||||||
android:id="@+android:id/linear_color_bar"
|
android:id="@+android:id/linear_color_bar"
|
||||||
android:paddingEnd="?android:attr/scrollbarSize"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:shadowRadius="4"
|
android:shadowRadius="4"
|
||||||
android:shadowColor="?android:attr/colorBackground"
|
android:shadowColor="?android:attr/colorBackground"
|
||||||
android:shadowDx="2"
|
android:shadowDx="2"
|
||||||
android:shadowDy="2">
|
android:shadowDy="2">
|
||||||
</com.android.settings.applications.LinearColorBar>
|
</com.android.settings.applications.LinearColorBar>
|
||||||
|
</FrameLayout>
|
@@ -12,12 +12,15 @@ import android.graphics.Rect;
|
|||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class LinearColorBar extends LinearLayout {
|
public class LinearColorBar extends LinearLayout {
|
||||||
static final int LEFT_COLOR = 0xff0099cc;
|
static final int LEFT_COLOR = 0xff0099cc;
|
||||||
static final int MIDDLE_COLOR = 0xff0099cc;
|
static final int MIDDLE_COLOR = 0xff0099cc;
|
||||||
static final int RIGHT_COLOR = 0xff888888;
|
static final int RIGHT_COLOR = 0xff888888;
|
||||||
|
static final int GRAY_COLOR = 0xff555555;
|
||||||
|
static final int WHITE_COLOR = 0xffffffff;
|
||||||
|
|
||||||
private float mRedRatio;
|
private float mRedRatio;
|
||||||
private float mYellowRatio;
|
private float mYellowRatio;
|
||||||
@@ -30,17 +33,32 @@ public class LinearColorBar extends LinearLayout {
|
|||||||
private boolean mShowIndicator = true;
|
private boolean mShowIndicator = true;
|
||||||
private boolean mShowingGreen;
|
private boolean mShowingGreen;
|
||||||
|
|
||||||
|
private OnRegionTappedListener mOnRegionTappedListener;
|
||||||
|
private int mColoredRegions = REGION_RED | REGION_YELLOW | REGION_GREEN;
|
||||||
|
|
||||||
final Rect mRect = new Rect();
|
final Rect mRect = new Rect();
|
||||||
final Paint mPaint = new Paint();
|
final Paint mPaint = new Paint();
|
||||||
|
|
||||||
int mLastInterestingLeft, mLastInterestingRight;
|
int mLastInterestingLeft, mLastInterestingRight;
|
||||||
int mLineWidth;
|
int mLineWidth;
|
||||||
|
|
||||||
|
int mLastLeftDiv, mLastRightDiv;
|
||||||
|
int mLastRegion;
|
||||||
|
|
||||||
final Path mColorPath = new Path();
|
final Path mColorPath = new Path();
|
||||||
final Path mEdgePath = new Path();
|
final Path mEdgePath = new Path();
|
||||||
final Paint mColorGradientPaint = new Paint();
|
final Paint mColorGradientPaint = new Paint();
|
||||||
final Paint mEdgeGradientPaint = new Paint();
|
final Paint mEdgeGradientPaint = new Paint();
|
||||||
|
|
||||||
|
public static final int REGION_RED = 1<<0;
|
||||||
|
public static final int REGION_YELLOW = 1<<1;
|
||||||
|
public static final int REGION_GREEN = 1<<2;
|
||||||
|
public static final int REGION_ALL = REGION_RED | REGION_YELLOW | REGION_GREEN;
|
||||||
|
|
||||||
|
public interface OnRegionTappedListener {
|
||||||
|
public void onRegionTapped(int region);
|
||||||
|
}
|
||||||
|
|
||||||
public LinearColorBar(Context context, AttributeSet attrs) {
|
public LinearColorBar(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
@@ -55,6 +73,18 @@ public class LinearColorBar extends LinearLayout {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnRegionTappedListener(OnRegionTappedListener listener) {
|
||||||
|
if (listener != mOnRegionTappedListener) {
|
||||||
|
mOnRegionTappedListener = listener;
|
||||||
|
setClickable(listener != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColoredRegions(int regions) {
|
||||||
|
mColoredRegions = regions;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
public void setRatios(float red, float yellow, float green) {
|
public void setRatios(float red, float yellow, float green) {
|
||||||
mRedRatio = red;
|
mRedRatio = red;
|
||||||
mYellowRatio = yellow;
|
mYellowRatio = yellow;
|
||||||
@@ -109,6 +139,50 @@ public class LinearColorBar extends LinearLayout {
|
|||||||
updateIndicator();
|
updateIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
if (mOnRegionTappedListener != null) {
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN: {
|
||||||
|
final int x = (int) event.getX();
|
||||||
|
if (x < mLastLeftDiv) {
|
||||||
|
mLastRegion = REGION_RED;
|
||||||
|
} else if (x < mLastRightDiv) {
|
||||||
|
mLastRegion = REGION_YELLOW;
|
||||||
|
} else {
|
||||||
|
mLastRegion = REGION_GREEN;
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatchSetPressed(boolean pressed) {
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performClick() {
|
||||||
|
if (mOnRegionTappedListener != null && mLastRegion != 0) {
|
||||||
|
mOnRegionTappedListener.onRegionTapped(mLastRegion);
|
||||||
|
mLastRegion = 0;
|
||||||
|
}
|
||||||
|
return super.performClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int pickColor(int color, int region) {
|
||||||
|
if (isPressed() && (mLastRegion®ion) != 0) {
|
||||||
|
return WHITE_COLOR;
|
||||||
|
}
|
||||||
|
if ((mColoredRegions®ion) == 0) {
|
||||||
|
return GRAY_COLOR;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
@@ -168,18 +242,21 @@ public class LinearColorBar extends LinearLayout {
|
|||||||
if (left < right) {
|
if (left < right) {
|
||||||
mRect.left = left;
|
mRect.left = left;
|
||||||
mRect.right = right;
|
mRect.right = right;
|
||||||
mPaint.setColor(mLeftColor);
|
mPaint.setColor(pickColor(mLeftColor, REGION_RED));
|
||||||
canvas.drawRect(mRect, mPaint);
|
canvas.drawRect(mRect, mPaint);
|
||||||
width -= (right-left);
|
width -= (right-left);
|
||||||
left = right;
|
left = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mLastLeftDiv = right;
|
||||||
|
mLastRightDiv = right2;
|
||||||
|
|
||||||
right = right2;
|
right = right2;
|
||||||
|
|
||||||
if (left < right) {
|
if (left < right) {
|
||||||
mRect.left = left;
|
mRect.left = left;
|
||||||
mRect.right = right;
|
mRect.right = right;
|
||||||
mPaint.setColor(mMiddleColor);
|
mPaint.setColor(pickColor(mMiddleColor, REGION_YELLOW));
|
||||||
canvas.drawRect(mRect, mPaint);
|
canvas.drawRect(mRect, mPaint);
|
||||||
width -= (right-left);
|
width -= (right-left);
|
||||||
left = right;
|
left = right;
|
||||||
@@ -190,7 +267,7 @@ public class LinearColorBar extends LinearLayout {
|
|||||||
if (left < right) {
|
if (left < right) {
|
||||||
mRect.left = left;
|
mRect.left = left;
|
||||||
mRect.right = right;
|
mRect.right = right;
|
||||||
mPaint.setColor(mRightColor);
|
mPaint.setColor(pickColor(mRightColor, REGION_GREEN));
|
||||||
canvas.drawRect(mRect, mPaint);
|
canvas.drawRect(mRect, mPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,8 @@ public class LinearColorPreference extends Preference {
|
|||||||
float mRedRatio;
|
float mRedRatio;
|
||||||
float mYellowRatio;
|
float mYellowRatio;
|
||||||
float mGreenRatio;
|
float mGreenRatio;
|
||||||
|
int mColoredRegions = LinearColorBar.REGION_ALL;
|
||||||
|
LinearColorBar.OnRegionTappedListener mOnRegionTappedListener;
|
||||||
|
|
||||||
public LinearColorPreference(Context context) {
|
public LinearColorPreference(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@@ -38,6 +40,16 @@ public class LinearColorPreference extends Preference {
|
|||||||
notifyChanged();
|
notifyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnRegionTappedListener(LinearColorBar.OnRegionTappedListener listener) {
|
||||||
|
mOnRegionTappedListener = listener;
|
||||||
|
notifyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColoredRegions(int regions) {
|
||||||
|
mColoredRegions = regions;
|
||||||
|
notifyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
@@ -45,7 +57,9 @@ public class LinearColorPreference extends Preference {
|
|||||||
LinearColorBar colors = (LinearColorBar)view.findViewById(
|
LinearColorBar colors = (LinearColorBar)view.findViewById(
|
||||||
R.id.linear_color_bar);
|
R.id.linear_color_bar);
|
||||||
colors.setShowIndicator(false);
|
colors.setShowIndicator(false);
|
||||||
colors.setColors(0xffcc3000, 0xffcccc00, 0xff00cc30);
|
colors.setColors(0xffaa5030, 0xffaaaa30, 0xff30aa50);
|
||||||
colors.setRatios(mRedRatio, mYellowRatio, mGreenRatio);
|
colors.setRatios(mRedRatio, mYellowRatio, mGreenRatio);
|
||||||
|
colors.setColoredRegions(mColoredRegions);
|
||||||
|
colors.setOnRegionTappedListener(mOnRegionTappedListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class ProcessStatsUi extends PreferenceFragment {
|
public class ProcessStatsUi extends PreferenceFragment
|
||||||
|
implements LinearColorBar.OnRegionTappedListener {
|
||||||
static final String TAG = "ProcessStatsUi";
|
static final String TAG = "ProcessStatsUi";
|
||||||
static final boolean DEBUG = false;
|
static final boolean DEBUG = false;
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
private boolean mShowSystem;
|
private boolean mShowSystem;
|
||||||
private boolean mUseUss;
|
private boolean mUseUss;
|
||||||
private int mStatsType;
|
private int mStatsType;
|
||||||
|
private int mMemRegion;
|
||||||
|
|
||||||
private MenuItem[] mDurationMenus = new MenuItem[NUM_DURATIONS];
|
private MenuItem[] mDurationMenus = new MenuItem[NUM_DURATIONS];
|
||||||
private MenuItem mShowSystemMenu;
|
private MenuItem mShowSystemMenu;
|
||||||
@@ -144,6 +146,8 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
mUseUss = icicle != null ? icicle.getBoolean("use_uss") : false;
|
mUseUss = icicle != null ? icicle.getBoolean("use_uss") : false;
|
||||||
mStatsType = icicle != null ? icicle.getInt("stats_type", MENU_TYPE_BACKGROUND)
|
mStatsType = icicle != null ? icicle.getInt("stats_type", MENU_TYPE_BACKGROUND)
|
||||||
: MENU_TYPE_BACKGROUND;
|
: MENU_TYPE_BACKGROUND;
|
||||||
|
mMemRegion = icicle != null ? icicle.getInt("mem_region", LinearColorBar.REGION_GREEN)
|
||||||
|
: LinearColorBar.REGION_GREEN;
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,6 +169,7 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
outState.putBoolean("show_system", mShowSystem);
|
outState.putBoolean("show_system", mShowSystem);
|
||||||
outState.putBoolean("use_uss", mUseUss);
|
outState.putBoolean("use_uss", mUseUss);
|
||||||
outState.putInt("stats_type", mStatsType);
|
outState.putInt("stats_type", mStatsType);
|
||||||
|
outState.putInt("mem_region", mMemRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -300,6 +305,14 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRegionTapped(int region) {
|
||||||
|
if (mMemRegion != region) {
|
||||||
|
mMemRegion = region;
|
||||||
|
refreshStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addNotAvailableMessage() {
|
private void addNotAvailableMessage() {
|
||||||
Preference notAvailable = new Preference(getActivity());
|
Preference notAvailable = new Preference(getActivity());
|
||||||
notAvailable.setTitle(R.string.power_usage_not_available);
|
notAvailable.setTitle(R.string.power_usage_not_available);
|
||||||
@@ -322,6 +335,15 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
ProcessStats.STATE_CACHED_EMPTY
|
ProcessStats.STATE_CACHED_EMPTY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final int[] RED_MEM_STATES = new int[] {
|
||||||
|
ProcessStats.ADJ_MEM_FACTOR_CRITICAL
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final int[] YELLOW_MEM_STATES = new int[] {
|
||||||
|
ProcessStats.ADJ_MEM_FACTOR_CRITICAL, ProcessStats.ADJ_MEM_FACTOR_LOW,
|
||||||
|
ProcessStats.ADJ_MEM_FACTOR_MODERATE
|
||||||
|
};
|
||||||
|
|
||||||
private String makeDuration(long time) {
|
private String makeDuration(long time) {
|
||||||
StringBuilder sb = new StringBuilder(32);
|
StringBuilder sb = new StringBuilder(32);
|
||||||
TimeUtils.formatDuration(time, sb);
|
TimeUtils.formatDuration(time, sb);
|
||||||
@@ -357,9 +379,9 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
String durationString = Utils.formatElapsedTime(getActivity(),
|
String durationString = Utils.formatElapsedTime(getActivity(),
|
||||||
mStats.mTimePeriodEndRealtime-mStats.mTimePeriodStartRealtime, false);
|
mStats.mTimePeriodEndRealtime-mStats.mTimePeriodStartRealtime, false);
|
||||||
CharSequence memString;
|
CharSequence memString;
|
||||||
CharSequence[] memStates = getResources().getTextArray(R.array.ram_states);
|
CharSequence[] memStatesStr = getResources().getTextArray(R.array.ram_states);
|
||||||
if (mMemState >= 0 && mMemState < memStates.length) {
|
if (mMemState >= 0 && mMemState < memStatesStr.length) {
|
||||||
memString = memStates[mMemState];
|
memString = memStatesStr[mMemState];
|
||||||
} else {
|
} else {
|
||||||
memString = "?";
|
memString = "?";
|
||||||
}
|
}
|
||||||
@@ -378,9 +400,6 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
mAppListGroup.addPreference(hist);
|
mAppListGroup.addPreference(hist);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ProcessStats.ProcessDataCollection totals = new ProcessStats.ProcessDataCollection(
|
|
||||||
ProcessStats.ALL_SCREEN_ADJ, ProcessStats.ALL_MEM_ADJ, stats);
|
|
||||||
|
|
||||||
long now = SystemClock.uptimeMillis();
|
long now = SystemClock.uptimeMillis();
|
||||||
|
|
||||||
final PackageManager pm = getActivity().getPackageManager();
|
final PackageManager pm = getActivity().getPackageManager();
|
||||||
@@ -389,10 +408,6 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
mStats.mMemFactor, mStats.mStartTime, now);
|
mStats.mMemFactor, mStats.mStartTime, now);
|
||||||
if (DEBUG) Log.d(TAG, "Total time of stats: " + makeDuration(mTotalTime));
|
if (DEBUG) Log.d(TAG, "Total time of stats: " + makeDuration(mTotalTime));
|
||||||
|
|
||||||
LinearColorPreference colors = new LinearColorPreference(getActivity());
|
|
||||||
colors.setOrder(-1);
|
|
||||||
mAppListGroup.addPreference(colors);
|
|
||||||
|
|
||||||
long[] memTimes = new long[ProcessStats.ADJ_MEM_FACTOR_COUNT];
|
long[] memTimes = new long[ProcessStats.ADJ_MEM_FACTOR_COUNT];
|
||||||
for (int iscreen=0; iscreen<ProcessStats.ADJ_COUNT; iscreen+=ProcessStats.ADJ_SCREEN_MOD) {
|
for (int iscreen=0; iscreen<ProcessStats.ADJ_COUNT; iscreen+=ProcessStats.ADJ_SCREEN_MOD) {
|
||||||
for (int imem=0; imem<ProcessStats.ADJ_MEM_FACTOR_COUNT; imem++) {
|
for (int imem=0; imem<ProcessStats.ADJ_MEM_FACTOR_COUNT; imem++) {
|
||||||
@@ -401,10 +416,40 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long memTotalTime;
|
||||||
|
int[] memStates;
|
||||||
|
|
||||||
|
LinearColorPreference colors = new LinearColorPreference(getActivity());
|
||||||
|
colors.setOrder(-1);
|
||||||
|
colors.setOnRegionTappedListener(this);
|
||||||
|
switch (mMemRegion) {
|
||||||
|
case LinearColorBar.REGION_RED:
|
||||||
|
colors.setColoredRegions(LinearColorBar.REGION_RED);
|
||||||
|
memTotalTime = memTimes[ProcessStats.ADJ_MEM_FACTOR_CRITICAL];
|
||||||
|
memStates = RED_MEM_STATES;
|
||||||
|
break;
|
||||||
|
case LinearColorBar.REGION_YELLOW:
|
||||||
|
colors.setColoredRegions(LinearColorBar.REGION_RED
|
||||||
|
| LinearColorBar.REGION_YELLOW);
|
||||||
|
memTotalTime = memTimes[ProcessStats.ADJ_MEM_FACTOR_CRITICAL]
|
||||||
|
+ memTimes[ProcessStats.ADJ_MEM_FACTOR_LOW]
|
||||||
|
+ memTimes[ProcessStats.ADJ_MEM_FACTOR_MODERATE];
|
||||||
|
memStates = YELLOW_MEM_STATES;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
colors.setColoredRegions(LinearColorBar.REGION_ALL);
|
||||||
|
memTotalTime = mTotalTime;
|
||||||
|
memStates = ProcessStats.ALL_MEM_ADJ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
colors.setRatios(memTimes[ProcessStats.ADJ_MEM_FACTOR_CRITICAL] / (float)mTotalTime,
|
colors.setRatios(memTimes[ProcessStats.ADJ_MEM_FACTOR_CRITICAL] / (float)mTotalTime,
|
||||||
(memTimes[ProcessStats.ADJ_MEM_FACTOR_LOW]
|
(memTimes[ProcessStats.ADJ_MEM_FACTOR_LOW]
|
||||||
+ memTimes[ProcessStats.ADJ_MEM_FACTOR_MODERATE]) / (float)mTotalTime,
|
+ memTimes[ProcessStats.ADJ_MEM_FACTOR_MODERATE]) / (float)mTotalTime,
|
||||||
memTimes[ProcessStats.ADJ_MEM_FACTOR_NORMAL] / (float)mTotalTime);
|
memTimes[ProcessStats.ADJ_MEM_FACTOR_NORMAL] / (float)mTotalTime);
|
||||||
|
mAppListGroup.addPreference(colors);
|
||||||
|
|
||||||
|
ProcessStats.ProcessDataCollection totals = new ProcessStats.ProcessDataCollection(
|
||||||
|
ProcessStats.ALL_SCREEN_ADJ, memStates, stats);
|
||||||
|
|
||||||
ArrayList<ProcStatsEntry> entries = new ArrayList<ProcStatsEntry>();
|
ArrayList<ProcStatsEntry> entries = new ArrayList<ProcStatsEntry>();
|
||||||
|
|
||||||
@@ -441,7 +486,7 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
if (ent.mDuration > 0) {
|
if (ent.mDuration > 0) {
|
||||||
if (DEBUG) Log.d(TAG, "Adding proc " + proc.mName + "/"
|
if (DEBUG) Log.d(TAG, "Adding proc " + proc.mName + "/"
|
||||||
+ proc.mUid + ": time=" + makeDuration(ent.mDuration) + " ("
|
+ proc.mUid + ": time=" + makeDuration(ent.mDuration) + " ("
|
||||||
+ ((((double)ent.mDuration) / mTotalTime) * 100) + "%)"
|
+ ((((double)ent.mDuration) / memTotalTime) * 100) + "%)"
|
||||||
+ " pss=" + ent.mAvgPss);
|
+ " pss=" + ent.mAvgPss);
|
||||||
entriesMap.put(proc.mName, proc.mUid, ent);
|
entriesMap.put(proc.mName, proc.mUid, ent);
|
||||||
entries.add(ent);
|
entries.add(ent);
|
||||||
@@ -492,7 +537,7 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
if (ent.mDuration > 0) {
|
if (ent.mDuration > 0) {
|
||||||
if (DEBUG) Log.d(TAG, "Adding proc " + st.mName + "/" + st.mUid + ": time="
|
if (DEBUG) Log.d(TAG, "Adding proc " + st.mName + "/" + st.mUid + ": time="
|
||||||
+ makeDuration(ent.mDuration) + " ("
|
+ makeDuration(ent.mDuration) + " ("
|
||||||
+ ((((double)ent.mDuration) / mTotalTime) * 100) + "%)");
|
+ ((((double)ent.mDuration) / memTotalTime) * 100) + "%)");
|
||||||
procs.add(ent);
|
procs.add(ent);
|
||||||
ArrayMap<String, ProcStatsEntry> uidProcs = processes.get(ent.mUid);
|
ArrayMap<String, ProcStatsEntry> uidProcs = processes.get(ent.mUid);
|
||||||
if (uidProcs == null) {
|
if (uidProcs == null) {
|
||||||
@@ -521,7 +566,7 @@ public class ProcessStatsUi extends PreferenceFragment {
|
|||||||
for (int i=0, N=(entries != null ? entries.size() : 0); i<N; i++) {
|
for (int i=0, N=(entries != null ? entries.size() : 0); i<N; i++) {
|
||||||
ProcStatsEntry proc = entries.get(i);
|
ProcStatsEntry proc = entries.get(i);
|
||||||
final double percentOfWeight = (((double)proc.mWeight) / maxWeight) * 100;
|
final double percentOfWeight = (((double)proc.mWeight) / maxWeight) * 100;
|
||||||
final double percentOfTime = (((double)proc.mDuration) / mTotalTime) * 100;
|
final double percentOfTime = (((double)proc.mDuration) / memTotalTime) * 100;
|
||||||
if (percentOfWeight < 1 && percentOfTime < 33) {
|
if (percentOfWeight < 1 && percentOfTime < 33) {
|
||||||
if (DEBUG) Log.d(TAG, "Skipping " + proc.mName + " weight=" + percentOfWeight
|
if (DEBUG) Log.d(TAG, "Skipping " + proc.mName + " weight=" + percentOfWeight
|
||||||
+ " time=" + percentOfTime);
|
+ " time=" + percentOfTime);
|
||||||
|
Reference in New Issue
Block a user