이 콘텐츠는 선택한 언어로 제공되지 않습니다.

5.2. OProfile


OProfile is a low overhead, system-wide performance monitoring tool provided by the oprofile package. It 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 second-level cache requests, and the number of hardware interrupts received. OProfile is also able to profile applications that run in a Java Virtual Machine (JVM).
The following is a selection of the tools provided by OProfile. Note that the legacy opcontrol tool and the new operf tool are mutually exclusive.
ophelp
Displays available events for the system’s processor along with a brief description of each.
operf
Intended to replace opcontrol. The operf tool 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-wide option is in use.
opimport
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.
opannotate
Creates an annotated source for an executable if the application was compiled with debugging symbols.
opreport
Retrieves profile data.
opcontrol
This tool is used to start and stop the OProfile daemon (oprofiled) and configure a profile session.
oprofiled
Runs as a daemon to periodically write sample data to disk.
Legacy mode (opcontrol, 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

operf is 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 opcontrol tool, operf can run without root privileges. See the Using operf chapter in the System Administrator's Guide for detailed instructions on how to use the operf tool.

Example 5.1. Using operf to Profile a Java Program

In the following example, the operf tool is used to collect profiling data from a Java (JIT) program, and the opreport tool is then used to output per-symbol data.
  1. 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
  2. Install the oprofile-jit package for OProfile to be able to collect profiling data from Java programs:
    ~]# yum install oprofile-jit
  3. Create a directory for OProfile data:
    ~]$ mkdir ~/oprofile_data
  4. Change into the directory with the demonstration program:
    ~]$ cd /usr/lib/jvm/java-1.8.0-openjdk/demo/applets/MoleculeViewer/
  5. Start the profiling:
    ~]$ operf -d ~/oprofile_data appletviewer \
    -J"-agentpath:/usr/lib64/oprofile/libjvmti_oprofile.so" example2.html
  6. Change into the home directory and analyze the collected data:
    ~]$ cd
    ~]$ opreport --symbols --threshold 0.5
    A 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-1.8.0.51-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
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.