Always splice historical data stats, debug info.
When reading network counters, always splice in xt_qtaguid values to avoid counting backwards. Test to verify. Remove verbose logging around global alerts, and add dumpsys debug info for NMS and MDST. Also fix subtle bug around stats persisting and dumping. Bug: 5212893, 5211028 Change-Id: I783e5286637a67ee2dd2b09878198711a926d0cb
This commit is contained in:
@@ -19,6 +19,7 @@ package android.net;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.util.SparseBooleanArray;
|
||||
|
||||
import com.android.internal.util.Objects;
|
||||
@@ -38,6 +39,8 @@ import java.util.HashSet;
|
||||
* @hide
|
||||
*/
|
||||
public class NetworkStats implements Parcelable {
|
||||
private static final String TAG = "NetworkStats";
|
||||
|
||||
/** {@link #iface} value when interface details unavailable. */
|
||||
public static final String IFACE_ALL = null;
|
||||
/** {@link #uid} value when UID details unavailable. */
|
||||
@@ -397,7 +400,10 @@ public class NetworkStats implements Parcelable {
|
||||
if (enforceMonotonic
|
||||
&& (entry.rxBytes < 0 || entry.rxPackets < 0 || entry.txBytes < 0
|
||||
|| entry.txPackets < 0 || entry.operations < 0)) {
|
||||
throw new IllegalArgumentException("found non-monotonic values");
|
||||
Log.v(TAG, "lhs=" + this);
|
||||
Log.v(TAG, "rhs=" + value);
|
||||
throw new IllegalArgumentException(
|
||||
"found non-monotonic values at lhs[" + i + "] - rhs[" + j + "]");
|
||||
}
|
||||
if (clampNegative) {
|
||||
entry.rxBytes = Math.max(0, entry.rxBytes);
|
||||
|
||||
@@ -482,12 +482,12 @@ public class NetworkStatsHistory implements Parcelable {
|
||||
for (int i = start; i < bucketCount; i++) {
|
||||
pw.print(prefix);
|
||||
pw.print(" bucketStart="); pw.print(bucketStart[i]);
|
||||
if (activeTime != null) pw.print(" activeTime="); pw.print(activeTime[i]);
|
||||
if (rxBytes != null) pw.print(" rxBytes="); pw.print(rxBytes[i]);
|
||||
if (rxPackets != null) pw.print(" rxPackets="); pw.print(rxPackets[i]);
|
||||
if (txBytes != null) pw.print(" txBytes="); pw.print(txBytes[i]);
|
||||
if (txPackets != null) pw.print(" txPackets="); pw.print(txPackets[i]);
|
||||
if (operations != null) pw.print(" operations="); pw.print(operations[i]);
|
||||
if (activeTime != null) { pw.print(" activeTime="); pw.print(activeTime[i]); }
|
||||
if (rxBytes != null) { pw.print(" rxBytes="); pw.print(rxBytes[i]); }
|
||||
if (rxPackets != null) { pw.print(" rxPackets="); pw.print(rxPackets[i]); }
|
||||
if (txBytes != null) { pw.print(" txBytes="); pw.print(txBytes[i]); }
|
||||
if (txPackets != null) { pw.print(" txPackets="); pw.print(txPackets[i]); }
|
||||
if (operations != null) { pw.print(" operations="); pw.print(operations[i]); }
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
mLastPersistUidSnapshot, uidSnapshot, true);
|
||||
if (forcePersist || persistUidDelta.getTotalBytes() > persistThreshold) {
|
||||
writeUidStatsLocked();
|
||||
mLastPersistNetworkSnapshot = networkSnapshot;
|
||||
mLastPersistUidSnapshot = networkSnapshot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user