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