|
From: Christoph B. <bar...@or...> - 2006-09-14 09:20:47
|
Here is a small testprogram that shows the same behaviour:
#include <cstdlib>
#include <cstdio>
extern "C" {
#include <unistd.h>
#include <sys/types.h>
}
int sum = 0;
int main() {
if (fork() == -1) {
perror("Could not create child");
exit(-1);
}
while (true) {
sleep(1);
for (int i = 0; i < 100000000; ++i) sum += i;
}
}
Start it with valgrind --tool=callgrind --instr-atstart=no -v ./a.out
And then look what happens when you iterate:
callgrind_control -i on
callgrind_control -i off
Greetings
Christoph Bartoschek
|