此内容没有您所选择的语言版本。

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.

Table 14.1. Tools Distributed with OProfile for Red Hat Developer Toolset
NameDescription

operf

Records samples either for a single process or system-wide using the Linux Performance Events subsystem.

opannotate

Generates an annotated source file or assembly listing from the profiling data.

oparchive

Generates a directory containing executable, debug, and sample files.

opgprof

Generates a summary of a profiling session in a format compatible with gprof.

ophelp

Displays a list of available events.

opimport

Converts a sample database file from a foreign binary format to the native format.

opjitconv

Converts a just-in-time (JIT) dump file to the Executable and Linkable Format (ELF).

opreport

Generates image and symbol summaries of a profiling session.

ocount

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'
Note

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

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.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.