Add "dumpsys diskstats" to get a dump of disk-free values.

Also includes a trivial test of I/O latency.  (Mostly useful to be invoked
from checkin to poll disk-free and latency issues.  Also moderately useful
to see in a bugreport.)

Also make "dumpsys netstat" a non-no-op, in case we want this data.

Change-Id: Ia93550a23ca6b35586c5d9217890ee0a5801aae1
This commit is contained in:
Dan Egnor
2010-03-25 16:20:14 -07:00
parent 8e10a7b7c8
commit 621bc54598
3 changed files with 155 additions and 1 deletions

View File

@@ -19,11 +19,16 @@ package com.android.server;
import android.content.Context;
import android.net.TrafficStats;
import android.os.INetStatService;
import android.os.SystemClock;
import java.io.FileDescriptor;
import java.io.PrintWriter;
public class NetStatService extends INetStatService.Stub {
private final Context mContext;
public NetStatService(Context context) {
mContext = context;
}
public long getMobileTxPackets() {
@@ -57,4 +62,35 @@ public class NetStatService extends INetStatService.Stub {
public long getTotalRxBytes() {
return TrafficStats.getTotalRxBytes();
}
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
// This data is accessible to any app -- no permission check needed.
pw.print("Elapsed: total=");
pw.print(SystemClock.elapsedRealtime());
pw.print("ms awake=");
pw.print(SystemClock.uptimeMillis());
pw.println("ms");
pw.print("Mobile: Tx=");
pw.print(getMobileTxBytes());
pw.print("B/");
pw.print(getMobileTxPackets());
pw.print("Pkts Rx=");
pw.print(getMobileRxBytes());
pw.print("B/");
pw.print(getMobileRxPackets());
pw.println("Pkts");
pw.print("Total: Tx=");
pw.print(getTotalTxBytes());
pw.print("B/");
pw.print(getTotalTxPackets());
pw.print("Pkts Rx=");
pw.print(getTotalRxBytes());
pw.print("B/");
pw.print(getTotalRxPackets());
pw.println("Pkts");
}
}