提交 9b0d2fb8 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

perf ui/stdio: Fix invalid output on event group report

When some of group member has 0 overhead, it printed previous percentage
instead of 0.00%.  It's because passing integer 0 as a percent rather
than double 0.0 so the remaining bits came from garbage.  The TUI and
GTK don't have this problem since they pass 0.0.

Before:

  # Samples: 845  of event 'anon group { cycles, cache-references, cache-misses }'
  # Event count (approx.): 174775051
  #
  #                 Overhead                               Samples
  # ........................  ....................................
  #
      20.32%   8.58%  73.51%            45          30         138
       6.87%   6.87%   6.87%            21           0           0
       5.29%   0.31%   0.31%            10           1           0
       1.89%   1.89%   1.89%             6           0           0
       1.76%   1.76%   1.76%             2           0           0

After:

  #                 Overhead                               Samples
  # ........................  ....................................
  #
      20.32%   8.58%  73.51%            45          30         138
       6.87%   0.00%   0.00%            21           0           0
       5.29%   0.31%   0.00%            10           1           0
       1.89%   0.00%   0.00%             6           0           0
       1.76%   0.00%   0.00%             2           0           0
Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1393809254-4480-2-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 bfd66cc7
......@@ -52,8 +52,15 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
* zero-fill group members in the middle which
* have no sample
*/
ret += print_fn(hpp->buf + ret, hpp->size - ret,
fmt, 0);
if (fmt_percent) {
ret += print_fn(hpp->buf + ret,
hpp->size - ret,
fmt, 0.0);
} else {
ret += print_fn(hpp->buf + ret,
hpp->size - ret,
fmt, 0ULL);
}
}
if (fmt_percent)
......@@ -72,8 +79,13 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
/*
* zero-fill group members at last which have no sample
*/
ret += print_fn(hpp->buf + ret, hpp->size - ret,
fmt, 0);
if (fmt_percent) {
ret += print_fn(hpp->buf + ret, hpp->size - ret,
fmt, 0.0);
} else {
ret += print_fn(hpp->buf + ret, hpp->size - ret,
fmt, 0ULL);
}
}
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册