• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Measuring Power Values
2@jd:body
3
4<!--
5    Copyright 2015 The Android Open Source Project
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18-->
19<div id="qv-wrapper">
20  <div id="qv">
21    <h2>In this document</h2>
22    <ol id="auto-toc"></ol>
23  </div>
24</div>
25
26
27<p>Device manufacturers must provide a component power profile in
28<code>/frameworks/base/core/res/res/xml/power_profile.xml</code>.</p>
29
30<p>To determine values for power profiles, use hardware that measures the power
31being used by the device and perform the various operations for which
32information is needed. Measure the power use during those operations and compute
33the values (deriving differences from other baseline power uses as appropriate).
34</p>
35
36<p>As the goal of a power profile is to estimate battery drain appropriately,
37power profile values are given in current (amps). The Android framework
38multiplies the current by the time for which the subsystem was active and
39computes the mAh value, which is then used to estimate the amount of battery
40drained by the application/subsystem.</p>
41
42<p>Devices with <a href="#chipset-data">Bluetooth and Wi-Fi controllers</a>
43running Android 6.0 and higher can provide additional power values obtained from
44chipset data.</p>
45
46
47<h2 id="multiple-cpus">Devices with heterogeneous CPUs</h2>
48
49<p>The power profile for devices with CPU cores of heterogeneous architecture
50must include the following additional fields:
51<ul>
52<li>Number of total CPUs for each cluster.</li>
53<li>CPU speeds supported by each cluster.</li>
54</ul>
55
56<p>To differentiate between active CPUs and supported CPU speeds for each
57cluster, append the cluster number to the name of the array. Example:</p>
58
59<pre>
60&lt;array name="cpu.active.cluster0"&gt;
61&lt;value&gt;200&lt;/value&gt;
62&lt;value&gt;300&lt;/value&gt;
63&lt;value&gt;400&lt;/value&gt;
64&lt;/array&gt;
65&lt;array name="cpu.speeds.cluster0"&gt;
66&lt;value&gt;600000&lt;/value&gt;
67&lt;value&gt;800000&lt;/value&gt;
68&lt;value&gt;1200000&lt;/value&gt;
69&lt;/array&gt;
70
71&lt;array name="cpu.active.cluster1"&gt;
72&lt;value&gt;400&lt;/value&gt;
73&lt;value&gt;500&lt;/value&gt;
74&lt;value&gt;600&lt;/value&gt;
75&lt;/array&gt;
76&lt;array name="cpu.speeds.cluster1"&gt;
77&lt;value&gt;800000&lt;/value&gt;
78&lt;value&gt;1200000&lt;/value&gt;
79&lt;value&gt;1400000&lt;/value&gt;
80&lt;/array&gt;
81</pre>
82
83<h2 id="values">Power values</h2>
84<p>The following table describes available power value settings. To view the
85sample file in AOSP, see
86<a href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/power_profile.xml">power_profile.xml</a>.</p>
87
88<table>
89<tr>
90  <th>Name</th>
91  <th>Description</th>
92  <th>Example Value</th>
93  <th>Notes</th>
94</tr>
95<tr>
96  <td>none</td>
97  <td>Nothing</td>
98  <td>0</td>
99  <td></td>
100</tr>
101
102<tr>
103  <td>screen.on</td>
104  <td>Additional power used when screen is turned on at minimum brightness.</td>
105  <td>200mA</td>
106  <td>Includes touch controller and display backlight. At 0 brightness, not the
107  Android minimum which tends to be 10 or 20%.</td>
108</tr>
109
110<tr>
111  <td>screen.full</td>
112  <td>Additional power used when screen is at maximum brightness, compared to
113  screen at minimum brightness.</td>
114  <td>100mA-300mA</td>
115  <td>A fraction of this value (based on screen brightness) is added to the
116  screen.on value to compute the power usage of the screen.</td>
117</tr>
118
119<tr>
120  <td>bluetooth.active</td>
121  <td>Additional power used when playing audio through Bluetooth A2DP.</td>
122  <td>14mA</td>
123  <td></td>
124</tr>
125
126<tr>
127  <td>bluetooth.on</td>
128  <td>Additional power used when Bluetooth is turned on but idle.</td>
129  <td>1.4mA</td>
130  <td></td>
131</tr>
132
133<tr>
134  <td>wifi.on</td>
135  <td>Additional power used when Wi-Fi is turned on but not receiving,
136  transmitting, or scanning.</td>
137  <td>2mA</td>
138  <td></td>
139</tr>
140
141<tr>
142  <td>wifi.active</td>
143  <td>Additional power used when transmitting or receiving over Wi-Fi.</td>
144  <td>31mA</td>
145  <td></td>
146</tr>
147
148<tr>
149  <td>wifi.scan</td>
150  <td>Additional power used when Wi-Fi is scanning for access points.</td>
151  <td>100mA</td>
152  <td></td>
153</tr>
154
155<tr>
156  <td>dsp.audio</td>
157  <td>Additional power used when audio decoding/encoding via DSP.</td>
158  <td>14.1mA</td>
159  <td>Reserved for future use.</td>
160</tr>
161
162
163<tr>
164  <td>dsp.video</td>
165  <td>Additional power used when video decoding via DSP.</td>
166  <td>54mA</td>
167  <td>Reserved for future use.</td>
168</tr>
169
170<tr>
171  <td>camera.avg</td>
172  <td>Average power use by the camera subsystem for a typical camera
173  application.</td>
174  <td>600mA</td>
175  <td>Intended as a rough estimate for an application running a preview
176  and capturing approximately 10 full-resolution pictures per minute.</td>
177</tr>
178
179<tr>
180  <td>camera.flashlight</td>
181  <td>Average power used by the camera flash module when on.</td>
182  <td>200mA</td>
183  <td></td>
184</tr>
185
186
187<tr>
188  <td>gps.on</td>
189  <td>Additional power used when GPS is acquiring a signal.</td>
190  <td>50mA</td>
191  <td></td>
192</tr>
193
194<tr>
195  <td>radio.active</td>
196  <td>Additional power used when cellular radio is transmitting/receiving.</td>
197  <td>100mA-300mA</td>
198  <td></td>
199</tr>
200
201<tr>
202  <td>radio.scanning</td>
203  <td>Additional power used when cellular radio is paging the tower.</td>
204  <td>1.2mA</td>
205  <td></td>
206</tr>
207
208<tr>
209  <td>radio.on</td>
210  <td>Additional power used when the cellular radio is on. Multi-value entry,
211  one per signal strength (no signal, weak, moderate, strong).</td>
212  <td>1.2mA</td>
213  <td>Some radios boost power when they search for a cell tower and do not
214  detect a signal. Values can be the same or decrease with increasing signal
215  strength. If you provide only one value, the same value is used for all
216  strengths. If you provide two values, the first is used for no-signal, the
217  second value is used for all other strengths, and so on.</td>
218</tr>
219
220<tr>
221  <td>cpu.speeds</td>
222  <td>Multi-value entry that lists each possible CPU speed in KHz.</td>
223  <td>125000KHz, 250000KHz, 500000KHz, 1000000KHz, 1500000KHz</td>
224  <td>The number and order of entries must correspond to the mA entries in
225  cpu.active.</td>
226</tr>
227
228<tr>
229  <td>cpu.idle</td>
230  <td>Total power drawn by the system when CPUs (and the SoC) are in system
231  suspend state.</td>
232  <td>3mA</td>
233  <td></td>
234</tr>
235
236<tr>
237  <td>cpu.awake</td>
238  <td>Additional power used when CPUs are in scheduling idle state
239  (kernel idle loop); system is not in system suspend state.</td>
240  <td>50mA</td>
241  <td>Your platform might have more than one idle state in use with differing
242  levels of power consumption; choose a representative idle state for longer
243  periods of scheduler idle (several milliseconds). Examine the power graph on
244  your measurement equipment and choose samples where the CPU is at its lowest
245  consumption, discarding higher samples where the CPU exited idle.</td>
246</tr>
247
248<tr>
249  <td>cpu.active</td>
250  <td>Additional power used by CPUs when running at different speeds.</td>
251  <td>100mA, 120mA, 140mA, 160mA, 200mA</td>
252  <td>Value represents the power used by the CPU rails when running at different
253  speeds. Set the max speed in the kernel to each of the allowed speeds and peg
254  the CPU at that speed. The number and order of entries correspond to the
255  number and order of entries in cpu.speeds.</td>
256</tr>
257
258<tr>
259  <td>cpu.clusters.cores</td>
260  <td>Number of cores each CPU cluster contains.</td>
261  <td>4, 2</td>
262  <td>Required only for devices with <a href="#multiple-cpus">heterogeneous CPU
263  architectures</a>. Number of entries and order should match the number of
264  cluster entries for the cpu.active and cpu.speeds. The first entry represents
265  the number of CPU cores in cluster0, the second entry represents the number of
266  CPU cores in cluster1, and so on.</td>
267</tr>
268
269<tr>
270  <td>battery.capacity</td>
271  <td>Total battery capacity in mAh.</td>
272  <td>3000mAh</td>
273  <td></td>
274</tr>
275</table>
276
277<h2 id="chipset-data">Devices with Bluetooth and Wi-Fi controllers</h2>
278<p>Devices with Bluetooth and Wi-Fi controllers running Android 6.0 and
279higher can be polled for the following energy use data:</p>
280<ul>
281<li>Time spent transmitting (in milliseconds).</li>
282<li>Time spent receiving (in milliseconds).</li>
283<li>Time spent idle (in milliseconds).</li>
284</ul>
285
286<p>Time values are not measured but are instead available from respective chip
287specifications and must be explicitly stated (for details, see
288<a href="{@docRoot}devices/tech/power/batterystats.html#wifi-reqs">Wi-Fi,
289Bluetooth, and cellular usage</a>). To convert time values to power values, the
290framework expects four (4) values for each controller in a resource overlay at
291<code>/frameworks/base/core/res/res/values/config.xml</code>.</p>
292
293  <table id="chipset-energy-data">
294
295    <tr>
296      <th width="10%">Controller</th>
297      <th width="40%">Values/Resource Names</th>
298      <th width="40%">Description</th>
299    </tr>
300
301    <tr>
302      <td>Bluetooth<</td>
303      <td>android:integer/config_bluetooth_idle_cur_ma</td>
304      <td>Average current draw (mA) of the Bluetooth controller when idle.</td>
305    </tr>
306
307    <tr>
308      <td>Bluetooth</td>
309      <td>android:integer/config_bluetooth_active_rx_cur_ma</td>
310      <td>Average current draw (mA) of the Bluetooth controller when receiving.</td>
311    </tr>
312
313    <tr>
314      <td>Bluetooth</td>
315      <td>android:integer/config_bluetooth_tx_cur_ma</td>
316      <td>Average current draw (mA) of the Bluetooth controller when transmitting.</td>
317    </tr>
318
319    <tr>
320      <td>Bluetooth</td>
321      <td>android:integer/config_bluetooth_operating_voltage_mv</td>
322      <td>Average operating voltage (mV) of the Bluetooth controller.</td>
323    </tr>
324
325    <tr>
326      <td>Wi-Fi</td>
327      <td>android:integer/config_wifi_idle_receive_cur_ma</td>
328      <td>Average current draw (mA) of the Wi-Fi controller when idle.</td>
329    </tr>
330
331    <tr>
332      <td>Wi-Fi</td>
333      <td>android:integer/config_wifi_active_rx_cur_ma</td>
334      <td>Average current draw (mA) of the Wi-Fi controller when receiving.</td>
335    </tr>
336
337    <tr>
338      <td>Wi-Fi</td>
339      <td>android:integer/config_wifi_tx_cur_ma</td>
340      <td>average current draw (mA) of the Wi-Fi controller when transmitting.</td>
341    </tr>
342
343    <tr>
344      <td>Wi-Fi</td>
345      <td>android:integer/config_wifi_operating_voltage_mv</td>
346      <td>Average operating voltage (mV) of the Wi-Fi controller.</td>
347    </tr>
348
349    </table>