Merge "Throttle the dropbox logs per event-type" into rvc-dev am: 559a551a7d am: 00ba82c284 am: e1c2f429c1
Change-Id: I3061d50f2497bf6aac692aee603cbb4517c7fca7
This commit is contained in:
@@ -10156,8 +10156,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private volatile long mWtfClusterStart;
|
private volatile ArrayMap<String, long[]> mErrorClusterRecords = new ArrayMap<>();
|
||||||
private volatile int mWtfClusterCount;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a description of an error (crash, WTF, ANR) to the drop box.
|
* Write a description of an error (crash, WTF, ANR) to the drop box.
|
||||||
@@ -10188,13 +10187,18 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
if (dbox == null || !dbox.isTagEnabled(dropboxTag)) return;
|
if (dbox == null || !dbox.isTagEnabled(dropboxTag)) return;
|
||||||
|
|
||||||
// Rate-limit how often we're willing to do the heavy lifting below to
|
// Rate-limit how often we're willing to do the heavy lifting below to
|
||||||
// collect and record logs; currently 5 logs per 10 second period.
|
// collect and record logs; currently 5 logs per 10 second period per eventType.
|
||||||
final long now = SystemClock.elapsedRealtime();
|
final long now = SystemClock.elapsedRealtime();
|
||||||
if (now - mWtfClusterStart > 10 * DateUtils.SECOND_IN_MILLIS) {
|
long[] errRecord = mErrorClusterRecords.get(eventType);
|
||||||
mWtfClusterStart = now;
|
if (errRecord == null) {
|
||||||
mWtfClusterCount = 1;
|
errRecord = new long[2]; // [0]: startTime, [1]: count
|
||||||
|
mErrorClusterRecords.put(eventType, errRecord);
|
||||||
|
}
|
||||||
|
if (now - errRecord[0] > 10 * DateUtils.SECOND_IN_MILLIS) {
|
||||||
|
errRecord[0] = now;
|
||||||
|
errRecord[1] = 1L;
|
||||||
} else {
|
} else {
|
||||||
if (mWtfClusterCount++ >= 5) return;
|
if (errRecord[1]++ >= 5) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder(1024);
|
final StringBuilder sb = new StringBuilder(1024);
|
||||||
|
|||||||
Reference in New Issue
Block a user