7

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?

sashab
  • 1,534
  • 2
  • 19
  • 36

2 Answers2

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
  • 1
    This 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