prakash prakash -3 years ago 114
C Question

How do you profile your code?

I hope not everyone is using

Rational Purify
.

So what do you do when you want to measure:


  • time taken by a function

  • peak memory usage

  • code coverage



At the moment, we do it manually [using log statements with timestamps and another script to parse the log and output to excel. phew...)

What would you recommend? Pointing to tools or any techniques would be appreciated!

EDIT: Sorry, I didn't specify the environment first, Its plain
C
on a proprietary mobile
platform

Answer Source

You probably want different tools for performance profiling and code coverage.

For profiling I prefer Shark on MacOSX. It is free from Apple and very good. If your app is vanilla C you should be able to use it, if you can get hold of a Mac.

For profiling on Windows you can use LTProf. Cheap, but not great: http://successfulsoftware.net/2007/12/18/optimising-your-application/

(I think Microsoft are really shooting themself in the foot by not providing a decent profiler with the cheaper versions of Visual Studio.)

For coverage I prefer Coverage Validator on Windows: http://successfulsoftware.net/2008/03/10/coverage-validator/ It updates the coverage in real time.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download