Linux perf ツールを使用して、特定の機能中のパフォーマンス統計を監視しようとしています。
https://perf.wiki.kernel.org/index.php/Jolsa_Features_Togle_Event#Example_-_using_u.28ret.29probesの指示に従っていました
単純な C プログラムの命令数を取得しようとしました。(下図参照)
1) 私の単純な C コード
#include<stdio.h>
int sum=0;
int i=0;
void func(void)
{
for(i=0;i<100;i++)
{
sum=sum+i;
}
}
int main(void)
{
func();
return 0;
}
2) プローブのコンパイルと追加
root@sunimal-laptop:/home/sunimal/temp# gcc -o ex source.c
root@sunimal-laptop:/home/sunimal/temp# perf probe -x ./ex entry=func
Added new event:
probe_ex:entry (on 0x4ed)
You can now use it in all perf tools, such as:
perf record -e probe_ex:entry -aR sleep 1
root@sunimal-laptop:/home/sunimal/temp# perf probe -x ./ex exit=func%return
Added new event:
probe_ex:exit (on 0x4ed%return)
You can now use it in all perf tools, such as:
perf record -e probe_ex:exit -aR sleep 1
3) func() 関数内の命令カウントを測定するために perf stat を使用しようとしています。これにより、エラーが発生します。
root@sunimal-laptop:/home/sunimal/temp# perf stat -e instructions:u,probe_ex:entry/on=instructions/,probe_ex:exit/off=instructions/ ./ex
invalid or unsupported event: 'instructions:u,probe_ex:entry/on=instructions/,probe_ex:exit/off=instructions/'
Run 'perf list' for a list of valid events
誰かが私が間違っていた場所を教えてもらえますか?
[Linux カーネル 3.11.0-12-generic を使用しています]