public class NetworkMetricsCollector extends SystemMetricsCollector<NetworkMetrics>
This tries to use a qtaguid file if available, but otherwise falls back to TrafficStats with manual instrumentation for guessing which type of network is active.
Constructor and Description |
---|
NetworkMetricsCollector(Context context) |
Modifier and Type | Method and Description |
---|---|
NetworkMetrics |
createMetrics()
Creates an empty instance of the corresponding system metrics.
|
boolean |
getSnapshot(NetworkMetrics snapshot)
Note that access to snapshot instances is not synchronized and must be taken care of
by the caller requesting getSnapshot.
|
public boolean getSnapshot(NetworkMetrics snapshot)
SystemMetricsCollector
getSnapshot
in class SystemMetricsCollector<NetworkMetrics>
snapshot
- snapshot on which the data will be writtenpublic NetworkMetrics createMetrics()
SystemMetricsCollector
Explicitly having this function available reduces a significant amount of boilerplate
createMetrics
in class SystemMetricsCollector<NetworkMetrics>