Add the histogram side of hybrid event merging.
When events are merged the entries of the other events are linked to
the leader's entries as pairs, and a row is then displayed as the sum
over an entry and its pairs. Teach the hpp code to work on that sum:
- The formatting and sorting routines add up the value of an entry and
of each of its pairs, so a row shows, and is sorted by, the total
across the core PMUs rather than the leader's value alone.
- Percentages are taken against the summed total_period of the merged
hists. Computing each event's share against its own PMU's total
would leave the column not adding up to 100%.
hist_entry__get_percent_limit_merged() does the same for
--percent-limit, which would otherwise compare against the wrong
total and filter out the wrong entries.
- A header and column width are reserved for the "Total" the merged
value is shown under.
evlist__merge_hists_hybrid() links the hists together and resorts the
result so that it is ordered by the merged total.
hists__link() is run once for every event merged into the leader, so an
entry can be offered as a pair more than once. hist_entry__add_pair()
used list_add_tail() unconditionally, which corrupts the list when the
entry is already on one. Return early if the entry is already paired
with this one, and use list_move_tail() so that an entry linked
elsewhere is moved rather than added a second time.
Merging is never combined with --hierarchy, which the merge_entries
tests rely on.
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>