【问题标题】:-pg flags with GNU assembler-pg 带有 GNU 汇编器的标志
【发布时间】:2011-12-07 21:26:56
【问题描述】:

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

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

谢谢

【问题讨论】:

    标签: assembly gnu


    【解决方案1】:

    考虑来自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
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-06
      • 1970-01-01
      • 2011-07-11
      • 2014-06-19
      • 1970-01-01
      • 2010-10-18
      • 2017-01-07
      • 2011-04-23
      相关资源
      最近更新 更多