-pg 带有 GNU 汇编器的标志

发布于 2024-12-19 20:26:36 字数 110 浏览 1 评论 0原文

我正在编写一些汇编代码并使用 GNU 汇编器来汇编它们。我意识到无法使用 -pg 标志进行编译以便我可以进行分析。

有没有其他方式或任何其他汇编程序可以通过我进行分析?

谢谢

I am writing some assembly code and assembling them using GNU assembler. I have realized that there is no way to compile with -pg flags so that I can profile.

Is there any other way or any other assembler through which I can profile?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

征棹 2024-12-26 20:26:36

考虑使用 google-perftools 中的分析器。假设我们有一个由两个目标文件构建的可执行文件 main:一个是从 C 语言编译的,另一个是从汇编语言编译的。无需为编译、汇编或链接添加任何额外的标志。

$ LD_PRELOAD=path/to/libprofiler.so CPUPROFILE=main.prof ./main
$ pprof main main.prof  --text
Using local file main.
Using local file main.prof.
Removing killpg from all stack traces.
Total: 435 samples
     348  80.0%  80.0%      348  80.0% label_from_assembly_file
      37   8.5%  88.5%       37   8.5% exit
      29   6.7%  95.2%       29   6.7% another_label_from_assembly_file
      15   3.4%  98.6%      435 100.0% main
       4   0.9%  99.5%        4   0.9% another_label_defined_in_asm
       2   0.5% 100.0%        2   0.5% and_a_fourth_asm_label
       0   0.0% 100.0%      435 100.0% __libc_start_main
       0   0.0% 100.0%      435 100.0% _start

以下是有关分析器的所有信息

Consider a profiler from google-perftools. Let's assume we've got an executable main built from two object files: one compiled from C and one from assembly. There's no need to add any extra flags for compilation, assembling or linking.

$ LD_PRELOAD=path/to/libprofiler.so CPUPROFILE=main.prof ./main
$ pprof main main.prof  --text
Using local file main.
Using local file main.prof.
Removing killpg from all stack traces.
Total: 435 samples
     348  80.0%  80.0%      348  80.0% label_from_assembly_file
      37   8.5%  88.5%       37   8.5% exit
      29   6.7%  95.2%       29   6.7% another_label_from_assembly_file
      15   3.4%  98.6%      435 100.0% main
       4   0.9%  99.5%        4   0.9% another_label_defined_in_asm
       2   0.5% 100.0%        2   0.5% and_a_fourth_asm_label
       0   0.0% 100.0%      435 100.0% __libc_start_main
       0   0.0% 100.0%      435 100.0% _start

Here's all there is to know about the profiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文