tags:

views:

68

answers:

4

I am writing a C project. Now I just doubt one function in the whole project may be take the most of computational complexity. If I can make sure about this, I can further improve this function with a more clear target.

Or, is there any tools for this usage?? I mean to find the most "expensive" function in the whole program or project??

Any advices? Thanks!

+3  A: 
Jeff Foster
+2  A: 

In general, it is impossible for any tool to find that out through statical analysis. Because if we could, we could also solve the halting problem.

Profilers allow you to analyse how the program behaves when run (against the input used then). This should be good enough for any real-world scenarios.

ammoQ
+4  A: 

The gprof profiler comes with the GCC compiler suite. Theres a manual for it here.

anon
A: 

Try Source Monitor, a free tool that measures complexity, found here

Thomas Matthews