diff options
| author | Ashish Sharma <ashishsharma@google.com> | 2011-01-27 16:22:50 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-27 16:22:50 -0800 |
| commit | 89316a2f2a0f351b22c7195c385b0c4f4de7bdb7 (patch) | |
| tree | 66d6f366a9e149a6e05c7b18bcb17aadfe5e267f /core/java/android | |
| parent | 05b536e671b60740a47c37e8be6adbfff6fad3eb (diff) | |
| parent | c39c1d4dee917560d174f6ba5402e4c6644edd47 (diff) | |
| download | frameworks_base-89316a2f2a0f351b22c7195c385b0c4f4de7bdb7.zip frameworks_base-89316a2f2a0f351b22c7195c385b0c4f4de7bdb7.tar.gz frameworks_base-89316a2f2a0f351b22c7195c385b0c4f4de7bdb7.tar.bz2 | |
Merge "TrafficStats: Include UDP stats and packet count to API"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/net/TrafficStats.java | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index 0d64dab..0492fce 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -122,4 +122,139 @@ public class TrafficStats { * @return number of bytes */ public static native long getUidRxBytes(int uid); + + /** + * Get the number of packets (TCP segments + UDP) sent through + * the network for this UID. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of packets. + * If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidTxPackets(int uid); + + /** + * Get the number of packets (TCP segments + UDP) received through + * the network for this UID. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of packets + */ + public static native long getUidRxPackets(int uid); + + /** + * Get the number of TCP payload bytes sent for this UID. + * This total does not include protocol and control overheads at + * the transport and the lower layers of the networking stack. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of bytes. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidTcpTxBytes(int uid); + + /** + * Get the number of TCP payload bytes received for this UID. + * This total does not include protocol and control overheads at + * the transport and the lower layers of the networking stack. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of bytes. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidTcpRxBytes(int uid); + + /** + * Get the number of UDP payload bytes sent for this UID. + * This total does not include protocol and control overheads at + * the transport and the lower layers of the networking stack. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of bytes. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidUdpTxBytes(int uid); + + /** + * Get the number of UDP payload bytes received for this UID. + * This total does not include protocol and control overheads at + * the transport and the lower layers of the networking stack. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of bytes. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidUdpRxBytes(int uid); + + /** + * Get the number of TCP segments sent for this UID. + * Does not include TCP control packets (SYN/ACKs/FIN/..). + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of TCP segments. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidTcpTxSegments(int uid); + + /** + * Get the number of TCP payload bytes received for this UID. + * Does not include TCP control packets (SYN/ACKs/FIN/..). + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of TCP segments. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidTcpRxSegments(int uid); + + + /** + * Get the number of UDP packets sent for this UID. + * Includes DNS requests. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of packets. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidUdpTxPackets(int uid); + + /** + * Get the number of UDP packets received for this UID. + * Includes DNS responses. + * The statistics are across all interfaces. + * + * {@see android.os.Process#myUid()}. + * + * @param uid The UID of the process to examine. + * @return number of packets. If the statistics are not supported by this device, + * {@link #UNSUPPORTED} will be returned. + */ + public static native long getUidUdpRxPackets(int uid); } |
