When in report group mode (perf report --group) with option
--show-total-period, display period values for all group members.

Currently only the group leader period counts are shown.

Example of new output:

  $ perf report --group --show-total-period --stdio
  ...

  # Samples: 76  of event 'anon group { cycles, cache-misses }'
  # Event count (approx.): 32249096
  #
  #         Overhead                    Period  Command      Shared Object      
                   Symbol
  # ................  ........................  .......  .................  
.............................
  #
      18.45%  11.67%       5949678         333       ls  [kernel.kallsyms]  [k] 
__lock_acquire
      16.49%  11.39%       5317432         325       ls  [kernel.kallsyms]  [k] 
native_sched_clock
       8.55%  15.42%       2757064         440       ls  [kernel.kallsyms]  [k] 
lock_acquire
       8.31%  12.58%       2680708         359       ls  [kernel.kallsyms]  [k] 
clear_page_c

  ...

Signed-off-by: Jiri Olsa <jo...@redhat.com>
Cc: Arnaldo Carvalho de Melo <a...@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Corey Ashford <cjash...@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Namhyung Kim <namhy...@kernel.org>
---
 tools/perf/ui/hist.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 51934a8..50e8d85 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -273,21 +273,59 @@ static int hpp__entry_samples(struct perf_hpp *hpp, 
struct hist_entry *he)
 
 static int hpp__header_period(struct perf_hpp *hpp)
 {
-       const char *fmt = symbol_conf.field_sep ? "%s" : "%12s";
+       int len = 12;
+
+       if (symbol_conf.field_sep)
+               return scnprintf(hpp->buf, hpp->size, "%s", "Period");
+
+       if (symbol_conf.event_group) {
+               struct perf_evsel *evsel = hpp->ptr;
+
+               BUG_ON(!perf_evsel__is_group_leader(evsel));
+
+               len += evsel->nr_members * 12;
+       }
 
-       return scnprintf(hpp->buf, hpp->size, fmt, "Period");
+       return scnprintf(hpp->buf, hpp->size, "%*s", len, "Period");
 }
 
 static int hpp__width_period(struct perf_hpp *hpp __maybe_unused)
 {
-       return 12;
+       int len = 12;
+
+       if (symbol_conf.event_group) {
+               struct perf_evsel *evsel = hpp->ptr;
+
+               len += evsel->nr_members * 12;
+       }
+
+       return len;
 }
 
 static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he)
 {
        const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
+       struct hists *hists = he->hists;
+       int ret;
+
+       ret = scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
+
+       if (symbol_conf.event_group) {
+               int i;
+               struct perf_evsel *evsel = hists_2_evsel(hists);
+
+               for (i = 0; i < evsel->nr_members; i++) {
+                       u64 period = he->group_stats[i].period;
 
-       return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
+                       if (symbol_conf.field_sep) {
+                               ret += scnprintf(hpp->buf + ret,
+                                                hpp->size - ret, " ");
+                       }
+                       ret += scnprintf(hpp->buf + ret, hpp->size - ret,
+                                        fmt, period);
+               }
+       }
+       return ret;
 }
 
 static int hpp__header_period_baseline(struct perf_hpp *hpp)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to