views:

262

answers:

2

Hi,

I am new to Mac OSX, and I wonder if Xcode can generate , for a given C++ source code, the call graph of the program in a visual way.

I also wonder if for each function, and after a run, whether it can also print the %time spent on the function

If so, I would thank really some links with tutorials or info, after googling I did not find anything relevant

Thanks

A: 

I'm not sure about drawing a call graph but for profiling you should look for Shark, which is part of the XCode developer bundle. Check out developer.apple.com/mac for documentation.

High Performance Mark
A: 

Use Run->Run With Performance Tool->Time Profiler to launch the app in Instruments.app. Instruments uses Dtrace under the hood and provides a huge wealth of profiling and measurement tools. The Time Profiler template will get you time profile and call stacks, but I don't think there is any way to get a call graph for the entire execution (though there's so much in Instruments, I may easily be wrong).

Shark is an older profiling tool from Apple and provides some very nice optimization hints. In general, you should start with Instruments and use Shark only if needed for optimizing.

Barry Wark
thanks, it looks very promising, i will have a look at it
Werner