After reading through Apples documentation I tried out Shark this evening. I’m not sure where the bottle-neck is (or if there is any useful information there that I don’t understand). I don’t really see any of my function calls and whatnot near the top as hot-spots, but I suspected that the bottleneck has to do with painting, although Im starting to doubt that. I don’t do anything fancy, just make use of quite a bit of lines (g.drawVerticalLine), and rects/rounded rectangles (g.fillRoundedRectangle).
When I start my app, it idles aroun 5% CPU in Activity Monitor, not too bad. Adding an Audio Recorder object jumps the CPU up to around 15%, even if I am not painting the wavform display. Adding other kinds of recorder objects has similar cpu hits, adding about 10% cpu usage per item. I commented out any of the fills and shapes on the objects and they still have about 10% cpu hits per item. As you can imagine, im often in the scenario where I need to record using at least 5-10 of my objects, so that easily puts me in the 50%-90% CPU usage range, and although the app runs, certain things can start to feel sluggish (e.g. dragging recorder objects around and repositioning them on screen).
Any tips? Ill keep playing around with Instruments and Shark… thanks
Heres a screenshot of shark output - http://dl.dropbox.com/u/11427810/Screen%20shot%202011-08-12%20at%206.54.03%20PM.png
and one of my app’s gui - http://dl.dropbox.com/u/11427810/Screen%20shot%202011-08-12%20at%206.58.17%20PM.png