diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-04-13 18:15:56 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-04-14 10:57:22 -0700 |
commit | 0ffc988a7f47013805d5abeed1c20f159b3bd799 (patch) | |
tree | f9873ba8872388b88d75a3d83144e03e7c3f59f4 /services | |
parent | 5cde33b7d14841677414fa9f43a043bb4a89ffa7 (diff) | |
download | frameworks_base-0ffc988a7f47013805d5abeed1c20f159b3bd799.zip frameworks_base-0ffc988a7f47013805d5abeed1c20f159b3bd799.tar.gz frameworks_base-0ffc988a7f47013805d5abeed1c20f159b3bd799.tar.bz2 |
Rewrite battery history storage.
We now write battery history directly into a buffer, instead of
creating objects. This allows for more efficient storage; later
it can be even better because we can only write deltas.
The old code is still there temporarily for validation.
Change-Id: I9707d4d8ff30855be8ebdc93bc078911040d8e0b
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/am/BatteryStatsService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java index 963a691..b4fdc9f 100644 --- a/services/java/com/android/server/am/BatteryStatsService.java +++ b/services/java/com/android/server/am/BatteryStatsService.java @@ -449,6 +449,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { boolean isCheckin = false; + boolean noOutput = false; if (args != null) { for (String arg : args) { if ("--checkin".equals(arg)) { @@ -457,10 +458,22 @@ public final class BatteryStatsService extends IBatteryStats.Stub { synchronized (mStats) { mStats.resetAllStatsLocked(); pw.println("Battery stats reset."); + noOutput = true; } + } else if ("--write".equals(arg)) { + synchronized (mStats) { + mStats.writeSyncLocked(); + pw.println("Battery stats written."); + noOutput = true; + } + } else { + pw.println("Unknown option: " + arg); } } } + if (noOutput) { + return; + } if (isCheckin) { List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0); synchronized (mStats) { |