oprofile Log

Commit Date  
[ad3e04] by Maynard Johnson Maynard Johnson

Fix up problems found by another run of coverity

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-08-08 19:46:05 Tree
[422137] by Maynard Johnson Maynard Johnson

Fix unit mask handling (including 'extra' bits) in operf

This patch handles OR'ing in the unit mask values (and,
where needed, the inv/edge/any/cmask values) into the
event code that is passed to perf_event_open.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-08-06 21:03:36 Tree
[44b633] by Maynard Johnson Maynard Johnson

Cleanup verbose variable usage in operf for easier debugging

This patch removes the "perf_events" verbose option which had
been used to enable debugging for both the recording phase of
profiling (where profile data from the kernel is being read by
the operf-record process) and the conversion phase. Instead,
two new distinct verbose options are introduced: "record" and

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-08-06 00:45:54 Tree
[021390] by Maynard Johnson Maynard Johnson

Add a new option to operf to do conversion to oprofile format after profiling is done

The profile data read from the perf_events kernel has to be converted to OProfile
format for the post-processing tools (e.g., opreport). By default, this conversion
is done on-the-fly during profling using a pipe. This method involves starting an
additional operf process that reads the data fed into the pipe by the operf-record
process. This additional process interprets the perf_events data and does the
conversion to OProfile format, persisting the ususal oprofile sample data files in
<session-dir>/samples/current. When operf is run in single application mode, the
extra overhead of the conversion process running during profiling time is not even
recorded, and thus is not easily noticeable. However, when doing a system-wide
profile, operf overhead can be substantial (easily over 6% on a busy system), and
the samples for operf *are* noticeable in the system-wide report.

This patch introduces the "--lazy-conversion" option which directs operf to write
the perf_events profile data to a temporary file during profiling. Then, after
profiling is done, the data in the temporary file is converted to OProfile format.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-08-06 00:44:22 Tree
[2af280] by Maynard Johnson Maynard Johnson

Fix operf profiling of forked processes

When an application being profiled by operf does a fork, and where
that forked process does *not* do an exec after the fork, any work
performed by the forked process was not being profied. This patch
addresses that problem.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-08-06 00:42:50 Tree
[0cb1a9] by Maynard Johnson Maynard Johnson

Remove extraneous debugging cerr from previous commit

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-26 16:12:13 Tree
[d3c656] by Maynard Johnson Maynard Johnson

Fix operf to read unit mask in hex and document unit mask spec requirementes

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-26 16:02:39 Tree
[4747a7] by Maynard Johnson Maynard Johnson

Fix errors found by coverity in new and changed code in perf_events port

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-25 21:27:39 Tree
[2530d6] by Maynard Johnson Maynard Johnson

Fix warning messages when building on Ubuntu 11.10

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-25 16:20:40 Tree
[152be3] by Maynard Johnson Maynard Johnson

Make git builds use -Werror and fix resulting warning message in operf.cpp

When I merged the perf-events branch, I forgot to change the
"AM_INIT_AUTOMAKE(oprofile, 0.9.8_perf_events)" to
"AM_INIT_AUTOMAKE(oprofile, 0.9.8git)" so that git builds
would use -Werror. Changing this resulted in one warning message
treated as an error due to an unused variable in pe_profiling/operf.cpp.
This patch fixes this warning, along with changing configure.in
to use "0.9.8git".

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-24 11:41:17 Tree
[a30a67] by Maynard Johnson Maynard Johnson

[PATCH] Add some helpful messages for various operf usage scenarios

Added the folowing helpful messages:
- Display message in opreport (and other pp tools) to show session dir used.
- When using operf with "-p" or "-s", print message that user can do "ctrl-C"
or "kill SIGINT <operf_PID> " to stop profiling. The "kill" command is mainly
needed in the case where operf is made a background job via the '&'.
- Display a message when a permissions error is encountered when trying to mmap
the kernel profile data. This can happen when a given user tries to run multiple
instances of operf simultaneously. This problem is fixed on newer kernels (e.g., 3.0).
- For 'operf --system-wide', print a message that either the user needs to be root or
the perf_event_paranoid system value must be 0 or -1. Of course, the message is
printed only if neither of these are true.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-19 12:23:03 Tree
[8f12d5] by Maynard Johnson Maynard Johnson

Fix configure to not alter user variables and remove non-working --with-gcc option

The configure script for oprofile had a few places
where user variables were being altered in contradiction
to the GNU Automake manual. See the following URL for details:


In brief, user variables are those listed under "Some influential
environment variables" section of the output from 'configure --help'.
These are variables which the user may set prior to invoking configure,
and thus, the configure script should not alter them. This patch
makes use of new internal variables (e.g., OP_LDFLAGS and OP_CPPFLAGS),
which did unfortunately create quite a ripple effect with the Makefile.am
files. But this was unavoidable in order to correct this error.

Additionally, the '--with-gcc' option does not work anymore because
the generated configure script runs the AC_PROG_CC before processing the
"--with-gcc" option, so it fails to find a compiler. Unsure of when
this stopped working (assume it must have worked in 2005 when it was
initially added), but even fairly old distros (e.g., SLES 10) with
autoconf version 2.59 do not process this option as we would want.
If users wish to configure oprofile to use an alternate compiler,
they should pass the compiler pathnames on the configure command line, thusly:
./configure CC=/my-gcc-install/bin/gcc CXX=/my-gcc-instal/g++

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-13 17:44:49 Tree
[ce716e] by Maynard Johnson Maynard Johnson

Fix error when using 'operf --callgraph --events=blah'

When executing the following command:
'operf -g -e CPU_CLK_UNHALTED:500000 ls'

the following error message occurs:
"Invalid count for event --callgraph=1"

I tracked this down to the switch-over I made on June 11 to
change operf from using popt to use getopt_long instead. The
error message is coming from where operf invokes the ophelp
command as follows:
'ophelp --check-events CPU_CLK_UNHALTED:500000 --callgraph=1'

This ophelp command works fine if you execute it from the command
line. It also works fine when executed by opcontrol. So the only
situation it doesn't work correctly is when executed by operf.
I put some debug printf's into ophelp and found that when it calls
poptGetArgs(), the returned value is '2' in the above example when
operf is used, but is '1' when ophelp is called from the command line
or opcontrol. My initial thought was that either operf
or ophelp might be making improper use of some memory, but running
both programs under Valgrind revealed no problems. So now,
my theory is that because popt uses getopt under the
covers, there must be some global variable being used in operf's use
of getopt that later calls something to go awry when ophelp uses
the poptGetArgs function.

The fix for this problem is to have operf pass the "--callgraph=1"
option to ophelp before passing the event spec.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-13 15:37:02 Tree
[988007] by Maynard Johnson Maynard Johnson

Add --with-kernel configure option to specify location of kernel headers

This new configure option can be useful in cross-compile environments or
other situations where the host system does not support perf_events but
the user wants to build binaries for a target system that does support

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Signed-off-by: Balazs Kilvady <kilvadyb@homejinni.com>
Signed-off-by: Gergely Kis <gergely@homejinni.com>

2012-07-06 19:31:49 Tree
[01c7ce] by Maynard Johnson Maynard Johnson

Make opreport use <cur_dir>/oprofile data for default session-dir

Since operf will be the recommended profiling tool in the future
(instead of opcontrol) and since operf stores the sample data by
default in <cur_dir>/oprofile_data, it makes sense for opreport
and other oprofile post-processing tools to look first in
<cur_dir/oprofile_data; then, if no samples are found there, the
tool should fall back to the "standard" /var/lib/oprofile session-dir.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-07-03 19:15:19 Tree
[4e4178] by Maynard Johnson Maynard Johnson

Make operf use OP_BINDIR when invoking ophelp

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-27 21:01:19 Tree
[cf8d61] by Maynard Johnson Maynard Johnson

Fix operf handling of invalid options

When using either the "--system-wide" or the "--pid" option,
the operf program was not aborting right away if an invalid
option was also passed. This patch fixes that problem.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-25 21:29:18 Tree
[589207] by Maynard Johnson Maynard Johnson

Remove unused "--kernel-buffersize-multiplier" option from operf

The "--kernel-buffersize-multiplier" option was not wired in to
perform any actions. In the course of wiring it in to the mmap
call (where the operf record process mmap's the perf_events kernel
data) and performing functional tests, I found that bumping up
the mmap size had little noticeable beneficial effect -- perhaps
even *no* effect at all. I expected that the perf_event_header type
of PERF_RECORD_LOST would be an indication that a larger kernel
buffer (i.e., mmap'ed area) was needed. I was able to force such
"LOST" samples by using a very high sampling rate, yet increasing
the number mmap pages did not eliminate the LOST samples. So I
removed this option from the code and the man page.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-25 20:54:33 Tree
[f12513] by Maynard Johnson Maynard Johnson

Handle EINTR of operf read of sample data pipe

When profiling an application with operf's "--pid" option,
the user must stop profiling using ctrl-C. A signal
handler was setup for the operf process that reads
sample data from a pipe (written to by the operf record
process), but when that handler was triggered, the
operf read process was ending before reading the
rest of the sample data from the pipe. In cases
where lots of sample data has already been received,
the little bit that gets left in the pipe may not be
noticeable. But for situations where the samples
are few and far between, this problem can, on some
platforms, result in no profiling data being received
at all.

The fix for the problem is to detect an EINTR when trying
to read the pipe and go back and read it again.

Another symptom of unnecessary stopping due to EINTR is
possible when opening the sample data files to store
the converted sample data. This is a very small window,
and I have not actually seen this symptom, but with this
patch, I plug up that window as well.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-22 13:11:41 Tree
[177e91] by Maynard Johnson Maynard Johnson

Minor fixups for verbose output for operf

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-19 20:42:51 Tree
[d17626] by Maynard Johnson Maynard Johnson

Add reporting of profiling statistics to operf.

This patch adds the recording of the following stats:

OPERF_SAMPLES, /**< nr. samples */
OPERF_KERNEL, /**< nr. kernel samples */
OPERF_PROCESS, /**< nr. userspace samples */
OPERF_INVALID_CTX, /**< nr. samples lost due to sample address not in expected range for domain */
OPERF_LOST_KERNEL, /**< nr. kernel samples lost */
OPERF_LOST_SAMPLEFILE, /**< nr samples for which sample file can't be opened */
OPERF_LOST_NO_MAPPING, /**< nr samples lost due to no mapping */
OPERF_NO_APP_KERNEL_SAMPLE, /**<nr. user ctx kernel samples dropped due to no app context available */
OPERF_NO_APP_USER_SAMPLE, /**<nr. user samples dropped due to no app context available */
OPERF_BT_LOST_NO_MAPPING, /**<nr. backtrace samples dropped due to no mapping */
OPERF_LOST_INVALID_HYPERV_ADDR, /**<nr. hypervisor samples dropped due to address out-of-range */
OPERF_RECORD_LOST_SAMPLE, /**<nr. samples lost reported by perf_events kernel */

At the completion of a profiling run, these stats are written to the
operf.log file (new in this patch) at <session_dir>/samples.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-12 18:38:47 Tree
[88e125] by Maynard Johnson Maynard Johnson

Switch operf from popt to getopt

Using popt to parse command line arguments for operf did not
work properly for cases where an application to profile is
passed in, along with some app arguments that happen to have
option names the same as operf. Therefore, operf has been
changed to use getopt_long. This decision to not use popt
negated the reason for the changes made to oprofile's libopt++
popt_option.[c|h] files back when operf was first introduced;
thus, those changes are reverted with this patch.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-11 15:10:58 Tree
[da15d5] by Maynard Johnson Maynard Johnson

Fix for operf userland/kernelspace profiling and improvements to mmap of kernel data

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-09 00:18:41 Tree
[acb8fa] by Maynard Johnson Maynard Johnson

Flesh out operf support for kernel versus user domain sample recording.

Added support for handling event specifications of the form:

-e <event_name>:<count>:<unit_mask_num>:<kernel_mode>:<user_mode>

The '<kernel_mode>' and '<user_mode>' parts can be either '1' or '0',
indicating to either record samples or not, respectively, for the given

This patch also fixes an unrelated problem where samples were sometimes
be mis-attributed due to having an "operf_transient" object in an
inconsistent state.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-07 21:40:59 Tree
[5ea404] by Maynard Johnson Maynard Johnson

Add support to operf for recording hypervisor samples

On some architectures (IBM ppc64, for example), hypervisor
code is used for handling virtualization of the system (i.e.
partitioning of the hardware into multiple unique installations).
This patch adds support for recording samples taken while
in hypervisor domain (as opposed to 'user' or 'kernel' domain.

While working on the hypervisor support, I found some issues
with how the main process handled errors from the forked
processes (operf-record process and operf-read process), so
I hardened that area in this patch, too.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>

2012-06-05 20:56:20 Tree
Older >

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks