- Wakelock analysis
- Kernel trace analysis
- Other command line tools
Wakelock analysis
默认情况下,Android不会记录指定应用的用户空间下wakelock transitions的时间戳。如果想要让 Historian 在timeline展示每个 individual wakelock 的详细信息,就需要在开始操作试验之前通过下面的命令开启 full wakelock reporting。
adb shell dumpsys batterystats --enable full-wake-history需要注意的是,一旦开启 full wakelock reporting,电池历史日志记录将在几小时后溢出。使用此选项可进行短期测试(3-4小时)。
Kernel trace analysis
要生成记录内核唤醒源和内核唤醒锁活动的跟踪文件,
首先开启 kernel trace logging:
$ adb root$ adb shellSet the events to trace.
$ echo "power:wakeup_source_activate" >> /d/tracing/set_event$ echo "power:wakeup_source_deactivate" >> /d/tracing/set_eventThe default trace size for most devices is 1MB, which is relatively low and might cause the logs to overflow.
8MB to 10MB should be a decent size for 5-6 hours of logging.
$ echo 8192 > /d/tracing/buffer_size_kb$ echo 1 > /d/tracing/tracing_on使用设备跑测试场景
完成后导出日志
$ echo 0 > /d/tracing/tracing_on$ adb pull /d/tracing/trace <some path> ##### Take a bug report at this time.$ adb bugreport > bugreport.txtOther command line tools
System stats
$ go run cmd/checkin-parse/local_checkin_parse.go --input=bugreport.txtTimeline analysis
$ go run cmd/history-parse/local_history_parse.go --summary=totalTime --input=bugreport.txtDiff two bug reports
$ go run cmd/checkin-delta/local_checkin_delta.go --input=bugreport_1.txt,bugreport_2.txt 继续阅读与本文标签相同的文章
下一篇 :
跨域问题与SpringBoot解决方案
-
阿里云安全肖力:云上数据安全体系建设的六要素
2026-05-24栏目: 教程
-
九江市和阿里巴巴达成合作,引入阿里云城市大脑等多项技术
2026-05-24栏目: 教程
-
还在“替人打工”?来试试做自己的产品吧! | 开发者必读(014期)
2026-05-24栏目: 教程
-
阿里“内核漏洞检测方法”入选国际学术顶会,尚不开源
2026-05-24栏目: 教程
-
Elasticsearch5.4.0(head/kibana/logstash)安装部署深入详解
2026-05-24栏目: 教程
