|
From: Josef W. <Jos...@gm...> - 2007-03-22 16:44:45
|
On Thursday 22 March 2007, Fabian Wein wrote: > > valgrind --tool=callgrind --ct-verbose=1 ... > Thanks for the qick answer, but this is not what I want. > > I want a (human readable) call-graph like > > main() > Class::Class() > Class::Init() > Class:run() > AnotherClass::AnotherClass() > Matrix::Matrix() > Vector::Vector() > Vector::Vector() > Matrix::Multiply(Vector) > AnotherClass::~AnotherClass() > Class::~Class() Hmm. This is not a call-graph, as a graph can not have multiple nodes with the same label. So I suppose this actually is the call tree, sorted according to time? Then '--ct-verbose=1' actually should exactly be the thing you want here, or you have to explain in more detail what you want. As I said, it could have a nicer format. The main thing you seem missing is filtering the lines, like to only show the call tree inside of function main()? That actually is easy (I know, strange way to specify 2 args in one option): valgrind --tool=callgrind --ct-verbose1='main()' ... Meaning: "Switch verbose level to 1 when entering 'main()' and back to the previous level when leaving 'main()'". You need to exactly specify the symbol name here, which includes the parenthesis for C++ code (BTW, shouldn't this be 'main(int,char*[])' ?). And you probably want to not see all the stuff from the runtime linker. It should work with an additional option "--ct-verbose0='_dl_runtime_resolve'", but there is a bug in the option parser. Instead you could do something like valgrind --tool=callgrind --ct-verbose=1 ... 2>&1 | grep -v ld-2.5.so (for me, the runtime linker is in shared library ld-2.5.so). Josef |