summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-02-26 12:35:32 -0800
committerDianne Hackborn <hackbod@google.com>2014-02-26 15:53:44 -0800
commitd45665bf0b26fddf5716a0fd43036848d9301960 (patch)
treef80f5f2b4ff5db4106c1ec5c8dea7fd26cd3cfb6 /core/java/android/net
parentba7d4f564c1858d46ad55e6a6ca381f532f4acef (diff)
downloadframeworks_base-d45665bf0b26fddf5716a0fd43036848d9301960.zip
frameworks_base-d45665bf0b26fddf5716a0fd43036848d9301960.tar.gz
frameworks_base-d45665bf0b26fddf5716a0fd43036848d9301960.tar.bz2
Collect per-uid mobile radio usage.
We now compute radio active time per application, by distributing the active time across all applications each time the radio goes down, weighting it by the number of packets transferred. Per-app radio power use is now computed using this radio active time. This also gives us a new metric "ms per packet", which give an idea of how effectively an application is using the radio. This is collected and reported as a new set of stats in the human- readable checkin. (It can be computed from the raw checkin data). Also improve sync reporting to include the sync source as used in wake locks, not just the component name. Change-Id: I0b0185fadd1e47ae749090ed36728ab78ac24c5e
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/NetworkStats.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java
index 25514f4..54d43d3 100644
--- a/core/java/android/net/NetworkStats.java
+++ b/core/java/android/net/NetworkStats.java
@@ -507,6 +507,17 @@ public class NetworkStats implements Parcelable {
}
/**
+ * Fast path for battery stats.
+ */
+ public long getTotalPackets() {
+ long total = 0;
+ for (int i = size-1; i >= 0; i--) {
+ total += rxPackets[i] + txPackets[i];
+ }
+ return total;
+ }
+
+ /**
* Subtract the given {@link NetworkStats}, effectively leaving the delta
* between two snapshots in time. Assumes that statistics rows collect over
* time, and that none of them have disappeared.