Help save net neutrality! Learn more.

oprofile Log

Commit Date  
[ed40d8] by William Cohen William Cohen , pushed by Maynard Johnson Maynard Johnson

Print unit mask name where applicable in ophelp XML output

Some Intel architectures have named unit masks and it would be useful
to include the unit mask name in the XML output. This patch also
updates the ophelp.xsd schema file to include the optional unit
mask 'name' field.

Signed-off-by: William Cohen <>

2014-01-28 17:05:46 Tree
[be6d22] by Maynard Johnson Maynard Johnson

Fix issues detected by Coverity

Will Cohen ran Coverity against oprofile and reported some issues
on Nov 20, 2013. I submitted the current oprofile source to the
Coverity webpage, and a couple new issues were detected. This
patch addresses most of these issues. Some issues are either
false positives from Coverity's analysis or have been marked
as "Intentional" so as to have Coverity ignore them.

Signed-off-by: Maynard Johnson <>

2014-01-27 21:44:18 Tree
[d6ca28] by Maynard Johnson Maynard Johnson

Reduce overhead of operf waiting for profiled app to end

The original implementation was very inefficient in how operf
waited for the profiled app to end. We reduce much of the overhead
by doing a nanosleep for 100 ms, waking up, checking the status
of the app (via waitpid), and going back to sleep again if the app
is still running.

Signed-off-by: Maynard Johnson <>

2014-01-24 23:07:10 Tree
[65176c] by Maynard Johnson Maynard Johnson

Fix regression in IBM POWER8 running in POWER7 compat mode

A commit made on Dec 17, 2013 ("Allow all native events for IBM POWER8
in POWER7 compat mode) broke support for POWER8 in POWER7 compat mode.
Instead, oprofile attempts to treat it as a normal POWER7 processor,
which is not correct. A user reported the following error when
running operf with the default CYCLES event:

terminate called after throwing an instance of 'std::runtime_error'
what(): libpfm cannot find event code for CYCLES; cannot continue

This patch fixes this problem.

Signed-off-by: Maynard Johnson <>

2014-01-21 20:43:02 Tree
[1c1636] by Maynard Johnson Maynard Johnson

Minor man page cleanups for the ocount command

Signed-off-by: Maynard Johnson <>

2014-01-17 22:52:45 Tree
[d0eb98] by Leonid Moiseichuk Leonid Moiseichuk , pushed by Maynard Johnson Maynard Johnson

Add minimal (armv7-common) support for ARMv7 Krait

Just common ARM PMU events are supported with this patch due
to lack of available documentation.

Other developers reports that operf also works nice.
Tested on device and using "make distcheck".
Signed-off-by: Leonid Moiseichuk <>

2014-01-10 15:13:28 Tree
[e3edba] by Maynard Johnson Maynard Johnson

Whitespace fix in from previous commit

Signed-off-by: Maynard Johnson <>

2014-01-09 21:53:08 Tree
[a265c5] by Maynard Johnson Maynard Johnson

Enable oprofile for new ppc64le architecture

Signed-off-by: Maynard Johnson <>

2014-01-09 21:47:09 Tree
[88ed74] by Maynard Johnson Maynard Johnson

Fix "Unable to open cpu_type file for reading" for IBM POWER7+

Using operf to do profiling on an IBM POWER7+ may result in
the following error message:

Unable to open cpu_type file for reading

This patch fixes the problem. There is also a simple workaround of
running 'opcontrol --init'.

Signed-off-by: Maynard Johnson <>

2014-01-09 21:07:21 Tree
[286f23] by Maynard Johnson Maynard Johnson

Fix compile errors occurring with gcc 4.8.x

Signed-off-by: Maynard Johnson <>

2014-01-08 18:31:24 Tree
[bb56ad] by Maynard Johnson Maynard Johnson

Fix ocount man page and usage regarding counting modes

The ocount tool must be run with one and only one of the following
counting modes:
o system-wide
o process-list
o thread-list
o cpu-list
o command [args]

The ocount man page and usage printout was missing the logical OR
separator ('|') between cpu-list and command modes. This patch
fixes that.

Signed-off-by: Maynard Johnson <>

2014-01-03 15:49:29 Tree
[344bac] by Maynard Johnson Maynard Johnson

Remove unused variable 'tab' from previous commit

Signed-off-by: Maynard Johnson <>

2014-01-02 16:23:45 Tree
[51e615] by Maynard Johnson Maynard Johnson

opreport from 'operf --callgraph' profile shows incorrect recursive calls

When you collect a callgraph profile with operf, the opreport output
incorrectly implies recursive calls. For example, a simple memcpy
testcase that has the following true callchain:
main -> do_my_memcpy -> memcpy (libc)

appears as follows with 'opreport --callgraph' (focusing here just
on the do_my_memcpy callers and callees):

4757 50.0000 memcpyt do_my_memcpy
4757 50.0000 memcpyt main
4757 6.3185 memcpyt do_my_memcpy
4757 49.9842 memcpyt do_my_memcpy
4757 49.9842 memcpyt do_my_memcpy [self]
3 0.0315 no-vmlinux /no-vmlinux

NOTE: Lines above the non-indented line show the callers of do_my_memcpy;
lines below the non-indented line show the callees of do_my_memcpy.
So it appears that do_my_memcpy calls itself, which it does not do.

If I use 'perf record' to get a callgraph profile, the 'perf report'
looks like the following:

6.88% memcpyt memcpyt [.] do_my_memcpy
--- do_my_memcpy

So here, too, it seems to me that do_my_memcpy calls do_my_memcpy.
When I reported this issue to perf/perf_events kernel developers,
I was basically told that this behavior was "by design".

This patch makes an effort to handle this issue by having operf drop
the first address in the callchain if and only if it is the same
address as the second address in the callchain.

Signed-off-by: Maynard Johnson <>

2014-01-02 14:35:17 Tree
[746b5c] by Maynard Johnson Maynard Johnson

Update TODO list

Signed-off-by: Maynard Johnson <>

2013-12-20 15:26:28 Tree
[46a673] by Maynard Johnson Maynard Johnson

Fix sample attribution problem when using multiple events

A serious bug was found that affects operf profiling with
multiple events. Samples for an event may be incorrectly
attributed to another event. For example, profiling on
a Sandybridge laptop with CPU_CLK_UNHALTED and INST_RETIRED
events produces the following summary counts from opreport:

samples| %| samples| %|
32412 100.000 20104 100.000 foo

Using operf to produce separate profiles for these two events
results in these sample counts:

samples| %|
18962 100.000 foo

samples| %|
33464 100.000 foo

This patch fixes the problem.

Signed-off-by: Maynard Johnson <>

2013-12-20 15:10:46 Tree
[f76a07] by Maynard Johnson Maynard Johnson

Fix two makefiles to use -Werror, and fix resulting compiler errors

I discovered that the files in libperf_events and
libpe_utils did not set AM_CXXFLAGS = @OP_CXXFLAGS@, and thus,
the extra -W flags that are added to OP_CXXFLAGS (in
were not being used when building these two directories. Once
I corrected this problem with the makefiles and rebuilt the
source tree, the g++ compiler found a number of minor issues
and ended in error due to the -Werror flag. This patch contains
fixes for the two files, as well as fixes for the
compiler's warnings-turned-to-errors. These were all minor issues
that I'm fairly confident should not have caused any functional
problems. Both manual testing and oprofile testsuite pass
with this patch applied.

Signed-off-by: Maynard Johnson <>

2013-12-19 18:57:14 Tree
[87bf15] by Maynard Johnson Maynard Johnson

Fix operf/opreport kernel throttling detection

With oprofile 0.9.8, the operf command below correctly produces the following
output on an Intel Core 2 Duo/RHEL 6.4 system when using too high of a
sampling rate:

$ operf -e CPU_CLK_UNHALTED:20000 ./memcpyt 200000000
operf: Profiler started
Num iterations passed is 200000000
memcpyt starting with PID 2423
source_address: 7fff689b7003
dest_address: 7fff689b5007
200000000 interations of memcpy(d+7.s+3,65) requires 10.016 seconds
* * * * WARNING: Profiling rate was throttled back by the kernel * * * *
The number of samples actually recorded is less than expected, but is
probably still statistically valid. Decreasing the sampling rate is the
best option if you want to avoid throttling.

Profiling done.

The same operf command using current upstream oprofile (and 0.9.9) produces no
throttling message. But by comparing the number of samples with profile runs
using a lower sampling rate (i.e., count value >=100000 for CPU_CLK_UNHALTED),
I can see that the kernel must be throttling, because we're not collecting
enough samples for the given sampling rate.

Additionally, the opreport command should report when throttling has
occurred for the profile data being analyzed. This enhancement was made
post-0.9.8, but was broken at some point before 0.9.9 was released, so that
this informational message is also now missing from opreport.

This patch fixes both issues (and they were, indeed, separate bugs).

Signed-off-by: Maynard Johnson <>

2013-12-18 20:59:37 Tree
[4f5a0d] by Maynard Johnson Maynard Johnson

Allow all native events for IBM POWER8 in POWER7 compat mode

Certain older Linux distributions will support the new IBM POWER8
processor, but only in a limited mode, since much of the new
kernel code needed to fully support the POWER8 was not backported
to these older distros. This limited mode is referred to as
"POWER7 compat mode" since the kernel can support only the features
that were also available on that earlier IBM processor.

Changes I originally made to support POWER8 assumed that there
would not be full POWER8 performance monitor unit capabilities when
in POWER7 compat mode, and thus, the current oprofile code supports
only a limited subset of POWER8 events (i.e., events which were also
available on the POWER7). However, I've recently been made aware
that these older distros actually do have complete backports of the
POWER8 perf_events kernel subsystem code, making them fully aware of
all POWER8 events. This patch allows operf and ocount to use all
of the POWER8 events, regardless of what mode or distribution we
are running on.

Signed-off-by: Maynard Johnson <>

2013-12-17 22:04:33 Tree
[4f3e25] by Carl Love Carl Love , pushed by Maynard Johnson Maynard Johnson

Fix kallsyms support for callgraph and debug-info opreport options

This patch is a fix for the recent patch to add support for obtaining
the kernel symbols from kallsyms if no vmlinux file was specified. The
opreport tool was seg faulting for the command "opreport -g -l". The
change in file libutil++/op_bfd.cpp and libutil++/bfd_support.h fixes
the segmentation fault by returning when the bfd file is either not
valid or a pseudo BFD. The pseudo BFD is used when the symbols
were obtained from kallsyms rather than from an actul vmlinux file.

A second issue was the symbol name from /proc/kallsyms was not being
printed when "--callgraph" was specified with operf and opreport tools.
The issue was due to calling the wrong bfd constructor when generating
the callgraph information. If the callee or caller image file is
kallsyms, then the kallsyms bfd constructor must be called to obtain the
symbol information. The changes to file libpp/callgraph_container.cpp
fixes this issue.

Changed a comment to consistently refer to the kallsyms BFD file as a
pseudo BFD file rather then a fake BFD file.

Signed-off-by: Carl E. Love <>

2013-12-17 21:29:54 Tree
[a5f539] by Carl Love Carl Love , pushed by Maynard Johnson Maynard Johnson

Add support for getting the Kernel symbols from /proc/kallsyms

This patch reads the /proc/kallsyms file to get the kernel symbols
if the user hasn't specified a vmlinux file.

Signed-off-by: Carl Love <>

2013-12-11 18:05:49 Tree
[726b23] by Maynard Johnson Maynard Johnson

Add explanation of kernel/user bits in event specification

This patch adds a paragraph to the ocount and operf man pages
to explain the kernel/user bits in the event specification.
A few other minor cleanups were done also.

Signed-off-by: Maynard Johnson <>

2013-12-04 17:56:55 Tree
[65bbb3] by Maynard Johnson Maynard Johnson

Add more helpful info about dealing with lost samples

When operf detects that more than a certain percentage of
samples were lost, it displays a warning message when it
stops. This patch adds to that message a suggestion to
lower the sampling rate. This patch also updates the
operf man page with information on how to control the
sampling rate.

Signed-off-by: Maynard Johnson <>

2013-12-03 19:26:59 Tree
[810bb8] by Maynard Johnson Maynard Johnson

Fix spurious "backtraces skipped due to no file mapping" log entries

When using operf to do callgraph profiling, the following message may be

WARNING: Lost samples detected! See .../oprofile_data/samples/operf.log for details.

And in the operf.log, you may see something like:

Nr. backtraces skipped due to no file mapping: 267

A bug in the code is causing most of these "no file mapping" counts.
This patch fixes that problem.

Signed-off-by: Maynard Johnson <>

2013-11-14 22:25:43 Tree
[25c0a6] by Maynard Johnson Maynard Johnson

Fix minor issues found with Eclipse CDT code analysis

The Kepler release of Eclipse/CDT includes a Code Analysis
feature that automatically runs when you open a file in the
CDT editor. Several warning messages are given for various
files, and this patch fixes those issues.

I have not opened *every* file in the oprofile source to
have it analyzed, so there may be other issues found in the
future. I tried analyzing the whole project, but the
function broke with some kind of stack overflow error.
I then tried analyzing a directory, and that seemed to
not work correctly -- identifying things that aren't really

Signed-off-by: Maynard Johnson <>

2013-11-08 17:32:11 Tree
[a339a0] by Maynard Johnson Maynard Johnson

ophelp schema is not included in installed files

A one-line change in doc/ was needed in order for
'make install' to put ophelp.xsd in <installdir>/share/doc/oprofile.

Signed-off-by: Maynard Johnson <>

2013-11-07 14:24:05 Tree
Older >