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:   Tue, 5 May 2020 01:41:59 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Jin Yao <yao.jin@...ux.intel.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH v2 2/2] perf stat: Report summary for interval mode

On Sat, May 02, 2020 at 10:07:05AM +0800, Jin Yao wrote:

SNIP

>  	init_stats(&walltime_nsecs_stats);
>  	update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000);
>  	print_counters(&rs, 0, NULL);
> +	walltime_nsecs_stats = walltime_nsecs_stats_bak;
>  }
>  
>  static void enable_counters(void)
> @@ -732,7 +735,14 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
>  	 * avoid arbitrary skew, we must read all counters before closing any
>  	 * group leaders.
>  	 */
> -	read_counters(&(struct timespec) { .tv_nsec = t1-t0 });
> +	if (!interval)
> +		read_counters(&(struct timespec) { .tv_nsec = t1-t0 });
> +	else {
> +		stat_config.interval = 0;
> +		stat_config.summary = true;
> +		perf_evlist__copy_summary_counts(evsel_list);
> +		perf_evlist__process_summary_counts(&stat_config, evsel_list);

I think keeping the summary and copying it to evsel->count is ok,
but when we pretend to have new counts in place, could we process
it with perf_stat_process_counter function? so we keep just
1 processing code?

perhaps have some setup functions for non-interval settings?

SNIP

> +
> +	evsel->prev_raw_counts->aggr = evsel->summary_counts->aggr;
> +}
> +
> +void perf_evlist__copy_summary_counts(struct evlist *evlist)
> +{
> +	struct evsel *evsel;
> +
> +	evlist__for_each_entry(evlist, evsel)
> +		perf_evsel__copy_summary_counts(evsel);
> +}
> +
> +static void perf_stat_process_summary_counts(struct perf_stat_config *config,
> +					     struct evsel *evsel)
> +{
> +	struct perf_counts_values *summary = &evsel->summary_counts->aggr;

as I said earlier, why not copy all summary_counts data into 'counts'
and use the current code the process and display the result?

thanks,
jirka

> +	struct perf_stat_evsel *ps = evsel->stats;
> +	u64 *count = evsel->summary_counts->aggr.values;
> +	int i;
> +
> +	if (!config->summary || config->aggr_mode != AGGR_GLOBAL)
> +		return;
> +
> +	for (i = 0; i < 3; i++)
> +		init_stats(&ps->res_stats[i]);
> +
> +	perf_counts_values__scale(summary, config->scale,
> +				  &evsel->summary_counts->scaled);
> +
> +	for (i = 0; i < 3; i++)

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ