Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 14. OProfile
OProfile is a low overhead, system-wide profiler that uses the performance-monitoring hardware on the processor to retrieve information about the kernel and executables on the system, such as when memory is referenced, the number of level 2 cache (L2) requests, and the number of hardware interrupts received. It consists of a configuration utility, a daemon for collecting data, and a number of tools that can be used to transform the data into a human-readable form. For a complete list of tools that are distributed with the Red Hat Developer Toolset version of OProfile, see Table 14.1, “Tools Distributed with OProfile for Red Hat Developer Toolset”.
OProfile profiles an application without adding any instrumentation by recording the details of every nth event. This allows it to consume fewer resources than Valgrind, but it also causes its samples to be less precise. Unlike Valgrind, which only collects data for a single process and its children in user-space, OProfile is well suited to collect system-wide data on both user-space and kernel-space processes, and requires root
privileges to run.
Red Hat Developer Toolset is distributed with OProfile 1.4.0.
Name | Description |
---|---|
| Records samples either for a single process or system-wide using the Linux Performance Events subsystem. |
| Generates an annotated source file or assembly listing from the profiling data. |
| Generates a directory containing executable, debug, and sample files. |
|
Generates a summary of a profiling session in a format compatible with |
| Displays a list of available events. |
| Converts a sample database file from a foreign binary format to the native format. |
| Converts a just-in-time (JIT) dump file to the Executable and Linkable Format (ELF). |
| Generates image and symbol summaries of a profiling session. |
| A new tool for counting the number of times particular events occur during the duration of a monitored command. |
14.1. Installing OProfile
In Red Hat Developer Toolset, OProfile is provided by the devtoolset-12-oprofile package and is automatically installed with devtoolset-12-perftools as described in Section 1.5, “Installing Red Hat Developer Toolset”.
14.2. Using OProfile
To run any of the tools that are distributed with OProfile:
# scl enable devtoolset-12 'tool option...'
See Table 14.1, “Tools Distributed with OProfile for Red Hat Developer Toolset” for a list of tools that are distributed with OProfile. For example, to use the ophelp
command to list available events in the XML format:
$ scl enable devtoolset-12 'ophelp -X'
Note that you can execute any command using the scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset OProfile as default:
$ scl enable devtoolset-12 'bash'
To verify the version of OProfile you are using at any point:
$ which operf
Red Hat Developer Toolset’s operf
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset OProfile:
# operf --version
14.3. Additional Resources
For more information about OProfile and its features, see the resources listed below.
Installed Documentation
oprofile(1) — The manual page named oprofile provides an overview of OProfile and available tools. To display the manual page for the version included in Red Hat Developer Toolset:
$
scl enable devtoolset-12 'man oprofile'
opannotate(1), oparchive(1), operf(1), opgprof(1), ophelp(1), opimport(1), opreport(1) — Manual pages for various tools distributed with OProfile provide more information on their respective usage. To display the manual page for the version included in Red Hat Developer Toolset:
scl enable devtoolset-12 'man tool'
Online Documentation
- Red Hat Enterprise Linux 7 Developer Guide — The Developer Guide for Red Hat Enterprise Linux 7 provides more information on OProfile.
-
Red Hat Enterprise Linux 7 System Administrator’s Guide — The System Administrator’s Guide for Red Hat Enterprise Linux 7 documents how to use the
operf
tool.
See Also
- Chapter 1, Red Hat Developer Toolset — An overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 12, SystemTap — An introduction to SystemTap and instructions on how to use it to monitor the activities of a running system.
- Chapter 13, Valgrind — Instructions on using the Valgrind tool to profile applications and detect memory errors and memory management problems, such as the use of uninitialized memory, improper allocation and freeing of memory, and the use of improper arguments in system calls.
- Chapter 15, Dyninst — Instructions on using the Dyninst library to instrument a user-space executable.