You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Using hiprof on Mozilla under Digital Unix


Instrumentation

Hiprof is a profiler built around the ATOM tool available under Digital Unix. I believe that ATOM and Hiprof are a standard part of Digital Unix 4.0, so if you are developing under Digital Unix you should have them. ATOM tools work by taking a non-stripped executable and generating a new executable which can analyze itself as it runs. This process is pretty simple for a statically linked executable which does not load any shared libraries at runtime. It gets a little more complicated when dealing with dynamically linked executables which also do runtime loading.

Scripts

I have put together a couple of scripts which take care of all this. Both of these scripts are meant to be run from the top of your build tree. The first script, hiprofme is used to create the instrumented executable. The second script, gprofme, is used to analyze the data produced when the instrumented executable is run.

Right now they are very dependent on the specific environment that I use. I would like to fix that in the future, but for right now you will have to edit them to reflect your environment. My environment is shown below. Note that I do not build in the source tree. I don't think you would have a problem if you did, I just don't.

    /group/jlnance/tmp is --prefix for glib, gtk, nspr, and IDL.
    /group/jlnance/tmp/src/mozilla is the top of the mozilla source.
    /group/jlnance/tmp/src/bm is where I build the source.
    /group/jlnance/tmp/atomlibs is where I store instrumented shared libs.

Running

To use all this first build apprunner. Then create the atomlibs directory and run the hiprofme script. You should now have an executable called dist/bin/apprunner.hiprof. Now run it:
    pushd dist/bin
    setenv LD_LIBRARY_PATH /group/jlnance/tmp/atomlibs
    ./apprunner.hiprof
    popd
When I ran it I had a little problem getting it to quit. When I selected the quit menu, it would take down the window, but then it would hang. I just killed it with ^C after a few seconds and this did not seem to hurt anything. Now you can run the gprofme script, and it will dump out a profile. I have a script called gprof2html to convert the profile into html. To run it do:
gprofme | awk -f gprof2html >gprof.html

Advanced

Hiprof is a very nice profiler. It allows you to combine profiles from multiple runs, dump profile information from a running process with out killing it, and to profile only part of a run. These scripts are meant as starting points rather than as the definitive way to use the tools. If you get the scripts working, I would encourage you to read more about hiprof and other ATOM tools: