page.title=Batterystats & Battery Historian Walkthrough meta.tags="android, performance, profiling, tools, battery, batterystats, historian, batterydrain page.tags="android", "performance", "profiling", "tools", "battery", "batterystats", "historian", "batterydrain" page.metaDescription=Collect battery usage data from your device and display it graphically in your browser. page.image=tools/performance/thumbnails/tools_battery_historian.png page.article=true @jd:body
This walkthrough shows the basic usage and workflow for the Batterystats tool and the Battery Historian script.
Batterystats collects battery data from your device, and Battery Historian converts that data into an HTML visualization that you can view in your Browser. Batterystats is part of the Android framework, and Battery Historian is open-sourced and available on GitHub at https://github.com/google/battery-historian.
What it's good for:
https://github.com/google/battery-historian
> adb kill-server
> adb devices
> adb shell dumpsys batterystats --reset
<disconnect and play with app>...<reconnect>
> adb devices
>adb shell dumpsys batterystats > batterystats.txt
> python historian.py batterystats.txt > batterystats.html
historian.py
file
and move it to the Desktop or another writable directory.historian.py
,
cd ~/Desktop
> adb kill-server
> adb devices
> adb shell dumpsys batterystats --reset
Resetting erases old battery collection data; otherewise, the output will be huge.
> adb devices
> adb shell dumpsys batterystats > batterystats.txt
> python historian.py batterystats.txt > batterystats.html
batterystats.htm
file in your browser.