Where’s that “Profiling Code For Dummies” book?

A couple years ago, I was handed a task I did not know how to do: profile a corporate application and see where the code is spending most of its time. I had a professional tool (Quantify) available to help me do it. It took me weeks to figure out how to use it at a basic level, just enough to confirm what we already suspected: that the bottleneck wasn’t in Mozilla code.

Yesterday, while working with some experimental code, I hit a new perf issue that absolutely should not be happening. (Bug 362694 for anyone interested.) Profiling and performance analysis is something I do so infrequently that I never took the time to really learn how to do it.

Ultimately, I found that there are a lot of free tools available to help me gather data… but this is worse than useless for me because I can’t figure out what the data is saying. PEBKAC. Someone suggested Shark to me for the Mac platform, but I found Shark didn’t capture anything from my XULRunner app. I’m not blaming Shark; I just don’t know how to use it.

So I wouldn’t mind a good written tutorial in profiling analysis from start to finish for Mozilla code. Particularly under the constraint of free or inexpensive tools. I’d write it if I had a clue what I was doing.

3 thoughts on “Where’s that “Profiling Code For Dummies” book?”

  1. There’s this on MDC:
    http://developer.mozilla.org/en/docs/Setting_up_jprof
    Seems JProf requires you to build Mozilla specially for it to work, and I have no idea how current it is.
    I’ve poked around OProfile as well, and it doesn’t seem to require you to recompile the application you want to profile unless you want annotated source and such things.
    http://oprofile.sourceforge.net/
    Haven’t used either of the two tools, I just Googled a bit when I read about your predicament.

  2. I’m actually rather surprised Shark didn’t catch anything… I’ve found it to be very intuitive to use in a basic way, and very powerful once you move beyond that.
    Try ‘sample AppName 10’ in a Terminal window and see if that catches anything. I hate reading Sampler output, but it’d at least be a datapoint.

  3. Shark should catch data. I’ve used it to fix perf issues in Camino in before. It’s extremely simple to run.
    The part that gets more complex is analyzing the data (naturally). There’s a tutorial in the Help menu in Shark that’ll give you some tips for that.
    /H�kan

Comments are closed.