I'm writing STL-only C++ application on mac(OS X Lion / XCode 4.1). I need to answer a simple question: which parts of code must be optimized? Gprof does empty output, XCode's Instruments doesn't help. Which tool I need to use?
Asked
Active
Viewed 6,788 times
7
-
What do you mean by "empty output"? I think maybe your question should be "How do I get gprof to work?" – Oliver Charlesworth Aug 07 '11 at 19:35
-
Looks like http://pastebin.com/EUhfSmLa – sashab Aug 07 '11 at 19:39
-
1Instruments works very well for me. – LaC Aug 07 '11 at 20:05
2 Answers
4
Use Shark. It's in /Developer/Applications/Performance Tools
Very easy to use. More here: http://developer.apple.com/tools/sharkoptimize.html

koan
- 3,596
- 2
- 25
- 35
-
1This solution is obsolete, unfortunately. Shark has been replaced with Instruments (http://stackoverflow.com/a/8349036/130427). Instruments does not appear to be able to reference specific function calls the way Shark could. – Chris Redford May 04 '12 at 22:32
0
Even if gprof were working, it would probably not be much help.
The method I rely on, for any language and OS, is random pausing.
Here's how it works. If you take several random-time samples of the stack, wasteful function calls or I/O appear in proportion to the fraction of time they waste. It has the advantage that problematic statements are pinpointed, as opposed to making you hunt within costly routines.

Community
- 1
- 1

Mike Dunlavey
- 40,059
- 14
- 91
- 135