Perf 未在 Android 上正确显示调用图
Perf does not display call graph properly on Android
我正在尝试使用 perf
来分析我的 Android 应用程序。
在 fplutil 项目的帮助下,我设法在 Android 设备上安装了 perf,运行 perf record
然后 perf report
在主机上。
通常当我 运行 perf report -g
我希望看到类似于这个的调用图:
47.91% a.out a.out [.] f5()
|
--- f5()
|
|--53.82%-- f4()
| |
| |--56.16%-- f3()
| | |
| | |--49.14%-- f2()
| | | |
| | | |--52.92%-- f1()
| | | | a()
| | | | main
| | | | __libc_start_main
| | | |
| | | --47.08%-- a()
| | | main
| | | __libc_start_main
然而,当我对 Android 设备上收集的数据执行 perf report
时,我没有看到正确的调用图,就像堆栈没有正确展开一样:
4.98% app_name my_lib.so [.] void quat_apply<double>(double*, double const*, double const*, int, double)
|
--- 0xbee75fe4
|
--- 0xbee760c4
|
--- 0xbee75c0c
我应该怎么做才能用函数名替换这些十六进制地址?
我已经在用 -g
和 -fno-omit-frame-pointer
构建我的代码了,我还遗漏了什么吗?
宾果!
-mapcs-frame
Generate a stack frame that is compliant with the ARM Procedure Call
Standard for all functions, even if this is not strictly necessary for
correct execution of the code. Specifying -fomit-frame-pointer with
this option causes the stack frames not to be generated for leaf
functions. The default is -mno-apcs-frame. This option is deprecated.
虽然选项被标记为已弃用,但它为我修复了调用图。
我正在尝试使用 perf
来分析我的 Android 应用程序。
在 fplutil 项目的帮助下,我设法在 Android 设备上安装了 perf,运行 perf record
然后 perf report
在主机上。
通常当我 运行 perf report -g
我希望看到类似于这个的调用图:
47.91% a.out a.out [.] f5()
|
--- f5()
|
|--53.82%-- f4()
| |
| |--56.16%-- f3()
| | |
| | |--49.14%-- f2()
| | | |
| | | |--52.92%-- f1()
| | | | a()
| | | | main
| | | | __libc_start_main
| | | |
| | | --47.08%-- a()
| | | main
| | | __libc_start_main
然而,当我对 Android 设备上收集的数据执行 perf report
时,我没有看到正确的调用图,就像堆栈没有正确展开一样:
4.98% app_name my_lib.so [.] void quat_apply<double>(double*, double const*, double const*, int, double)
|
--- 0xbee75fe4
|
--- 0xbee760c4
|
--- 0xbee75c0c
我应该怎么做才能用函数名替换这些十六进制地址?
我已经在用 -g
和 -fno-omit-frame-pointer
构建我的代码了,我还遗漏了什么吗?
宾果!
-mapcs-frame
Generate a stack frame that is compliant with the ARM Procedure Call Standard for all functions, even if this is not strictly necessary for correct execution of the code. Specifying -fomit-frame-pointer with this option causes the stack frames not to be generated for leaf functions. The default is -mno-apcs-frame. This option is deprecated.
虽然选项被标记为已弃用,但它为我修复了调用图。