Print debug message when module summary count differs from total symbols counts

A user who was profiling a Java application was generating various types of
reports with opreport. He noted an anomaly involving module sample counts for
certain binary images that were associated with the JVM (a couple shared libs
and the <PID>.jo file created by opjitconv). The 'opreport' and 'opreport --xml'
commands showed different module-level sample counts for these particular
binary images.

When the '--xml' option is passed to opreport, by default, it outputs
symbol-level sample counts, so there's no way to directly compare a
"no symbols" summary report between XML and flat text. The flat text
summary includes all samples attributed to a binary, but when a
symbols-level report is requested, we may find that some of those samples
are bogus or for some reason, cannot be resolved to a symbol (e.g., the
address lies outside the range of symbol addresses for this binary).
The XML module summary count actually sums up the individual symbols
counts, so that's why it's possible to see a differnce in XML module
summary counts and flat text module summary counts.

This patch adds the capability for opreport to detect a difference in
the module summary count and the total symbols count and to print an
INFO message when the '--verbose=debug' flag is passed.  This capability
is documented in the opreport man page.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Don't show irrelevant bits in unit mask sub-window

Check boxes associated to non significant bits in unit mask should not be
visible.

This patch prevents from showing irrelevant check boxes in 'Unit mask' sub-
window.

Signed-off-by: Gilles Allard <gilles.allard21@orange.fr>
Fix warning message about diff in module and symbol sample counts

A commit made recently that printed a debug message when module summary
count differs from total symbols counts was incorrectly printing a
warning message because the patch did not check for the criteria that
the module_summary_count was < sym_count_total.  This patch fixes
that problem.  Note that the problem was only visible when running
with '--verbose=all'.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Fix size problem of oprof_start GUI

On oprof_start startup, "unit mask" sub-window sometimes overlaps "event list"
one ( confusing appearance ).  On some systems, the symptom is the unit mask
sub-window is too narrow to fit the entire UM description, thus requiring the
user to manually re-size the whole GUI window manually.

To see this problem, select a long event name that also has some long unit
mask descriptions that would entail auto-resizing of the windows. Then save
and quit, and restart the gui.  The windows may be overlapped or may not be
sized correctly to accommodate the long event name and/or long unit mask
description.

This problem occurs if oprof_start is built with Qt4 / Qt3Support.

This patch fixes this.

Signed-off-by: Gilles Allard <gilles.allard21@orange.fr>
Add EXTRA_NONE flag for use with unit masks empty "extra:" field

Add a dummy extra flag that is set when any extra: (including an empty one)
field is present in a unit mask line.

This can be used to express that the unit mask has a unique name as the
first word of the description.

This is mapped to the x86 enabled flag, as we have to pass it around
as part of the event mask.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Add empty extra: lines to every Intel event with a unique first word

Add empty extra: lines to every Intel event with a unique first word
in the description. This can then be used to specify the unit mask
symbolically.

Haswell already had the empty extra masks.
Core 2 did not have unique words for everything. I only add it there
to the events which had.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Remove improper extra field from core_2 unit masks

In the new unit mask parsing scheme, "extra:" should always followed
by named mask. This patch fixes the entries which does not follow
the scheme.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Add support for named default unit masks

Current libop does not allow named mask to be used as default mask.
This causes the tools to fail when user does not specify the named
mask of an event and relying on the numerical default unit mask
which could have duplication.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Use names to make all non-unique Intel default unit masks unique

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Fix unit mask value for EXTRA_NONE

For named unit masks that do not have real extra values
associated with them, the 'extra' field of the unit mask
description structure is set to EXTRA_NONE, which is not
really a valid value as far as the performance monitoring
hardware goes.  In such cases, 'ophelp --extra-mask'
was returning EXTRA_NONE to the operf and opcontrol
profilers, which results in no samples being collected,
since it's not a valid mask value.  In such cases, ophelp
should return the simple unit mask value. The operf
and opcontrol tools that use 'ophelp --extra-mask' must
be able to differentiate between a simple mask value
and an "extra" value.  Anything greater or equal to
0x40000 is interpreted as a valid "extra" value; otherwise
it's a simple mask value.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Make doc changes to reflect changes in behavior for named unit masks

These doc changes correspond to the previous 5 patches contributed
by Suravee, Andi, and Maynard that fixed functional issues with
named unit masks.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Remove invalid '+' character from line 140 of Ivybridge unit_masks

This problem was caught by Suravee running 'make distcheck'.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Fix recent regression in opreport --debuginfo output

The '--debuginfo' option of opreport is broken. Output shows
"(no location information)" when it should show source file
and line number. I found that the May 15 commit ("Fix Coverity
issues identified against oprofile 0.9.8 release") was the
culprit. Coverity complained about a file descriptor in
the op_bfd constructor not being closed. My "fix" for that
complaint was wrong. The file descriptor in question is
the one we open for the binary image being processed by op_bfd
and which we pass to fdopen_bfd. Apparently, libbfd caches that
fd internally and makes use of it for certain functions -- in
particular, bfd_find_nearest_line(). This bug also caused
another symptom: when opreport is run with '--xml --details',
the output does not contain the binary code for the symbols.

The fix for this problem was trivial. I put the declaration for
the "fd" into the op_bfd class private section and then closed
the fd in the op_bfd destructor.

Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
Add the "--no-header" short form option, "-n", to the opreport man page

Signed-off-by: William Cohen <wcohen@redhat.com>
Document additional ophelp options on the man page

Signed-off-by: William Cohen <wcohen@redhat.com>
Add the --merge option description to opannotate man page.

Signed-off-by: William Cohen <wcohen@redhat.com>
Document the opcontrol short form options on the man page

Signed-off-by: William Cohen <wcohen@redhat.com>
Add a short man page for op-check-perfevents.

Signed-off-by: William Cohen <wcohen@redhat.com>
Add man page for oprof_start.

Signed-off-by: William Cohen <wcohen@redhat.com>
Remove obsolete --note-table-size option from opcontrol

Only the very old kernels (2.4) provided support for --note-table-size option.
Given that other 2.4 support was removed from OProfile there isn't any
reason to keep this around.

Signed-off-by: William Cohen <wcohen@redhat.com>