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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Jul 2020 14:27:17 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 09/15] perf stat: factor out event handling loop into
 dispatch_events()

On Fri, Jul 03, 2020 at 10:46:15AM +0300, Alexey Budankov wrote:
> 
> Consolidate event dispatching loops for fork, attach and system
> wide monitoring use cases into common dispatch_events() function.
> 
> Signed-off-by: Alexey Budankov <alexey.budankov@...ux.intel.com>
> ---
>  tools/perf/builtin-stat.c | 42 +++++++++++++++++++++++++--------------
>  1 file changed, 27 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 3e11f854ffc8..723f1fe27d63 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -550,6 +550,30 @@ static bool is_target_alive(struct target *_target,
>  	return false;
>  }
>  
> +static int dispatch_events(bool forks, int timeout, int interval, int *times, struct timespec *ts)
> +{
> +	bool stop = false;
> +	int child_exited = 0, status = 0;
> +
> +	while (1) {
> +		if (forks)
> +			child_exited = waitpid(child_pid, &status, WNOHANG);
> +		else
> +			child_exited = !is_target_alive(&target, evsel_list->core.threads) ? 1 : 0;
> +
> +		if (done || stop || child_exited)
> +			break;

can (done || stop) be in the while condition and
we'd check just child_exited in here?

> +
> +		nanosleep(ts, NULL);
> +		if (timeout)
> +			stop = true;

can we just break out in here? like the original code?
I don't think we need the extra iteration

> +		else
> +			stop = handle_interval(interval, times);

same here..?


thanks,
jirka


> +	}
> +
> +	return status;
> +}
> +

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ