perf hists: Add missing period_* fields when collapsing a hist entry
authorNamhyung Kim <namhyung.kim@lge.com>
Wed, 26 Sep 2012 07:47:28 +0000 (16:47 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 26 Sep 2012 23:44:11 +0000 (20:44 -0300)
So that the perf report won't lost the cpu utilization information.

For example, if there're two process that have same name.

  $ perf report --stdio --showcpuutilization -s pid
  [SNIP]
  #   Overhead       sys        us  Command:  Pid
  #   ........  ........  ........  .............
  #
        55.12%     0.01%    55.10%  noploop:28781
        44.88%     0.06%    44.83%  noploop:28782

Before:
  $ perf report --stdio --showcpuutilization -s comm
  [SNIP]
  #   Overhead       sys        us
  #   ........  ........  ........
  #
       100.00%     0.06%    44.83%

After:
  $ perf report --stdio --showcpuutilization -s comm
  [SNIP]
  #   Overhead       sys        us
  #   ........  ........  ........
  #
       100.00%     0.07%    99.93%

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Arun Sharma <asharma@fb.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1348645663-25303-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/hist.c

index 6ec5398..236bc9d 100644 (file)
@@ -410,8 +410,13 @@ static bool hists__collapse_insert_entry(struct hists *hists __maybe_unused,
                cmp = hist_entry__collapse(iter, he);
 
                if (!cmp) {
-                       iter->period += he->period;
-                       iter->nr_events += he->nr_events;
+                       iter->period            += he->period;
+                       iter->period_sys        += he->period_sys;
+                       iter->period_us         += he->period_us;
+                       iter->period_guest_sys  += he->period_guest_sys;
+                       iter->period_guest_us   += he->period_guest_us;
+                       iter->nr_events         += he->nr_events;
+
                        if (symbol_conf.use_callchain) {
                                callchain_cursor_reset(&callchain_cursor);
                                callchain_merge(&callchain_cursor,