1page.title=Battery Historian Charts
2meta.tags="android, performance, profiling, tools, battery, historian, batterydrain
3page.tags="android", performance", "profiling", "tools", "battery", "historian" "batterydrain"
4page.metaDescription=Examine and interpret the collected battery usage data in your browser.
5page.image=tools/performance/thumbnails/tools_battery_historian.png
6page.article=true
7
8@jd:body
9
10<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
11
12<h2>In this document</h2>
13<ul>
14  <li><a href="#BatteryHistorianCharts">Battery Historian Charts</a></li>
15  <li><a href="#FilteringBatterystats">Filtering batterystats output</a></li>
16</ul>
17
18<h2>You should also read</h2>
19<ul>
20  <li><a href="{@docRoot}tools/performance/batterystats-battery-historian/index.html">
21    Batterystats &amp; Battery Historian Walkthrough</a></li>
22  <li><a href="{@docRoot}tools/performance/systrace/index.html">
23    Systrace Walkthrough</a></li>
24</ul>
25
26</div>
27
28
29  <p id="BatteryHistorianCharts">
30    The Battery Historian chart graphs power-relevant events over time.</p>
31
32  <p>Each row shows a colored bar segment when a system component is active
33   and thus drawing current from the battery. The chart does <i>not</i> show <i>how much</i> battery was used by the
34  component, only that the app was active. Charts are organized by category.</p>
35
36  <div class="figure" style="">
37  <img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png"
38         alt=""
39         height="" />
40    <p class="img-caption">
41      <strong>Figure 1. </strong>Example of Battery Historian output.
42    </p>
43  </div>
44
45  <h3>Battery usage categories</h3>
46
47  <ul>
48    <li><b>battery_level</b>: When the battery level was recorded and logged.
49    Reported in percent, where 093 is 93%. Provides an overall measure of how fast the battery
50    is draining.</li>
51
52    <li><b>top</b>: The application running at the top; usually, the application that is visible to
53    the user. If you want to measure battery drain while your app is active, make sure
54    it's the top app. If you want to measure battery drain while your app is in
55    the background, make sure it's <i>not</i> the top app.</li>
56
57    <li><b>wifi_running</b>: Shows that the Wi-Fi network connection was active.</li>
58
59    <li><b>screen</b>: Screen is turned on.</li>
60
61    <li><b>phone_in_call</b>: Recorded when the phone is in a call.</li>
62
63    <li><b>wake_lock</b>: App wakes up, grabs a lock, does small work, then goes back to sleep.
64    This is one of the most important pieces of information. Waking up the phone is expensive, so
65    if you see lots of short bars here, that might be a problem.</li>
66
67    <li><b>running</b>: Shows when the CPU is awake. Check whether it is awake and asleep
68      when you expect it to be.</li>
69
70    <li><b>wake_reason</b>: The last thing that caused the kernel to wake up. If
71    it's your app, determine whether it was necessary.</li>
72
73    <li><b>mobile_radio</b>: Shows when the radio was on. Starting the radio is battery expensive.
74    Many narrow bars close to each other can indicate opportunities for
75    batching and other optimizations.</li>
76
77    <li><b>gps</b>: Indicates when the GPS was on. Make sure this is what you expect.</li>
78
79    <li><b>sync:</b> Shows when an app was syncing with a backend. The sync bar also shows which
80    app did the syncing. For users, this can show apps where they might turn syncing off to save
81    battery. Developers should sync as little as possible and only as often as necessary.</li>
82  </ul>
83
84
85  <p class="note"><strong>Note:</strong>
86    Not every chart will show every category.</p>
87
88  <h2 id="FilteringBatterystats">Filtering batterystats output</h2>
89
90  <p>You can gather additional information from the <code>batterystats.txt</code> file
91    where you saved the output from the batterystats command.</p>
92
93  <div class="figure" style="">
94<img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image03.png"
95         alt=""
96         width="340px" />
97    <p class="img-caption">
98      <strong>Figure 2.</strong>Example of filtered batterystats output.
99    </p>
100  </div>
101
102  <p>Open the file in a text editor and search for:</p>
103
104  <ol>
105    <li><b><code>Battery History</code></b>: A time series of power-relevant events, such as
106    screen, Wi-Fi, and app launch. These are also visible through Battery Historian.</li>
107
108    <li><b><code>Per-PID Stats</code></b>: How long each process ran.</li>
109
110    <li><b><code>Statistics since last charge</code></b>: System-wide statistics, such as
111    cell signal levels and screen brightness. Provides an overall picture of what's happening
112    with the device. This information is especially useful
113    to make sure no external events are affecting your experiment.</li>
114
115    <li><b><code>Estimated power use (mAh)</code></b> by UID and peripheral: This is currently an
116    extremely rough estimate and should not be considered experiment data.</li>
117
118    <li><b><code>Per-app mobile ms per packet</code></b>: Radio-awake-time divided by packets sent.
119    An efficient app will transfer all its traffic in batches, so the lower this number the
120    better.</li>
121
122    <li><b><code>All partial wake locks</code></b>: All app-held wakelocks, by aggregate
123    duration and count.</li>
124  </ol>
125