Suppose that I choose perf
events instructions
, LLC-load-misses
, LLC-store-misses
. Suppose further that I test a program prog
varying its input. Is valgrind
supposed to give me the "same" functional results for the same input and the same counter? That is, if one value in perf
goes up, the one in valgrind
should always do the same? Is there any impact in valgrind
being a simulation that I should be aware of during profiling my code?
EDIT: BTW, before people grill me for not experimenting myself, I have to say that I (kinda) have, the problem is that I have a Sandybridge processor, and perf
has a "bug" that prevents me from measuring LLC-* events. There is a patch, but I don't feel like recompiling my kernel...
Well, Cachegrind is a cache simulator. Even though it tries to mimic some of your hardware's characteristics (cache size, associativity, etc), it does not model every single feature and behavior of your system. Therefore you might in some cases see some differences.
For example, Valgrind's doc states that "Cachegrind simulates branch predictors intended to be typical of mainstream desktop/server processors of around 2004". Sandy Bridge processors first appeared in 2011, and you can guess that branch predictors have improved quite a lot since 2004.
That being said, Valgrind is still a wonderful tool to have in your toolbox.
What's the problem with perf's LLC events on Sandy Bridge processors? I use these events everyday at work on my Sandy Bridge laptop and it works as expected (archlinux 64bits, linux 3.6).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With