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:firstname.lastname@example.org:/cvsroot co mozilla/tools/jprof
Setting up mozconfig
In order to enable jprof, you'll need to add
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.
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
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
EXTRA_DSO_LDOPTS += /lib/ld-linux.so.2