First you need to build OProfile and install it. ./configure, make, make install is often all you need, but note these arguments to ./configure :
--with-java
Use this option if you need to profile Java applications. Also, see Section 5, “System requirements”, "Required user account". This option is used to specify the location of the Java Development Kit (JDK) source tree you wish to use. This is necessary to get the interface description of the JVMPI (or JVMTI) interface to compile the JIT support code successfully.
The Java Runtime Environment (JRE) does not include the development files that are required to compile the JIT support code, so the full JDK must be installed in order to use this option.
By default, the Oprofile JIT support libraries will be installed in
<oprof_install_dir>/lib/oprofile
. To build
and install OProfile and the JIT support libraries as 64-bit, you can
do something like the following:
# CFLAGS="-m64" CXXFLAGS="-m64" ./configure \ --with-java={my_jdk_installdir} \ --libdir=/usr/local/lib64 |
If you encounter errors building 64-bit, you should install libtool 1.5.26 or later since that release of libtool fixes known problems for certain platforms. If you install libtool into a non-standard location, you'll need to edit the invocation of 'aclocal' in OProfile's autogen.sh as follows (assume an install location of /usr/local):
aclocal -I m4 -I /usr/local/share/aclocal
--disable-werror
Development versions of OProfile build by
default with -Werror
. This option turns
-Werror
off.
--disable-optimization
Disable the -O2
compiler flag
(useful if you discover an OProfile bug and want to give a useful
back-trace etc.)
--with-kernel
This option is used to specify the location of the kernel headers include
directory
needed to build the perf_events-enabled operf program. By default, the OProfile
build system expects to find this directory under /usr
. Use this option if your
kernel headers are in a non-standard location or if building in a cross-compile enviroment or in a
situation where the host system does not support perf_events but you wish to build binaries for a
target system that does support perf_events.
It is recommended that if you have a uniprocessor machine, you enable the local APIC / IO_APIC support for your kernel (this is automatically enabled for SMP kernels). With many BIOS (kernel >= 2.6.9 and UP kernel) it's not sufficient to enable the local APIC -- you must also turn it on explicitly at boot time by providing the "lapic" option to the kernel. If you use the NMI watchdog, be aware that the watchdog is disabled when profiling starts and not re-enabled until the profiling is stopped.