Pages

Thursday, March 1, 2012

OProfile: System / JIT Profiling on Linux

Requirements
  • Oprofile tar
  • kernel-debuginfo-`uname -r`.rpm
  • kernel-debuginfo-commons-`uname -r`.rpm
Setup

Install kernel-debuginfo rpms for the kernel you are running.

As root user:
$ tar zvxf oprofile-0.9.7.tar
$ cd oprofile-0.9.7
CFLAGS="-m64" CXXFLAGS="-m64" ./configure \
   --with-java={my_jdk_installdir} \
   --libdir=/usr/local/lib64
Ensure that configure has passed, otherwise resolve any issues with missing headers and libraries and rerun configure as above. One common issue people run into on RHEL 5:
checking libiberty.h usability... no
checking libiberty.h presence... no
checking for libiberty.h... no
checking for cplus_demangle in -liberty... no Solution: Install binutils-devel rpm 
$ make
$ make install
Profiling JIT
For JIT profiling, the following option needs to be added to the Java command-line:
-agentpath:<libdir>/libjvmti_oprofile.so
OR
-agentlib:jvmti_oprofile
 
Also, add <oprof_install_dir>/lib/oprofile to LD_LIBRARY_PATH
 
[See Ref  

Collection
$ opcontrol --reset
$ opcontrol --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux
$ opcontrol --session-dir=$DIR
$ opcontrol --start
$ opcontrol --stop
$ opcontrol --dump
$ opcontrol --save <session-name>
$ opcontrol --shutdown

Report
$ opreport session:<session-name>
$ opreport session:<session-name> --image-path /lib/modules/`uname -r`/kernel [--details | -d]
$ opreport session:<session-name> --image-path /lib/modules/`uname -r`/kernel [--symbols | -l]
$ opreport session:<session-name> [--callgraph | -c]

References

No comments:

Post a Comment