opcontroltool and the new
operftool are mutually exclusive.
- Displays available events for the system’s processor along with a brief description of each.
- Intended to replace
operftool uses the Linux Performance Events subsystem, allowing you to target your profiling more precisely, as a single process or system-wide, and allowing OProfile to co-exist better with other tools using the performance monitoring hardware on your system. Unlike
opcontrol, no initial setup is required, and it can be used without the root privileges unless the
--system-wideoption is in use.
- Converts sample database files from a foreign binary format to the native format for the system. Only use this option when analyzing a sample database from a different architecture.
- Creates an annotated source for an executable if the application was compiled with debugging symbols.
- Retrieves profile data.
- This tool is used to start and stop the OProfile daemon (
oprofiled) and configure a profile session.
- Runs as a daemon to periodically write sample data to disk.
oprofiled, and post-processing tools) remains available, but it is no longer the recommended profiling method. For a detailed description of the legacy mode, see the Configuring OProfile Using Legacy Mode chapter in the System Administrator's Guide.
5.2.1. Using OProfile
operfis the recommended tool for collecting profiling data. The tool does not require any initial configuration, and all options are passed to it on the command line. Unlike the legacy
operfcan run without
rootprivileges. See the Using operf chapter in the System Administrator's Guide for detailed instructions on how to use the
Example 5.1. Using operf to Profile a Java Program
operftool is used to collect profiling data from a Java (JIT) program, and the
opreporttool is then used to output per-symbol data.
- Install the demonstration Java program used in this example. It is a part of the java-1.8.0-openjdk-demo package, which is included in the Optional channel. See Enabling Supplementary and Optional Repositories for instructions on how to use the Optional channel. When the Optional channel is enabled, install the package:
yum install java-1.8.0-openjdk-demo
- Install the oprofile-jit package for OProfile to be able to collect profiling data from Java programs:
yum install oprofile-jit
- Create a directory for OProfile data:
- Change into the directory with the demonstration program:
- Start the profiling:
operf -d ~/oprofile_data appletviewer \
- Change into the home directory and analyze the collected data:
opreport --symbols --threshold 0.5A sample output may look like the following:
$ opreport --symbols --threshold 0.5 Using /home/rkratky/oprofile_data/samples/ for samples directory. WARNING! Some of the events were throttled. Throttling occurs when the initial sample rate is too high, causing an excessive number of interrupts. Decrease the sampling frequency. Check the directory /home/rkratky/oprofile_data/samples/current/stats/throttled for the throttled event names. warning: /dm_crypt could not be found. warning: /e1000e could not be found. warning: /kvm could not be found. CPU: Intel Ivy Bridge microarchitecture, speed 3600 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000 samples % image name symbol name 14270 57.1257 libjvm.so /usr/lib/jvm/java-1.8.0-openjdk-220.127.116.11-1.b16.el7_1.x86_64/jre/lib/amd64/server/libjvm.so 3537 14.1593 23719.jo Interpreter 690 2.7622 libc-2.17.so fgetc 581 2.3259 libX11.so.6.3.0 /usr/lib64/libX11.so.6.3.0 364 1.4572 libpthread-2.17.so pthread_getspecific 130 0.5204 libfreetype.so.6.10.0 /usr/lib64/libfreetype.so.6.10.0 128 0.5124 libc-2.17.so __memset_sse2