Merge "Connectivity Metrics service: dump throttling states to dumpsys" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
aabed1c5f8
@@ -144,8 +144,13 @@ public class MetricsLoggerService extends SystemService {
|
|||||||
|
|
||||||
boolean dumpSerializedSize = false;
|
boolean dumpSerializedSize = false;
|
||||||
boolean dumpEvents = false;
|
boolean dumpEvents = false;
|
||||||
|
boolean dumpDebugInfo = false;
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
|
case "--debug":
|
||||||
|
dumpDebugInfo = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case "--events":
|
case "--events":
|
||||||
dumpEvents = true;
|
dumpEvents = true;
|
||||||
break;
|
break;
|
||||||
@@ -155,6 +160,7 @@ public class MetricsLoggerService extends SystemService {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "--all":
|
case "--all":
|
||||||
|
dumpDebugInfo = true;
|
||||||
dumpEvents = true;
|
dumpEvents = true;
|
||||||
dumpSerializedSize = true;
|
dumpSerializedSize = true;
|
||||||
break;
|
break;
|
||||||
@@ -163,6 +169,7 @@ public class MetricsLoggerService extends SystemService {
|
|||||||
|
|
||||||
synchronized (mEvents) {
|
synchronized (mEvents) {
|
||||||
pw.println("Number of events: " + mEvents.size());
|
pw.println("Number of events: " + mEvents.size());
|
||||||
|
pw.println("Counter: " + mEventCounter);
|
||||||
if (mEvents.size() > 0) {
|
if (mEvents.size() > 0) {
|
||||||
pw.println("Time span: " +
|
pw.println("Time span: " +
|
||||||
DateUtils.formatElapsedTime(
|
DateUtils.formatElapsedTime(
|
||||||
@@ -171,16 +178,12 @@ public class MetricsLoggerService extends SystemService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dumpSerializedSize) {
|
if (dumpSerializedSize) {
|
||||||
long dataSize = 0;
|
|
||||||
Parcel p = Parcel.obtain();
|
Parcel p = Parcel.obtain();
|
||||||
for (ConnectivityMetricsEvent e : mEvents) {
|
for (ConnectivityMetricsEvent e : mEvents) {
|
||||||
dataSize += 16; // timestamp and 2 stamps
|
p.writeParcelable(e, 0);
|
||||||
|
|
||||||
p.writeParcelable(e.data, 0);
|
|
||||||
}
|
}
|
||||||
dataSize += p.dataSize();
|
pw.println("Serialized data size: " + p.dataSize());
|
||||||
p.recycle();
|
p.recycle();
|
||||||
pw.println("Serialized data size: " + dataSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpEvents) {
|
if (dumpEvents) {
|
||||||
@@ -192,6 +195,21 @@ public class MetricsLoggerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dumpDebugInfo) {
|
||||||
|
synchronized (mThrottlingCounters) {
|
||||||
|
pw.println();
|
||||||
|
for (int i = 0; i < ConnectivityMetricsLogger.NUMBER_OF_COMPONENTS; i++) {
|
||||||
|
if (mThrottlingCounters[i] > 0) {
|
||||||
|
pw.println("Throttling Counter #" + i + ": " + mThrottlingCounters[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pw.println("Throttling Time Remaining: " +
|
||||||
|
DateUtils.formatElapsedTime(
|
||||||
|
(mThrottlingIntervalBoundaryMillis - System.currentTimeMillis())
|
||||||
|
/ 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (mPendingIntents) {
|
synchronized (mPendingIntents) {
|
||||||
if (!mPendingIntents.isEmpty()) {
|
if (!mPendingIntents.isEmpty()) {
|
||||||
pw.println();
|
pw.println();
|
||||||
|
|||||||
Reference in New Issue
Block a user