diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-02-26 12:35:32 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2014-02-26 15:53:44 -0800 |
commit | d45665bf0b26fddf5716a0fd43036848d9301960 (patch) | |
tree | f80f5f2b4ff5db4106c1ec5c8dea7fd26cd3cfb6 /services/core/java | |
parent | ba7d4f564c1858d46ad55e6a6ca381f532f4acef (diff) | |
download | frameworks_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 'services/core/java')
3 files changed, 16 insertions, 20 deletions
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java index 0ebbd8a..cb5946a 100644 --- a/services/core/java/com/android/server/BatteryService.java +++ b/services/core/java/com/android/server/BatteryService.java @@ -656,6 +656,7 @@ public final class BatteryService extends Binder { long ident = Binder.clearCallingIdentity(); try { if (mUpdatesStopped) { + mUpdatesStopped = false; mBatteryProps.set(mLastBatteryProps); processValuesLocked(); } diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java index 95bfd2f..e43dea9 100644 --- a/services/core/java/com/android/server/content/SyncManager.java +++ b/services/core/java/com/android/server/content/SyncManager.java @@ -154,7 +154,7 @@ public class SyncManager { private static final int INITIALIZATION_UNBIND_DELAY_MS = 5000; - private static final String SYNC_WAKE_LOCK_PREFIX = "*sync*"; + private static final String SYNC_WAKE_LOCK_PREFIX = "*sync*/"; private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarm"; private static final String SYNC_LOOP_WAKE_LOCK = "SyncLoopWakeLock"; @@ -1210,9 +1210,9 @@ public class SyncManager { mBound = false; } else { try { - mEventName = serviceComponent.flattenToShortString(); + mEventName = mSyncOperation.wakeLockName(); mBatteryStats.noteEvent(BatteryStats.HistoryItem.EVENT_SYNC_START, - serviceComponent.flattenToShortString(), mSyncAdapterUid); + mEventName, mSyncAdapterUid); } catch (RemoteException e) { } } @@ -1927,10 +1927,10 @@ public class SyncManager { } private PowerManager.WakeLock getSyncWakeLock(SyncOperation operation) { - final String wakeLockKey = operation.wakeLockKey(); + final String wakeLockKey = operation.wakeLockName(); PowerManager.WakeLock wakeLock = mWakeLocks.get(wakeLockKey); if (wakeLock == null) { - final String name = SYNC_WAKE_LOCK_PREFIX + operation.wakeLockName(); + final String name = SYNC_WAKE_LOCK_PREFIX + wakeLockKey; wakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, name); wakeLock.setReferenceCounted(false); mWakeLocks.put(wakeLockKey, wakeLock); diff --git a/services/core/java/com/android/server/content/SyncOperation.java b/services/core/java/com/android/server/content/SyncOperation.java index 036b21f..5233014 100644 --- a/services/core/java/com/android/server/content/SyncOperation.java +++ b/services/core/java/com/android/server/content/SyncOperation.java @@ -86,6 +86,9 @@ public class SyncOperation implements Comparable { /** Amount of time before {@link #effectiveRunTime} from which this sync can run. */ public long flexTime; + /** Descriptive string key for this operation */ + public String wakeLockName; + public SyncOperation(Account account, int userId, int reason, int source, String provider, Bundle extras, long runTimeFromNow, long flexTime, long backoff, long delayUntil, boolean allowParallelSyncs) { @@ -308,25 +311,17 @@ public class SyncOperation implements Comparable { sb.append("]"); } - public String wakeLockKey() { - if (target.target_provider) { - return target.account.name + "/" + target.account.type + ":" + target.provider; - } else if (target.target_service) { - return target.service.getPackageName() + "/" + target.service.getClassName(); - } else { - Log.wtf(TAG, "Invalid target getting wakelock for operation - " + key); - return null; - } - } - public String wakeLockName() { + if (wakeLockName != null) { + return wakeLockName; + } if (target.target_provider) { - return "/" + target.provider + return (wakeLockName = target.provider + "/" + target.account.type - + "/" + target.account.name; + + "/" + target.account.name); } else if (target.target_service) { - return "/" + target.service.getPackageName() - + "/" + target.service.getClassName(); + return (wakeLockName = target.service.getPackageName() + + "/" + target.service.getClassName()); } else { Log.wtf(TAG, "Invalid target getting wakelock name for operation - " + key); return null; |