Hi! I'm currently trying to develop a simple profiling tool on top of
valgrind/callgrind. To do that I've inserted code on "CLG_(instrument)"
(callgrind/main.c) so that it creates a block (that actually includes the
current BB and some other information - I call it execution block) so that
when addEvent_Dr or addEvent_Dw are called I can register the respective
memory access (read or write). Then, at "finish" I try to calculate the
conflicts between blocks with the information on their memory accesses and
finally I output those results. When running this version of callgrind with
a simple program:
#include "callgrind.h"
volatile int i;
volatile int k;.
.
.
int main() {
CALLGRIND_START_INSTRUMENTATION
volatile int j;
k = 0;
i = 10;
for(j = 0; j<i; j++){
k = k + 1;
}
i = 15;
func1();
func2();
i = 2;
CALLGRIND_STOP_INSTRUMENTATION
return 0;
}
(func1 and func2 don't matter for this problem)
observing the output I see that there is no information about the blocks of
the for-loop: I identify each execution block (at "CLG_(instrument)") by
"new_eb->id = CLG_(stat).bb_executions;" and on the output I see a jump from
block #2 to block #12 leading me to the conclusion that the 10 blocks for
the 10 iterations are missing. It's important that I can output this
information. I know that VEX does some optimizations to the client code
before it is instrumented by the tool (callgrind). Namely it does loop
unrolling which I believe is the source of my problem. So, I ask: is this
really the cause of my problem? and Is there an
obvious/simple/straightforward way to prevent VEX from doing this?
Thank you very much for your help!
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users