lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 3 Nov 2015 12:19:38 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	LKML <linux-kernel@...r.kernel.org>,
	Brendan Gregg <brendan.d.gregg@...il.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Kan Liang <kan.liang@...el.com>
Subject: Re: [PATCH v3 4/4] perf report: Add callchain value option

On Tue, Nov 03, 2015 at 07:53:51PM +0900, Namhyung Kim wrote:
> On Tue, Nov 03, 2015 at 10:06:27AM +0100, Jiri Olsa wrote:
> > On Tue, Nov 03, 2015 at 04:18:31PM +0900, Namhyung Kim wrote:
> > 
> > SNIP
> > 
> > > @@ -819,12 +837,26 @@ char *callchain_node__sprintf_value(struct callchain_node *node,
> > >  				    char *bf, size_t bfsize, u64 total)
> > >  {
> > >  	double percent = 0.0;
> > > -	u64 cumul = callchain_cumul_hits(node);
> > > +	u64 period = callchain_cumul_hits(node);
> > > +	int count = callchain_cumul_counts(node);
> > >  
> > >  	if (total)
> > > -		percent = cumul * 100.0 / total;
> > > +		percent = period * 100.0 / total;
> > > +	if (callchain_param.mode == CHAIN_FOLDED)
> > > +		count = node->count;
> > 
> > this could be set/computed below in respective cases
> 
> As you said, I need to check it for node->hit too.  So I ended up
> having like following, does it look good to you?
> 
>     double percent = 0.0;
>     u64 period = callchain_cumul_hits(node);
>     unsigned count = callchain_cumul_counts(node);
> 
>     if (callchain_param.mode == CHAIN_FOLDED) {
>         period = node->hit;
>         count = node->count;
>     }
> 
>     switch (callchain_param.value) {
>     case CCVAL_PERIOD:
>         scnprintf(bf, bfsize, "%"PRIu64, period);
>         break;
>     case CCVAL_COUNT:
>         scnprintf(bf, bfsize, "%u", count);
>         break;
>     case CCVAL_PERCENT:
>     default:
>         if (total)
>             percent = period * 100.0 / total;
>         scnprintf(bf, bfsize, "%.2f%%", percent);
>         break;
>     }
>     return bf;

seems ok, thanks

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ