diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-09-18 13:30:23 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2011-09-18 16:27:21 -0700 |
commit | 34c73acf88c8190b8cd51d8b8f2b9c22aa7f7941 (patch) | |
tree | 4ff5448905114823c6576a2c625ca312e003b543 /core/java/android/net | |
parent | 00cd1d4e003d5b18dba978ca611a0eb083f8ae2b (diff) | |
download | frameworks_base-34c73acf88c8190b8cd51d8b8f2b9c22aa7f7941.zip frameworks_base-34c73acf88c8190b8cd51d8b8f2b9c22aa7f7941.tar.gz frameworks_base-34c73acf88c8190b8cd51d8b8f2b9c22aa7f7941.tar.bz2 |
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
Diffstat (limited to 'core/java/android/net')
-rw-r--r-- | core/java/android/net/NetworkStatsHistory.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java index d8ac31f..a5cdf70 100644 --- a/core/java/android/net/NetworkStatsHistory.java +++ b/core/java/android/net/NetworkStatsHistory.java @@ -441,10 +441,10 @@ public class NetworkStatsHistory implements Parcelable { final long curStart = bucketStart[i]; final long curEnd = curStart + bucketDuration; - // bucket is older than record; we're finished - if (curEnd < start) break; - // bucket is newer than record; keep looking - if (curStart > end) continue; + // bucket is older than request; we're finished + if (curEnd <= start) break; + // bucket is newer than request; keep looking + if (curStart >= end) continue; // include full value for active buckets, otherwise only fractional final boolean activeBucket = curStart < now && curEnd > now; @@ -466,7 +466,6 @@ public class NetworkStatsHistory implements Parcelable { if (txPackets != null) entry.txPackets += txPackets[i] * overlap / bucketDuration; if (operations != null) entry.operations += operations[i] * overlap / bucketDuration; } - return entry; } |