feelfree
feelfree

Reputation: 11763

Which tool can I use to trace the each function's efficiency in a C++ program?

I am now developing a relatively large C++ program, which is composed of several functions. The C++ program will run these functions sequentially. What I want to know is how much time and how much memory each function would occupy. For the time consumption one solution is use the BOOST::Timer library. For the memory usage, however, I cannot find right library to do the job. I was wondering whether you have some ideas on this question. Moreover, does someone know some tools that can create a program efficiency report similar to MATLAB profile? Thanks!

Upvotes: 0

Views: 76

Answers (1)

Jan Spurny
Jan Spurny

Reputation: 5537

You didn't specify your OS or compiler. What you want is generally known as a profiler. Using timer for profiling is not a good idea. For memory profiling look for "heap-profiler".

If available for your platform, I'd recomend valgrind's massif heap-profiler and optionally massif-visualizer.

http://valgrind.org/docs/manual/ms-manual.html

http://gitorious.org/massif-visualizer

Upvotes: 2

Related Questions