Profiling
Gprof was the tool to use normally, but the last time i encountered a lot of problems:
- c++ give ridiculously large stack frames like in gdb
- all numbers seemed to be 0.0
- a completely incomprehensible gprof output
perf
Take a look at this first, perf is a standard tool for profiling the kernel, but it can be used for your own programs as well.
Install like this :
| perf installation | |
|---|---|
Of course your kernel version may vary. But this worked on laptop. Now start your program no instrumentation is needed :
You could remember the pid, but it is easier to just run this oneliner :
| oneliner | |
|---|---|
Now you wait until you get a screen like this :
This is rather like gprof, the one that works. Also it gets updated while you go active on your program. It really seems to wait until you do something in the backend.
Kcachegrind
It is an option to valgrind and you can use it simply like this on the normal executable (no -pg compilation needed)
| kcachegrind | |
|---|---|
This will get you a nice visual layout still not completely clear but way better than gprof.