diff options
| author | Ashish Sharma <ashishsharma@google.com> | 2011-01-27 15:52:38 -0800 |
|---|---|---|
| committer | Ashish Sharma <ashishsharma@google.com> | 2011-01-27 15:52:38 -0800 |
| commit | c39c1d4dee917560d174f6ba5402e4c6644edd47 (patch) | |
| tree | 134354437ad92a4501b716ebb2b83adbd470195a /core/java | |
| parent | e8e0ebbfd09214020cfbbaafaeb940a2e52985b3 (diff) | |
| download | frameworks_base-c39c1d4dee917560d174f6ba5402e4c6644edd47.zip frameworks_base-c39c1d4dee917560d174f6ba5402e4c6644edd47.tar.gz frameworks_base-c39c1d4dee917560d174f6ba5402e4c6644edd47.tar.bz2 | |
TrafficStats: Include UDP stats and packet count to API
Change-Id: I70063e6033d3c181bcc5b9e401f9474900e25281
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
Diffstat (limited to 'core/java')
| -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); } |
