Merge "Skip STATE_SERVICE_RESTARTING while dumping procstats to statsd" into sc-dev

This commit is contained in:
Jing Ji
2021-05-06 00:18:53 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 2 deletions

View File

@@ -93,7 +93,6 @@ public final class DumpUtils {
STATE_LABELS[STATE_BOUND_TOP_OR_FGS] = "Bnd TopFgs";
STATE_LABELS[STATE_FGS] = " Fgs";
STATE_LABELS[STATE_IMPORTANT_FOREGROUND] = " Imp Fg";
STATE_LABELS[STATE_IMPORTANT_FOREGROUND] = " Imp Fg";
STATE_LABELS[STATE_IMPORTANT_BACKGROUND] = " Imp Bg";
STATE_LABELS[STATE_BACKUP] = " Backup";
STATE_LABELS[STATE_SERVICE] = " Service";

View File

@@ -1550,6 +1550,10 @@ public final class ProcessState {
final int key = mDurations.getKeyAt(i);
final int type = SparseMappingTable.getIdFromKey(key);
final int aggregatedType = DumpUtils.aggregateCurrentProcessState(type);
if ((type % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
// Skip restarting service state -- that is not actually a running process.
continue;
}
long time = mDurations.getValue(key);
if (mCurCombinedState == type) {
@@ -1563,7 +1567,9 @@ public final class ProcessState {
durationByState.put(aggregatedType, time);
}
}
if (!didCurState && mCurCombinedState != STATE_NOTHING) {
if (!didCurState && mCurCombinedState != STATE_NOTHING
&& (mCurCombinedState % STATE_COUNT) != STATE_SERVICE_RESTARTING) {
// Skip restarting service state -- that is not actually a running process.
final int aggregatedType = DumpUtils.aggregateCurrentProcessState(mCurCombinedState);
int index = durationByState.indexOfKey(aggregatedType);
if (index >= 0) {