How to use MOZILLA_GPROF
(Courtesy djw@avantgo.com)

mcafee had this close to compiling on Solaris 2.5.1 on 7 October 1998.
The changes djw made to the xfe will have to be reapplied to NGLayout.

So you want to know why something is slow?
Want to know what the !#@#$!! thing is doing?

Read on...

I've just checked in a relatively easy to use gmon/gprof based profiler into the tree. You can start the profiler, stop the profiler, reset the profiler, etc... right from your very own browser, or editor, or mail/news,...... (there is a menu based interface to the profiler under the Help menu). The best part is you can get a HTML profile report printed into your browser! I've attached a sample. It's the top 100 functions that are exercised during startup.

The report shows the time spent in each function, sorted from highest to lowest. It also shows the executation "arcs" - foo called bar called zoo, and we did this 30% of the time.

I'll be writing up more detailed info, but for now, if you want to try it:

  1. Get you to a Sun box (sorry, this stuff is extremely platform specific, SGI coming).
  2. Pull a tree, or update, whatever (my changes are in cmd/xfe and cmd/xfe/src).
  3. Set MOZILLA_GPROF in your environment or myconfig.mk
  4. Rebuild everything (MOZILLA_GPROF sets a special compile option)
  5. Preferably build netscape-export
  6. Run and enjoy (hint: look under the Help menu).
  7. Check out the (somewhat dry) man page for gprof(1), it'll help interpret the report.

With the profiler running there is slight performance slowdown (maybe 5-10%).

By default, the profiler is running at startup. You can set the initial state to off using:

    setenv MOZILLA_GPROF "running=false"

An optimized build (with DEBUG not set) will give you the most accurate data, but you can build MOZILLA_GPROF and -g just fine. It'll run just a little slower.

mcafee@netscape.com