Initial code drop for perf-events branch
Add new files for perf-events branch
Fixes/workarounds for early/buggy perf_events kernels
Update perf-events branch to match patchset posted to oprofile-list on Feb 23
Fix mmap'ing of perf data file when doing operf_read::convertPerfData.
Merge branch 'master' into perf-events
Fix up error handling and remove restriction that perf_event_paranoid be set to -1.
Remove unused function.
Add support for --pid option and fix timing bug with passing COMMAND option.

A bug was reported when using operf as follows:
   operf -r ping 92.22.100.1
The first invocation of this worked OK, but subsequent invocations failed with
  "perf_event_open failed with Permission denied"

This was due to an error in how the code was handling the exec of the passed
COMMAND (i.e., program to be profiled).  We needed to add synchronization so
that the exec did not happen before the perf_event_open call.  As I was looking
into how to fix this, it seemed like a good time to also add support for the --pid
option, so I did.
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.
New man page for operf command.
Add the new operf.1.in file for the new operf man page

I neglected to do this on the previous commit.  Doing so now.
Refactored some code into a library for use by both operf and (in future) oprofile daemon
Add support for system-wide profiling to libperf_events and operf

This patch makes changes in libperf_events to support the system-wide
profiling that the oprofile daemon will need to use. The patch also
adds support for the --system-wide option in operf as an initial step
to validate the functionality of libperf_events.
Fix problem when passed app name is of the form '<subdir>/<app_name>'

The operf program is able to find passed apps if they were:
   - full pathnames
   - programs that could be located via the PATH env variable
   - programs in the current dir where the passed app name is of
     the form "./<app_name>"

But operf is unable to find the passed app if the app is in a
subdirectory of cur dir; e.g., "test-stuff/myApp".  This patch
fixes that problem.
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.
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
code.
Add support for recording kernel module samples.

Prior to this patch, operf could only record userspace
and "vmlinux" kernel samples.  This patch adds support
for kernel modules.  Additionally, some other minor
cleanups and fixes were made.
Fix seg fault when kernel sample received before kernel MMAP.
Revert "Fix seg fault when kernel sample received before kernel MMAP."

This reverts commit 1602b002d4e4390552f5ffb85fbf3702b915cb6a.

Reverting wrong fix for the aforementioned seg fault