Read iface stats from single proc file.
When available, use single "iface_stat_all" file instead of reading values from dozens of files scattered across proc. Tests to verify. Bug: 5397840 Change-Id: I0247be518436c1f79b32c4b72216739f49a9e8cc
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
rmnet3 1 0 0 0 0 20822 501 1149991 815
|
||||
rmnet2 1 0 0 0 0 1594 15 1313 15
|
||||
rmnet1 1 0 0 0 0 207398 458 166918 565
|
||||
rmnet0 1 0 0 0 0 2112 24 700 10
|
||||
test1 1 1 2 3 4 5 6 7 8
|
||||
test2 0 1 2 3 4 5 6 7 8
|
||||
@@ -159,6 +159,16 @@ public class NetworkManagementServiceTest extends AndroidTestCase {
|
||||
assertStatsEntry(stats, "rmnet0", 1000, SET_FOREGROUND, 0, 26033L, 30L, 1401L, 26L);
|
||||
}
|
||||
|
||||
public void testNetworkStatsSingle() throws Exception {
|
||||
stageFile(R.raw.xt_qtaguid_iface_typical, new File(mTestProc, "net/xt_qtaguid/iface_stat_all"));
|
||||
|
||||
final NetworkStats stats = mService.getNetworkStatsSummary();
|
||||
assertEquals(6, stats.size());
|
||||
assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 2112L, 24L, 700L, 10L);
|
||||
assertStatsEntry(stats, "test1", UID_ALL, SET_DEFAULT, TAG_NONE, 6L, 8L, 10L, 12L);
|
||||
assertStatsEntry(stats, "test2", UID_ALL, SET_DEFAULT, TAG_NONE, 1L, 2L, 3L, 4L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a {@link Resources#openRawResource(int)} into {@link File} for
|
||||
* testing purposes.
|
||||
|
||||
Reference in New Issue
Block a user