gprof2dot
gprof2dot copied to clipboard
valgrind: A lot of information is lost, graph has few disconnected components
asdf.c:
#include <stdio.h>
#include <SDL2/SDL.h>
void a(void) {
long long sum = 0;
for (long long i = 0; i <= 100000000LL; i++)
sum += i;
printf("%lld\n", sum);
}
void b(void) { a(); }
void c(void) { b(); }
int main(void) { SDL_CreateWindow("a", 5, 5, 100, 100, 0); c(); return 0; }
commands:
gcc asdf.c -lSDL2
valgrind --tool=callgrind --callgrind-out-file=callgrind.out ./a.out
gprof2dot callgrind.out --format=callgrind --output=foo.dot
dot -Tpng foo.dot -o foo.png
resulting foo.png
:
I believe the problem is in gprof2dot, because kcachegrind callgrind.out
correctly shows that most of the time is spent in a()
:
Content of callgrind.out
(71191 lines): https://termbin.com/e2k8
If I comment out the call to SDL_CreateWindow()
, valgrind's brk segment overflow in thread #1
warning disappears, and I also get much better results: