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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210114074256.GA189511@leoy-ThinkPad-X240s>
Date:   Thu, 14 Jan 2021 15:42:56 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Joe Mario <jmario@...hat.com>, David Ahern <dsahern@...il.com>,
        Don Zickus <dzickus@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/5] perf c2c: Refactor display filter

Hi Joe,

On Wed, Jan 13, 2021 at 11:35:23PM -0800, Joe Perches wrote:
> On Thu, 2021-01-14 at 11:39 +0800, Leo Yan wrote:
> > When sort on the respective metrics (lcl_hitm, rmt_hitm, tot_hitm),
> > macro FILTER_HITM is to filter out the cache line entries if its
> > overhead is less than 1%.
> > 
> > This patch introduces static function filter_display() to replace macro;
> > and refines its parameter with more flexbile way, rather than passing
> > field name, it changes to pass the cache line's statistic value and the
> > sum value.
> []
> > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> []
> > +static u8 filter_display(u32 val, u32 sum)
> > +{
> > +	double ld_dist;
> > +
> > +	if (sum) {
> > +		ld_dist = ((double)(val) / (sum));
> > +		if (ld_dist < DISPLAY_LINE_LIMIT)
> > +			return HIST_FILTER__C2C;
> > +	} else {
> > +		return HIST_FILTER__C2C;
> > +	}
> > +
> > +	return 0;
> > +}
> 
> style:
> 
> It's generally better to test and return early and unindent the remainder.
> Also, parentheses aren't necessary around now not-macro args.
> 
> {
> 	if (sum == 0 || ((double)val / sum) < DISPLAY_LINE_LIMIT)
> 		return HIST_FILTER__C2C;
> 
> 	return 0;
> }

Will refine for this; thanks for suggestion.

Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ