如何使用 gcc 编译代码和 ARM Cortex A8 目标进行调用图分析? [英] How to get call graph profiling working with gcc compiled code and ARM Cortex A8 target?

查看:32
本文介绍了如何使用 gcc 编译代码和 ARM Cortex A8 目标进行调用图分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在咬牙切齿……

我需要在 ARM 板上进行分析并需要查看调用图.我尝试使用 OProfile、Kernel perf 和 Google 性能工具.一切正常,但不输出任何调用图信息.

I need to do profiling on an ARM board and need to view call graphs. I tried with OProfile, Kernel perf and Google performance tools. All work fine but do not output any call-graph information.

这让我得出结论,我没有正确编译我的代码.

This led me to the conclusion that I am not compiling my code correctly.

我在编译 C++ 代码时使用以下标志:

I use the following flags when compiling my C++ code:

Arch 特定:

-march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3

一般:

-fexceptions -fno-strict-aliasing -D_REENTRANT -Wall -Wextra

调试(优化):

-O2 -g -fno-omit-frame-pointer

我在 Google 上进行了大量搜索并找到了一些相关主题:

I did a lot of Google searching and found some related topics:

  • libunwind ?
  • 侏儒
  • (异步)展开表
  • -mapcs-frame

但是我并不完全理解这些是如何联系在一起的.有关如何使调用图正常工作的任何提示?

However I do not fully understand how these are all connected. Any hints on how to get call graphs working?

注意(由于 Rian 的回答):我有兴趣了解某些方法在 ARM 上是否以及为什么比 x86-64 花费更长的时间(相对于其他方法).在不同的平台上执行此操作无济于事(即使我的代码在这两个平台上都可以编译并且我可以在 x86-64 上执行调用图).

Note (due to Rian's answer): I am interested in finding out if and why some methods take longer (in relation to others) on ARM than x86-64. It does not help to do this on a different platform (Even though my code compiles on both and I can do call-graphs on x86-64).

推荐答案

我知道您想在 ARM cortex-A8 上进行分析,但如果您对调用图感兴趣,为什么不为 x86 编译并运行 valgrind 的callgrind 工具并使用 kcachegrind 检查结果?

I know you want to do your profiling on an ARM cortex-A8 but if you're interested in call-graphs, why not compile for x86 and run valgrind's callgrind tool and examine the results with kcachegrind?

两种架构之间的调用图应该相同,即使它们编译的函数略有不同,函数之间的关系也不应该改变.

The call graphs should be the same between the two architectures, even if they compile the functions slightly differently, the relationship between functions shouldn't change.

不需要特殊标志:

valgrind --tool=callgrind -v --dump-every-bb=10000000 ./some-app
kcachegrind &

这篇关于如何使用 gcc 编译代码和 ARM Cortex A8 目标进行调用图分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆