c - Measuring FLOPs of an application with the linux perf tool -


i want measure ammount of floating point , arithmetic operations executed application 'perf', new command line interface command linux performance counter subsystem. (for testing purposes use simple dummy app created, see below).

because not find 'perf' events defined measuring fp , integer operations, started digging in raw hardware event codes (to used -rnnn, nnn hexadecimal value of event code). real problem that, codes found retired instructions (inst_retired) not make distinction between fp , other instructions (x87 , mmx/sse). when tried use appropriate umasks particular code found out somehow 'perf' not understand or support umask inclusion. tried with:

% perf stat -e rc0 ./a.out 

which gives me instructions retired, but

% perf stat -e rc002 ./a.out  

which should give me x87 instructions executed says supplied wrong parameters. maybe so, correct way use umasks of raw hardware events 'perf'? in general way exact number of floating point , integer operations program executed using perf tool?

many thanks, konstantin boyanov


here test app:

int main(void){   float  numbers[1000];   float res1;   double doubles[1000];   double res2;    int i,j=3,k=42;    for(i=0;i<1000;i++){     numbers[i] = (i+k)*j;     doubles[i] = (i+j)*k;     res1 = numbers[i]/(float)k;     res2 = doubles[i]/(float)j;   } } 

the event use depends on processor. can use libpfm4 (http://perfmon2.git.sourceforge.net/git/gitweb-index.cgi) determine available events (using showevinfo program) , check_events same distribution figure out raw codes event. sandy bridge cpu supports fp_comp_ops_exe event have empirically found corresponds closely flop count.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -