Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console alternative of kcachegrind?

Kcachegrind rocks and it's of my favorite tools, however from time to time I'm missing the ability to run it in terminal(e.g using ssh) on the remote server.

I know it's possible to setup VNC or X-server forwarding but it's quite clumsy while I need something simple.

Is there any kcachegrind console alternative(e.g ncurses based)?

like image 418
pachanga Avatar asked Sep 05 '09 17:09

pachanga


3 Answers

You can get basic information and annotations from callgrind output file (created by valgrind --tool=callgrind) with the command-line utility callgrind_annotate. (manual page section in docs). For files, generated by cachegrind (valgrind --tool=cachegrind), you can use a cg_annotate (section in docs). These utilities are build by default with valgrind itself.

Another way is to copy program and cache/callgrind output files to your machine and then analyze them with local kcachegrind as usual. But this way it can be difficult if your machine have no unix but windows or you running on incompatible arch (kcachegrind can call local objdump to get information about program).

I also want to recommend command line options to valgrind:

 valgrind --tool=cachegrind --branch-sim=yes 
 valgrind --tool=callgrind --dump-instr=yes --trace-jump=yes

You can also specify cache sizes for cachegrind with --I1=32768,8,64 --D1=32768,8,64 --L2=3145728,12,64

like image 158
osgx Avatar answered Nov 09 '22 06:11

osgx


Use SSHFS to mount the remote directory that you're working in (see e.g. SSHFS installation instructions for Ubuntu).

Then just ssh in and run valgrind --tool=callgrind with whatever options you want in the remote directory. Since you have that directory mounted locally, it's as easy to open the data files with KCacheGrind as if you were debugging locally.

like image 23
StackExchange saddens dancek Avatar answered Nov 09 '22 07:11

StackExchange saddens dancek


webgrind is a web-frontend written in PHP that parses the output of XDebug (which uses the same format as callgrind).

like image 20
tstenner Avatar answered Nov 09 '22 07:11

tstenner