simpleperf生成火焰图的步骤
1. simpleperf 命令抓取.data文件
adb shell simpleperf record --duration 30 -g -p 8734 --trace-offcpu --clockid monotonic -e cpu-clock -o /data/local/tmp/perf.data
C:\Users\fadi.su>adb shell simpleperf record --duration 30 -g -p 8734 --trace-offcpu --clockid monotonic -e cpu-clock -o /data/local/tmp/perf.data
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libbase_utils.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGEhp.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libc++_shared.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libmap.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGPlatformInterface.so doesn't contain symbol table
simpleperf W dso.cpp:434] failed to read symbols from [wlan]: File not found
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGNet.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGbl.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGNaviDice.so doesn't contain symbol table
simpleperf W dso.cpp:432] /vendor/lib64/egl/libGLESv2_adreno.so doesn't contain symbol table
simpleperf W dso.cpp:432] /vendor/lib64/egl/eglSubDriverAndroid.so doesn't contain symbol table
simpleperf W dso.cpp:432] /vendor/lib64/libgsl.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libnav_data_engine.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libGSQuirrel.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libniocom3rd.so doesn't contain symbol table
simpleperf W dso.cpp:432] /system_ext/app/ANioNavigation/lib/arm64/libLaneNavBL.so doesn't contain symbol table
simpleperf W dso.cpp:432] /vendor/lib64/libadreno_utils.so doesn't contain symbol table
simpleperf W dso.cpp:432] /vendor/lib64/egl/libEGL_adreno.so doesn't contain symbol table
simpleperf I cmd_record.cpp:760] Samples recorded: 156127. Samples lost: 0.
C:\Users\fadi.su>adb shell ls -al /data/local/tmp/perf.data
-rw-rw-rw- 1 root root 47036305 2024-12-19 17:07 /data/local/tmp/perf.data
C:\Users\fadi.su>adb pull /data/local/tmp/perf.data C:\Users\fadi.su\Downloads\nio_map_5fps\simpleperf
/data/local/tmp/perf.data: 1 file pulled, 0 skipped. 39.1 MB/s (47036305 bytes in 1.147s)
从手机端导出
adb pull /data/local/tmp/perf.data C:\Users\fadi.su\Downloads\nio_map_5fps\simpleperf
2.Simpleper report转化.data文件为html
AndroidStudio的NDK工具下载后,到SDK\ndk\25.1.8937393\simpleperf:找到report_html.py即可,python report_html.py -i perf.data
D:\SwDownload\AndroidStudioSDK\ndk\25.1.8937393\simpleperf>python report_html.py -i C:\Users\fadi.su\Downloads\nio_map_5fps\simpleperf\perf.data
python.exe W 12-19 17:21:03 17820 28192 dso.cpp:450] failed to read symbols from [wlan]: File not found
python.exe W 12-19 17:21:03 17820 28192 dso.cpp:450] failed to read symbols from /system_ext/app/ANioNavigation/lib/arm64/libGSQuirrel.so: File not found
17:21:16,093 [INFO] (report_html.py:1036) Report generated at 'report.html'.
最近看trace日志,可以从上帝的视角对比出某个线程耗时多,但是想进一步看细节的话就有些费劲,于是使用simplepef抓了火焰图,但是发现没有竞品可以对比。看来还是需要使用AndroidStudio的profile查看该线程具体哪个函数耗时最多。但是没有该线程的源码,故只能转对于模块工程师看下了哈。