Vince, Good points.
Also something else I am wondering about is: hardware page walker. Does that influence instruction_retired somehow? On Thu, Mar 18, 2010 at 4:11 PM, Vince Weaver <vweav...@eecs.utk.edu> wrote: > >> I wrote a simple Fibonacci and counted the #of instructions (inst_retired) >> using both pin and performance counter. >> As you can see, it seems like perf_counter undercount the #of instructions >> and the result is non-deterministic (sometimes 94730 but sometimes 94729) >> Any reason for this? > > Did you dynamically link your code? The dynamic linker under Linux does a > lot of stuff which might not be deterministic. > > I compiled your code on an AMD Phenom machine. > > Dynamically linked, compiled with gcc 4.4 and -O2 it varied from > 86558 to 86561. > > But if I statically linked, that is compile with "-static" I got > a very consistent "7749" instructions each time. > > If you happen to have valgrind installed, version 3.5 or later, you can > also count instructions using something like: > valgrind --tool=exp-bbv --instr-count-only=yes -- ./fib > although on your fib code the results are too high by a factor of two... > weird. I need to find out why that happens. > > One thing to watch out for when using pin... newer versions of Pin (my > notes say pinkit more recent than 29972) change the way that rep-prefixed > string instructions are counted. Before that Pin matches what hardware > does (each rep-prefixed instruction counts as "1") wheras current Pin > counts each rep as a separate instruction. It is quite possible the > overcount you see with Pin is due to this; the valgrind tool I mention > above will tell you how many rep-prefixed instructions were executed in > the code. > > > One note on your test code... you should probably use the result of the > "fib" calculation, as a printf or such. Otherwise the C compiler could > optimize out the whole routine, as the result is unused. > >> main() >> { >> fib(10) >> } >> >> >> >> > > Vince > vweav...@eecs.utk.edu ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel