Return stats from inactive ifaces, packet counts.

When an iface goes inactive, xt_qtaguid maintains historical counters
instead of discarding.  Now reading and returning those values in
NetworkManagementService summary calls.  Tests to verify stats are
returned.

Modify NetworkStats to include rxPackets and txPackets values, and
move to Entry to eventually hide internal storage details.

Bug: 4984539
Change-Id: I1ba0bb5580c62e946d9dff2cc2a6f64aff403efc
This commit is contained in:
Jeff Sharkey
2011-07-11 14:36:15 -07:00
parent 620e1078ec
commit 337b986b98
2 changed files with 61 additions and 11 deletions

View File

@@ -44,20 +44,20 @@ public class NetworkStatsTest extends TestCase {
public void testAddEntryGrow() throws Exception {
final NetworkStats stats = new NetworkStats(TEST_START, 2);
assertEquals(0, stats.size);
assertEquals(0, stats.size());
assertEquals(2, stats.iface.length);
stats.addEntry(TEST_IFACE, TEST_UID, TAG_NONE, 1L, 2L);
stats.addEntry(TEST_IFACE, TEST_UID, TAG_NONE, 2L, 2L);
assertEquals(2, stats.size);
assertEquals(2, stats.size());
assertEquals(2, stats.iface.length);
stats.addEntry(TEST_IFACE, TEST_UID, TAG_NONE, 3L, 4L);
stats.addEntry(TEST_IFACE, TEST_UID, TAG_NONE, 4L, 4L);
stats.addEntry(TEST_IFACE, TEST_UID, TAG_NONE, 5L, 5L);
assertEquals(5, stats.size);
assertEquals(5, stats.size());
assertTrue(stats.iface.length >= 5);
assertEquals(1L, stats.rx[0]);