lkml.org 
[lkml]   [2014]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] perf report: Add --percentage option
On Mon, Feb 10, 2014 at 11:47:20AM +0900, Namhyung Kim wrote:
> The --percentage option is for controlling overhead percentage
> displayed. It can only receive either of "relative" or "absolute".
>
> "relative" means it's relative to filtered entries only so that the
> sum of shown entries will be always 100%. "absolute" means it retains
> the original value before and after the filter is applied.

SNIP

> diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
> index 78f4c92e9b73..714f3f00ea55 100644
> --- a/tools/perf/ui/hist.c
> +++ b/tools/perf/ui/hist.c
> @@ -21,10 +21,13 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
>
> if (fmt_percent) {
> double percent = 0.0;
> + u64 total = hists->stats.total_period;
>
> - if (hists->stats.total_period)
> - percent = 100.0 * get_field(he) /
> - hists->stats.total_period;
> + if (symbol_conf.filter_relative)
> + total = hists->stats.total_filtered_period;
> +
> + if (total)
> + percent = 100.0 * get_field(he) / total;
>
> ret = print_fn(hpp->buf, hpp->size, fmt, percent);
> } else
> @@ -41,6 +44,9 @@ static int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
> u64 period = get_field(pair);
> u64 total = pair->hists->stats.total_period;
>
> + if (symbol_conf.filter_relative)
> + total = pair->hists->stats.total_filtered_period;
> +
> if (!total)
> continue;

looks like we could use something like:

perf_hists__total_period(hists)
{
u64 total = hists->stats.total_period;

if (symbol_conf.filter_relative)
total = hists->stats.total_filtered_period;

return total;
}

probably on other places as well

jirka


\
 
 \ /
  Last update: 2014-02-20 12:21    [W:0.276 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site