I am new to Mac OSX, and I wonder if Xcode can generate , for 开发者_Python百科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
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.
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.
精彩评论