Sample atomic network stats buckets, full poll.

When sampling network stats, always use atomic buckets instead of
interpolating.  Always poll iface and UID together so we distribute
into buckets equally.  Move stale bucket trimming to just before
writing stats.

Bug: 5321340
Change-Id: I78a2226778a79c875f3668336e39ea24a7b4d5c4
This commit is contained in:
Jeff Sharkey
2011-09-18 13:30:23 -07:00
parent c611ea2aac
commit f444762587

View File

@@ -272,7 +272,11 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
// graceful shutdown system, which should trigger persist of stats, and
// clear any values in memory.
expectCurrentTime();
expectDefaultSettings();
replay();
mServiceContext.sendBroadcast(new Intent(Intent.ACTION_SHUTDOWN));
verifyAndReset();
// talk with zombie service to assert stats have gone; and assert that
// we persisted them to file.
@@ -487,6 +491,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
// now pretend two UIDs are uninstalled, which should migrate stats to
// special "removed" bucket.
expectCurrentTime();
expectDefaultSettings();
replay();
final Intent intent = new Intent(ACTION_UID_REMOVED);
@@ -758,7 +763,6 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
expect(mSettings.getUidMaxHistory()).andReturn(maxHistory).anyTimes();
expect(mSettings.getTagMaxHistory()).andReturn(maxHistory).anyTimes();
expect(mSettings.getTimeCacheMaxAge()).andReturn(DAY_IN_MILLIS).anyTimes();
expect(mSettings.getForceCompletePoll()).andReturn(false).anyTimes();
}
private void expectCurrentTime() throws Exception {