oprofile Log

Commit Date  
[6ee980] (13.9 kB) by Maynard Johnson Maynard Johnson

Fix Coverity errors found on May 20, 2013 git snapshot

Coverity identified the following errors on scans run from May 7 through
May 20, 2013:

Wrapper object use after free,Memory - illegal accesses,/agents/jvmpi/jvmpi_oprofile.cpp,compiled_method_load(JVMPI_Event *)
Unchecked return value,Error handling issues,/daemon/opd_mangling.c,opd_open_sample_file
Dereference after null check,Null pointer dereferences,/daemon/opd_sfile.c,sfile_hash
Uninitialized scalar field,Uninitialized members,/gui/oprof_start_config.cpp,config_setting::config_setting()
Division or modulo by zero,Integer handling issues,/libdb/db_stat.c,odb_hash_stat
Resource leak,Resource leaks,/libop/op_cpu_type.c,_auxv_fetch
Resource leak,Resource leaks,/libop/op_cpu_type.c,fetch_at_hw_platform
Negative array index read,Memory - illegal accesses,/libop/op_events.c,_is_um_valid_bitmask
Write to pointer after free,Memory - corruptions,/libop/op_events.c,read_events
Read from pointer after free,Memory - illegal accesses,/libop/op_events.c,_is_um_valid_bitmask
Dereference after null check,Null pointer dereferences,/libop/op_mangle.c,op_mangle_filename
Dereference after null check,Null pointer dereferences,/libop/op_mangle.c,op_mangle_filename
Time of check time of use,Security best practices violations,/libopagent/opagent.c,op_open_agent
Improper use of negative value,Integer handling issues,/libperf_events/operf_counter.cpp,operf_record::setup()
Double free,Memory - corruptions,/libperf_events/operf_counter.cpp,operf_record::setup()
Uninitialized pointer read,Memory - illegal accesses,/libperf_events/operf_counter.cpp,<unnamed>::_get_perf_event_from_file(mmap_info &)
Unchecked return value,Error handling issues,/libperf_events/operf_mangling.cpp,"operf_open_sample_file(odb_t *, operf_sfile *, operf_sfile *, int, int)"
Using invalid iterator,API usage errors,/libperf_events/operf_process_info.cpp,operf_process_info::try_disassociate_from_parent(char *)
Non-array delete for scalars,Memory - illegal accesses,/libregex/op_regex.cpp,"<unnamed>::op_regerror(int, const re_pattern_buffer &)"
Resource leak,Resource leaks,/libutil++/op_bfd.cpp,"op_bfd::op_bfd(const std::basic_string<char, std::char_traits<char>, std::allocator<char>>&, const string_filter &, const extra_images &, bool &)"
Explicit null dereferenced,Null pointer dereferences,/opjitconv/create_bfd.c,fill_symtab
Resource leak,Resource leaks,/opjitconv/opjitconv.c,_cleanup_jitdumps
Use of untrusted string value,Insecure data handling,/opjitconv/opjitconv.c,main
Resource leak,Resource leaks,/pe_profiling/operf.cpp,_get_cpu_for_perf_events_cap()
Dereference null return value,Null pointer dereferences,/pe_profiling/operf.cpp,_process_session_dir()
Incorrect deallocator used,API usage errors,/pe_profiling/operf.cpp,_process_events_list()


This patch fixes those errors.

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

2013-05-28 13:19:25 View
[a39d41] (13.9 kB) by Maynard Johnson Maynard Johnson

Fix holes in operf system-wide profiling of forked processes

Using operf to do system-wide profiling of the specjbb benchmark
exposed some holes in how operf was processing the perf_events
data coming from the kernel. Some of the events we can get from
the kernel are:

The "COMM" event is to notify us of the start of an executable
application. The "FORK" event tells us when a process forks
another process. The "MMAP" event informs us when a shared library
(or executable anonymous memory, or the executable file itself, etc.)
has been mmap'ed into a process's address space. A "SAMPLE"
event occurs each time the kernel takes a sample for a process.

There is no guarantee in what order these events may arrive from
the kernel, and when a large system (say, 64 CPUs) is running
the specjbb benchmark full bore, with all processors pegged to
100%, you can get some very strange out-of-order looking
sequence of events. Things get even stranger when using Java7
versus Java6 since Java7 spawns many more threads.

The operf code had several issues where such out-of-order
events were not handled properly, so some major changes were
required in the code.

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

2013-04-25 15:53:37 View
[2af280] (10.2 kB) 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 View
[4747a7] (7.0 kB) 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 View
[5ea404] (7.0 kB) 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 View
[3af9d6] (3.9 kB) by Maynard Johnson Maynard Johnson

Various operf cleanups, mostly addressing issues reported by Valgrind

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

2012-05-30 18:23:50 View
[014394] (3.9 kB) by Maynard Johnson Maynard Johnson

Add support for JIT profiling to operf

2012-04-27 21:20:50 View
[f7f71a] (3.8 kB) by Maynard Johnson Maynard Johnson

Fix timing-related problems with app name

Under certain circumstances when doing system-wide profiling, operf
may received MMAP events for depenedent libraries before receiving
the corresponding COMM event which represents an executable being
profiled. The COMM event only contains a short "app name" of 16
characters, so we need to try match up a COMM event with an MMAP
event to obtain our best guess for the app pathname. There were
a couple of bugs in the area of the code that was supposed to
handle the case described above (where MMAP's come before COMM).
This patch fixes those bugs. I also renamed the "app_name" field
of the operf_process_info class so it doesn't collide visually
with a global of the same name. This was not actually causing a
probelem since the usage spaces of the two variables were completely
separate, but it just caused some confusion in understanding the

2012-03-28 17:26:04 View
[b2ce90] (3.8 kB) by Maynard Johnson Maynard Johnson

Minor bug fixes and performance improvement for system-wide mode.

The operf_sfile hashing algorithm was modified from legacy hashing
to use either a build-id or a checksum. I had not yet implemented the
getting the build-id, so was falling back to the checksum. Getting
the checksum (via gelf_checksum) was terribly expensive, especially
noticeable when running with the system-wide option. So I spent
some time comparing using a build-id (obtained from the binary file's
NT_GNU_BUILD_ID note) for the hashing algorithm versus simply hashing
on a substring of the image name. The simple string hash was as
effective as the build-id method. Both were way better than the checksum
technique. In the end, I removed all of the checksum and build-id stuff,
and settled on the image name string hash method for finding operf_sfiles.

Aside from the above big performance improvement described above, I also
created a global multimap for holding operf_mmap objects. The operf_mmap
encapsulates an MMAP event. In system-wide mode, we get lots of MMAP events
for the same libraries being used by many different processes, so it was
logical to create just one operf_mmap object per unique binary.

2012-03-27 23:03:45 View
[708925] (4.2 kB) by Maynard Johnson Maynard Johnson

Refactored some code into a library for use by both operf and (in future) oprofile daemon

2012-03-20 18:13:39 View
[ec4ae6] (None) by Maynard Johnson Maynard Johnson

Add support for kernel profiling; incidental namespace fixups

The bulk of this patch is for adding support to operf for recording
kernel samples. The vmlinux option can be used to pass in a vmlinux
file to use for symbol resolution and debuginfo (if available in
that file). If no vmlinux option is passed in, a default "no-vmlinux"
pseudo image is created to which all kernel samples are attributed.

This patch also includes some namespace fixups that were incidental
to the kernel profiling enhancment. Additionally, a few small changes
were made in the way a passed application name is processed.

2012-03-16 19:08:54 View
[35b8a5] (None) by Maynard Johnson Maynard Johnson

Update perf-events branch to match patchset posted to oprofile-list on Feb 23

2012-03-01 18:28:14 View
[3f56ea] (None) by Maynard Johnson Maynard Johnson

Add new files for perf-events branch

2012-01-14 00:00:57 View