Callgraph documentation

General questions regarding the usage of CodeLite
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Callgraph documentation

Post by metamorphosis »

Is there any?
I managed to work out that the dot.exe it was looking for was part of graphviz (well, that's what I think it's meant to be anyway),
and gprof is part of the gcc toolset,
But what is gmon (it asks for it)?

And is there any documentation for this tool out there?
Best I could find was a youtube video from ages ago in another language.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Callgraph documentation

Post by eranif »

metamorphosis wrote:Is there any?
Not really. Here is a brief explanation on how to use it

This plugin generates a PNG image and provide execution statistics about your code.
It uses GCC feature that generates profile information in a file called "gmon.out" and then loads this file and renders a callgrap using the graphviz package

Install packages

First, you need to install the following packages (Debian/Ubuntu), it will install dot and gprof:

Code: Select all

apt-get install graphviz
apt-get install binutils
Enable GCC profiling

Next, in your project, you need to enable profile:
project settings->compiler->c++ compiler options->click the button and choose "profile code when executed -pg"
project settings->compiler->c compiler options->click the button and choose "profile code when executed -pg"
project settings->linker->linker options->click the button and choose "profile code when executed -pg"

Rebuild and execute your code
Rebuild your project (clean & build)
Run your code once and let it exit -> this will generate the file gmon.out under the intermediate directory (e.g. "Debug")

Ready to go
Now you are ready to run the plugin: right click on the project->plugins->call graph->show call graph

Eran
Make sure you have read the HOW TO POST thread
metamorphosis
CodeLite Enthusiast
Posts: 45
Joined: Tue Jan 28, 2014 3:03 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Callgraph documentation

Post by metamorphosis »

Awesome, thank you - I never would've thought to click on the "..." button, that's got a very different functionality in MSVC. Nice. Might want to rename it 'options' though.

Here's the instructions for those of us on Windows:

Install packages

Download graphwiz from here and install:
http://www.graphviz.org/Download_windows.php

Make a note of where it's installed to.
If you haven't already got it installed, download and install TDM GCC. Configure codelite to use it as per regular (menu settings->build settings->add compilers, select gcc folder. Then change compiler for your project to this).


Configure callgraph plugin

Go to codelite menu plugins->callgraph->settings, point the gprof to gprof.exe under your TDM GCC /bin folder. Point the dot to dot.exe under your graphwiz/bin folder.


Enable GCC profiling

Follow eranif's instructions on this.


Get callgraph display

Right-click project, click on plugins->callgraph->show callgraph.


Awesome results and tool, thanks eranif and authors Vaclav and Michal!
Post Reply