User forums > General (but related to Code::Blocks)

Profiling with CodeBlocks

(1/1)

JohnCell:
Hello guys !

I'd like to know if it's possible to use CodeBlocks (or any add-on ) for code profiling under Windows ?
I've not been able to find any tutorial.

Thanks,
John

stahta01:
No idea if it still works.

https://wiki.codeblocks.org/index.php/Code_Profiler_plugin

nenin:

--- Quote from: stahta01 on June 21, 2023, 06:27:46 pm ---No idea if it still works.

--- End quote ---
Last time I tried there were solid problems, but I suppose related to fresh mingw versions, not C::B.

SashaGT:
Hello! I hope this isn't too late to help!

I just tested it out on one of my projects. Here are the steps I took to get it working:

* [Optional] Make a build target for profiling (Project > Properties > Build Targets).

* Add the -pg compiler to the build target. (I believe you'll also want -g too..)

* Compile the build target.

* Run the application. This'll create a gmon.out file in the executable's directory.

* Quit the application

* Run the profiler through Code::Blocks (Plugins > Code Profiler).

Code::Blocks uses gprof for profiling. You won't get nicely drawn call graphs but you could also try and using gprof more directly:

* https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html
* I'm sure there's more tutorials on gprof out there too...
I'm currently using C::B version 20.03-r11983

Navigation

[0] Message Index

Go to full version