2011-12-07 51 views
0

我正在編寫一些彙編代碼並使用GNU彙編器進行彙編。我意識到沒有辦法用-pg標誌編譯,以便我可以進行配置。使用GNU彙編器的-pg標誌

是否有任何其他方式或任何其他彙編程序通過我可以配置文件?

謝謝

回答

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