使用Simpleperf对Android应用进行分析

· 25字 · 1分钟

在NDK目录下,找到simpleperf目录,在终端中进入。

调整现场,启动CPU分析,生成perf.data
python uplive_profiler.py -p com.asiainno.uplive

对perf.data进行解析生成out.perf
python report_sample.py > out.perf

借助FlameGraph工具
git clone https://github.com/brendangregg/FlameGraph.git

将out.perf中的符号进行折叠:
./FlameGraph/stackcollapse-perf.pl out.perf >out.folded

生成svg图,用chrome打开既是火焰图
./FlameGraph/flamegraph.pl out.folded >p.svg

火焰图原理
https://blog.openresty.com.cn/cn/dynamic-tracing/

comments powered by Disqus