perf hists: Introduce hists__match_hierarchy()
authorNamhyung Kim <namhyung@kernel.org>
Tue, 13 Sep 2016 07:45:46 +0000 (16:45 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 13 Sep 2016 19:31:24 +0000 (16:31 -0300)
commit09034de63e427a86ba96bedf39410eef7c9014a5
tree3c1e2f3ae5a1ca596942b4eebf7f032c2d4b3a28
parent0a4a7e435f458e996d0f21a9ebc964e0b0d64eba
perf hists: Introduce hists__match_hierarchy()

The hists__match_hierarchy() is to find matching hist entries in a
group.  A matching entry has the same values for all sort keys given.

With an event group (e.g.: -e "{cycles,instructions}"), a leader event
should show other members in a group.  So each entry in the leader
should be able to find its pair entries which have same values.

With hierarchy mode, it needs to search all matching children in a
hierarchy.

An example output looks like:

  #               Overhead  Command / Shared Object / Symbol
  # ......................  ..................................
  #
      25.74%  27.18%        sh
         19.96%  24.14%        libc-2.24.so
            9.55%  14.64%        [.] __strcmp_sse2
            1.54%   0.00%        [.] __tfind
            1.07%   1.13%        [.] _int_malloc
  ...

In the above example, two overheads are shown - one for the leader and
another for the other group member.  They were matched since their
command, dso and symbol have the same values.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20160913074552.13284-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/hist.c