2011-12-07 9 views
0

私はいくつかのアセンブリコードを書き、GNUアセンブラを使用してそれらをアセンブルしています。私はプロファイリングできるように-pgフラグを付けてコンパイルする方法がないことを認識しました。-pg GNUアセンブラのフラグ

他の方法や他のどのアセンブラを使用してプロファイリングできますか?

ありがとうございました

答えて

1

プロファイラをgoogle-perftoolsと考えてください。実行ファイルmainが2つのオブジェクトファイル(Cからコンパイルされ、アセンブリから1つ)から構築されていると仮定しましょう。コンパイル、アセンブル、リンクのためのフラグを追加する必要はありません。

$ 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