Results 1 to 3 of 3

Thread: How can I profile my programme in CodeBlocks ?

  1. #1
    Join Date
    Apr 2012
    Location
    广州
    Beans
    231
    Distro
    Ubuntu Gnome 16.04 Xenial Xerus

    How can I profile my programme in CodeBlocks ?

    If I have written a programme and I want to optimize the algorithm. But I want to know which module consumes most of the time. How can I profile the programme in CodeBlocks IDE ?

    It seems that I have missed some plugins because it didn't do anything even if I have submitted the profile option.

    Can you tell me how to fix it ? Thank you

  2. #2
    Join Date
    Oct 2007
    Beans
    1,914
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: How can I profile my programme in CodeBlocks ?

    Short answer: Don't.

    Long answer: Documentation for such stuff is a bit hard to find, as for every combination of programming language and IDE, the answer will be different, and in particular outdates quite soon.

    However, there is no need for this. Profiling a program compiled with gcc/g++ is very simple even from the command line. So there is noting wrong with trying to do it without the IDE. You only need to follow three steps:

    1. Compile your program with debug symbols. You can do so by compiling it in debug mode.
    2. Run your program form the terminal as follows: "valgrind --tool=callgrind ./your_program your_options"
    3. View the results by invoking "kcachegrind callgrind.out.****", where **** is the process ID displayed by valgrind in the previous step.

    You will see a nice GUI for analysing where most time is spent in your program. You might have to install the packages for "valgrind" and "kcachegrind" beforehand, however.

  3. #3
    Join Date
    Apr 2012
    Location
    广州
    Beans
    231
    Distro
    Ubuntu Gnome 16.04 Xenial Xerus

    Re: How can I profile my programme in CodeBlocks ?

    Thanks you very much ! I'll try it !

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •