Setting up jprof

  • Revision slug: Setting_up_jprof
  • Revision title: Setting up jprof
  • Revision id: 187149
  • Created:
  • Creator: Ispiked
  • Is current revision? No
  • Comment

Revision Content

Checking it out

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

 cvs 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 build. Also, jprof needs symbols to operate, so you must not have --enable-strip in your mozconfig.

Building

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

 make -f client.mk build

and end up with a build ready to profile with. But, you may run into some problems.

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 binutils-dev package in order to get this header file.

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

Compile errors on x86_64 Linux

In order to be able to compile jprof on 64-bit Linux, the patches in {{template.Bug(349166)}} must be applied.

Revision Source

<h3 name="Checking_it_out"> Checking it out </h3>
<p>Since jprof isn't part of the default build, you'll need to explictly check out its source:
</p>
<pre class="eval"> cvs co mozilla/tools/jprof
</pre>
<h3 name="Setting_up_mozconfig"> Setting up mozconfig </h3>
<p>In order to enable jprof, you'll need to add
</p>
<pre class="eval"> ac_add_options --enable-jprof
</pre>
<p>to your mozconfig file. Note that if you're going to be profiling stuff, it's good to have an optimized build. Also, jprof needs symbols to operate, so you must <b>not</b> have <code>--enable-strip</code> in your mozconfig.
</p>
<h3 name="Building"> Building </h3>
<p>After you've checked out the source and set up a mozconfig file, you should be able to do
</p>
<pre class="eval"> make -f client.mk build
</pre>
<p>and end up with a build ready to profile with. But, you may run into some problems.
</p>
<h3 name="Tackling_build_errors"> Tackling build errors </h3>
<h4 name="Missing_bfd.h"> Missing bfd.h </h4>
<p>When compiling <code>bfd.cpp</code> you may get the following error:
</p>
<pre class="eval"> error: bfd.h: No such file or directory
</pre>
<p>You will need to download the binutils-dev package in order to get this header file.
</p>
<h4 name="Linking_error_with_libmalloc.o"> Linking error with libmalloc.o </h4>
<p>When linking all the files together you may get this error:
</p>
<pre class="eval"> libmalloc.o: In function `DumpAddressMap()':libmalloc.cpp:(.text+0x252): undefined reference to `_r_debug'
 collect2: ld returned 1 exit status
</pre>
<p>In order to fix this, the following line must be added to <code>Makefile.in</code> in <code>mozilla/tools/jprof/stub/</code>:
</p>
<pre class="eval"> EXTRA_DSO_LDOPTS += /lib/ld-linux.so.2
</pre>
<h4 name="Compile_errors_on_x86_64_Linux"> Compile errors on x86_64 Linux </h4>
<p>In order to be able to compile jprof on 64-bit Linux, the patches in {{template.Bug(349166)}} must be applied.
</p>
Revert to this revision