mozilla
Your Search Results

    Setting up jprof

    Jprof is a profiling tool for Linux. To use it, one needs to build mozilla with special build options.

    Checking it out

    Since jprof isn't part of the default build, you'll need to explicitly check out its source:

    cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/tools/jprof
    

    Setting up mozconfig

    In order to enable jprof, you'll need to add

    ac_add_options --enable-jprof
    

    to your mozconfig file. Note that if you're going to be profiling stuff, it's good to have an optimized (--enable-optimize --disable-debug) build. Also, jprof needs symbols to operate, so you must not have --enable-strip in your mozconfig.

    For more information about configuring your build, see Configuring Build Options.

    Building

    After you've checked out the source and set up a mozconfig file, you should be able to run

     make -f client.mk build
    

    and have a build ready to profile with. See the jprof README for information on how to use jprof.

    Tackling build errors

    Missing bfd.h

    When compiling bfd.cpp you may get the following error:

     error: bfd.h: No such file or directory
    

    You will need to download the package which has the bfd.h header file in it. This is usually in the binutils development package on most platforms.

    Linking error with libmalloc.o

    When linking all the files together you may get this error:

     libmalloc.o: In function `DumpAddressMap()':libmalloc.cpp:(.text+0x252): undefined reference to `_r_debug'
     collect2: ld returned 1 exit status
    

    In order to fix this, the following line must be added to Makefile.in in mozilla/tools/jprof/stub/:

     EXTRA_DSO_LDOPTS += /lib/ld-linux.so.2
    

    Credits

    Much of this information was taken from the jprof README and a blog post by Gijs Kruitbosch (Hannibal).

    Document Tags and Contributors

    Contributors to this page: Nickolay, Bzbarsky, Ispiked
    Last updated by: Nickolay,