android - Perf 无法在 Android 上正确显示调用图

标签 android linux profiling perf

我正在尝试使用 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.

虽然选项被标记为已弃用,但它为我修复了调用图。

关于android - Perf 无法在 Android 上正确显示调用图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32447923/

相关文章:

android.os.AsyncTask.THREAD_POOL_EXECUTOR

android - 何时使用菜单项 ID 调用 findViewById 以确保它不为空?

android - Ubuntu MATE + Meteor ANDROID_HOME SDK 路径根问题

android - 使用 ImageView 和矩阵在图像上绘制形状

linux - bash 脚本 : ssh create file; sleep 3m; rm file;

linux - 在FC 15中找不到apache目录

linux - Arch Linux 中的 Ftrace 前端是什么?

c++ - 仅分析插件

node.js - 在 Linux 上分析 Node.js Web 应用程序

java - 自动比较单个单元测试的 Java 分析结果