java.lang.Object | |
↳ | android.net.TrafficStats |
Class that provides network traffic statistics. These statistics include bytes transmitted and received and network packets transmitted and received, over all interfaces, over the mobile interface, and on a per-UID basis.
These statistics may not be available on all platforms. If the statistics
are not supported by this device, UNSUPPORTED
will be returned.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | UNSUPPORTED | The return value to indicate that the device does not support the statistic. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get the total number of bytes received through the mobile interface.
| |||||||||||
Get the total number of packets received through the mobile interface.
| |||||||||||
Get the total number of bytes transmitted through the mobile interface.
| |||||||||||
Get the total number of packets transmitted through the mobile interface.
| |||||||||||
Get the active tag used when accounting
Socket traffic originating
from the current thread. | |||||||||||
Get the total number of bytes received through all network interfaces.
| |||||||||||
Get the total number of packets received through all network interfaces.
| |||||||||||
Get the total number of bytes sent through all network interfaces.
| |||||||||||
Get the total number of packets sent through all network interfaces.
| |||||||||||
Get the number of bytes received through the network for this UID.
| |||||||||||
Get the number of packets (TCP segments + UDP) received through
the network for this UID.
| |||||||||||
Get the number of TCP payload bytes received for this UID.
| |||||||||||
Get the number of TCP segments received for this UID.
| |||||||||||
Get the number of TCP payload bytes sent for this UID.
| |||||||||||
Get the number of TCP segments sent for this UID.
| |||||||||||
Get the number of bytes sent through the network for this UID.
| |||||||||||
Get the number of packets (TCP segments + UDP) sent through
the network for this UID.
| |||||||||||
Get the number of UDP payload bytes received for this UID.
| |||||||||||
Get the number of UDP packets received for this UID.
| |||||||||||
Get the number of UDP payload bytes sent for this UID.
| |||||||||||
Get the number of UDP packets sent for this UID.
| |||||||||||
Increment count of network operations performed under the given
accounting tag.
| |||||||||||
Increment count of network operations performed under the accounting tag
currently active on the calling thread.
| |||||||||||
Set active tag to use when accounting
Socket traffic originating
from the current thread. | |||||||||||
Tag the given
Socket with any statistics parameters active for
the current thread. | |||||||||||
Remove any statistics parameters from the given
Socket . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The return value to indicate that the device does not support the statistic.
Get the total number of bytes received through the mobile interface.
UNSUPPORTED
will be returned.
Get the total number of packets received through the mobile interface.
UNSUPPORTED
will be returned.
Get the total number of bytes transmitted through the mobile interface.
UNSUPPORTED
will be returned.
Get the total number of packets transmitted through the mobile interface.
UNSUPPORTED
will be returned.
Get the active tag used when accounting Socket
traffic originating
from the current thread. Only one active tag per thread is supported.
tagSocket(Socket)
.
Get the total number of bytes received through all network interfaces.
UNSUPPORTED
will be returned.
Get the total number of packets received through all network interfaces.
UNSUPPORTED
will be returned.
Get the total number of bytes sent through all network interfaces.
UNSUPPORTED
will be returned.
Get the total number of packets sent through all network interfaces.
UNSUPPORTED
will be returned.
Get the number of bytes received through the network for this UID. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
Get the number of packets (TCP segments + UDP) received through the network for this UID. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
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. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Get the number of TCP segments received for this UID. Does not include TCP control packets (SYN/ACKs/FIN/..). The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
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. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
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. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Get the number of bytes sent through the network for this UID. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Get the number of packets (TCP segments + UDP) sent through the network for this UID. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
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. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Get the number of UDP packets received for this UID. Includes DNS responses. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
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. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Get the number of UDP packets sent for this UID. Includes DNS requests. The statistics are across all interfaces. .
uid | The UID of the process to examine. |
---|
UNSUPPORTED
will be returned.
Increment count of network operations performed under the given accounting tag. This can be used to derive bytes-per-operation.
tag | Accounting tag used in setThreadStatsTag(int) . |
---|---|
operationCount | Number of operations to increment count by. |
Increment count of network operations performed under the accounting tag currently active on the calling thread. This can be used to derive bytes-per-operation.
operationCount | Number of operations to increment count by. |
---|
Set active tag to use when accounting Socket
traffic originating
from the current thread. Only one active tag per thread is supported.
Changes only take effect during subsequent calls to
tagSocket(Socket)
.
Tags between 0xFFFFFF00
and 0xFFFFFFFF
are reserved and
used internally by system services like DownloadManager
when
performing traffic on behalf of an application.
Tag the given Socket
with any statistics parameters active for
the current thread. Subsequent calls always replace any existing
parameters. When finished, call untagSocket(Socket)
to remove
statistics parameters.
SocketException |
---|
Remove any statistics parameters from the given Socket
.
SocketException |
---|