Chapter 40. OProfile
opannotate --search-dirs <src-dir> --source <executable>
The directory containing the source code and the executable to be analyzed must be specified. Refer
to the opannotate man page for a list of additional command line options.
40.6. Understanding /dev/oprofile/
The /dev/oprofile/ directory contains the file system for OProfile. Use the cat command to
display the values of the virtual files in this file system. For example, the following command displays
the type of processor OProfile detected:
cat /dev/oprofile/cpu_type
A directory exists in /dev/oprofile/ for each counter. For example, if there are 2 counters, the
directories /dev/oprofile/0/ and dev/oprofile/1/ exist.
Each directory for a counter contains the following files:
• count — The interval between samples.
• enabled — If 0, the counter is off and no samples are collected for it; if 1, the counter is on and
samples are being collected for it.
• event — The event to monitor.
• kernel — If 0, samples are not collected for this counter event when the processor is in kernel-
space; if 1, samples are collected even if the processor is in kernel-space.
• unit_mask — Defines which unit masks are enabled for the counter.
• user — If 0, samples are not collected for the counter event when the processor is in user-space; if
1, samples are collected even if the processor is in user-space.
The values of these files can be retrieved with the cat command. For example:
cat /dev/oprofile/0/count
40.7. Example Usage
While OProfile can be used by developers to analyze application performance, it can also be used by
system administrators to perform system analysis. For example:
• Determine which applications and services are used the most on a system — opreport can be
used to determine how much processor time an application or service uses. If the system is used for
multiple services but is under performing, the services consuming the most processor time can be
moved to dedicated systems.
• Determine processor usage — The CPU_CLK_UNHALTED event can be monitored to determine the
processor load over a given period of time. This data can then be used to determine if additional
processors or a faster processor might improve system performance.
362
Need help?
Do you have a question about the ENTERPRISE LINUX 4 and is the answer not in the manual?