public class NetworkStatsFactory extends Object
NetworkStats
instances by parsing various /proc/
files as needed.Constructor and Description |
---|
NetworkStatsFactory() |
NetworkStatsFactory(File procRoot) |
Modifier and Type | Method and Description |
---|---|
void |
assertEquals(NetworkStats expected,
NetworkStats actual) |
static NetworkStats |
javaReadNetworkStatsDetail(File detailPath,
int limitUid,
String[] limitIfaces,
int limitTag)
Parse and return
NetworkStats with UID-level details. |
static int |
nativeReadNetworkStatsDetail(NetworkStats stats,
String path,
int limitUid,
String[] limitIfaces,
int limitTag)
Parse statistics from file into given
NetworkStats object. |
static void |
noteStackedIface(String stackedIface,
String baseIface) |
NetworkStats |
readNetworkStatsDetail() |
NetworkStats |
readNetworkStatsDetail(int limitUid,
String[] limitIfaces,
int limitTag,
NetworkStats lastStats) |
NetworkStats |
readNetworkStatsSummaryDev()
Parse and return interface-level summary
NetworkStats measured
using /proc/net/dev style hooks, which may include non IP layer
traffic. |
NetworkStats |
readNetworkStatsSummaryXt()
Parse and return interface-level summary
NetworkStats . |
public NetworkStatsFactory()
public NetworkStatsFactory(File procRoot)
public NetworkStats readNetworkStatsSummaryDev() throws IOException
NetworkStats
measured
using /proc/net/dev
style hooks, which may include non IP layer
traffic. Values monotonically increase since device boot, and may include
details about inactive interfaces.IllegalStateException
- when problem parsing stats.IOException
public NetworkStats readNetworkStatsSummaryXt() throws IOException
NetworkStats
. Designed
to return only IP layer traffic. Values monotonically increase since
device boot, and may include details about inactive interfaces.IllegalStateException
- when problem parsing stats.IOException
public NetworkStats readNetworkStatsDetail() throws IOException
IOException
public NetworkStats readNetworkStatsDetail(int limitUid, String[] limitIfaces, int limitTag, NetworkStats lastStats) throws IOException
IOException
public static NetworkStats javaReadNetworkStatsDetail(File detailPath, int limitUid, String[] limitIfaces, int limitTag) throws IOException
NetworkStats
with UID-level details. Values are
expected to monotonically increase since device boot.IOException
public void assertEquals(NetworkStats expected, NetworkStats actual)
public static int nativeReadNetworkStatsDetail(NetworkStats stats, String path, int limitUid, String[] limitIfaces, int limitTag)
NetworkStats
object. Values
are expected to monotonically increase since device boot.