LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C profiler tool like in matlab? (https://www.linuxquestions.org/questions/programming-9/c-profiler-tool-like-in-matlab-279224/)

jnusa 01-18-2005 05:49 AM

C profiler tool like in matlab?
 
I was wondering is there's a profiler tool, that can benchmark a C program and give info like execution time, divided between function, resource consumtion ect. I've done a lot of programming in Matlab, and the profiler tool there is very helpfull, to see which areas of your program isn't very effective.

jnusa

leonscape 01-18-2005 05:53 AM

Have a look at Valgrind its a memory debugger and profiler.

jnusa 01-18-2005 06:16 AM

Hmm... looks very usefull. Gave me a lot of thinks I need to correct :). Doesn't seem to be able to benchmark your program though?!

bahramH 01-18-2005 06:29 AM

Profiling is included in any "respectable" compiler. In C, compile your program with the -p option, and then, after executing your program, use "prof" to see the profile.
If you're using gcc, use the -pg option and "gprof". and have a look at the man page of gprof.

leonscape 01-18-2005 06:29 AM

Try GProf Also there is KCachegrind which is based on Valgrind but does more and has a good interface.

jnusa 01-18-2005 07:42 AM

Uhhh.... thank you so much leonscape. kCachegrind is pretty awesome... just what I needed. For future reference.... needs to install valgrind, valgrind-callgrind and kcachegrind to make it work.

[EDIT]
missed your post bahramH. Sounds great.. I'll try to add those compiler options-
[/EDIT]


All times are GMT -5. The time now is 05:14 PM.