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]
Message-ID: <20150610191352.GI3332@kernel.org>
Date:	Wed, 10 Jun 2015 16:13:52 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Jiri Olsa <jolsa@...nel.org>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Andi Kleen <ak@...ux.intel.com>,
	David Ahern <dsahern@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 15/25] perf stat: Move perf_evlist__(alloc|free)_stats
 into evlist object

Em Wed, Jun 10, 2015 at 08:10:48PM +0200, Jiri Olsa escreveu:
> Moving perf_evlist__(alloc|free)_stats into evsel object,
> so it could be used in following patches.

Can this go into the new counts.[ch] file too? As it is specific to
counting tools?

- Arnaldo
 
> Link: http://lkml.kernel.org/n/tip-8dwmf838kipxabe0vay8h0zn@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/builtin-stat.c | 32 --------------------------------
>  tools/perf/util/evlist.c  | 32 ++++++++++++++++++++++++++++++++
>  tools/perf/util/evlist.h  |  2 ++
>  3 files changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index b15fc47aa673..5072ca809c23 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -141,38 +141,6 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a,
>  	}
>  }
>  
> -static void perf_evlist__free_stats(struct perf_evlist *evlist)
> -{
> -	struct perf_evsel *evsel;
> -
> -	evlist__for_each(evlist, evsel) {
> -		perf_evsel__free_stat_priv(evsel);
> -		perf_evsel__free_counts(evsel);
> -		perf_evsel__free_prev_raw_counts(evsel);
> -	}
> -}
> -
> -static int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw)
> -{
> -	struct perf_evsel *evsel;
> -	int nthreads = thread_map__nr(evsel_list->threads);
> -
> -	evlist__for_each(evlist, evsel) {
> -		int ncpus = perf_evsel__nr_cpus(evsel);
> -
> -		if (perf_evsel__alloc_stat_priv(evsel) < 0 ||
> -		    perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 ||
> -		    (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0))
> -			goto out_free;
> -	}
> -
> -	return 0;
> -
> -out_free:
> -	perf_evlist__free_stats(evlist);
> -	return -1;
> -}
> -
>  static void perf_stat__reset_stats(struct perf_evlist *evlist)
>  {
>  	struct perf_evsel *evsel;
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index f438881040f2..44d52a07223c 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -1651,3 +1651,35 @@ void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
>  
>  	tracking_evsel->tracking = true;
>  }
> +
> +int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw)
> +{
> +	struct perf_evsel *evsel;
> +	int nthreads = thread_map__nr(evlist->threads);
> +
> +	evlist__for_each(evlist, evsel) {
> +		int ncpus = perf_evsel__nr_cpus(evsel);
> +
> +		if (perf_evsel__alloc_stat_priv(evsel) < 0 ||
> +		    perf_evsel__alloc_counts(evsel, ncpus, nthreads) < 0 ||
> +		    (alloc_raw && perf_evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0))
> +			goto out_free;
> +	}
> +
> +	return 0;
> +
> +out_free:
> +	perf_evlist__free_stats(evlist);
> +	return -1;
> +}
> +
> +void perf_evlist__free_stats(struct perf_evlist *evlist)
> +{
> +	struct perf_evsel *evsel;
> +
> +	evlist__for_each(evlist, evsel) {
> +		perf_evsel__free_stat_priv(evsel);
> +		perf_evsel__free_counts(evsel);
> +		perf_evsel__free_prev_raw_counts(evsel);
> +	}
> +}
> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
> index 955bf31b7dd3..557083673bab 100644
> --- a/tools/perf/util/evlist.h
> +++ b/tools/perf/util/evlist.h
> @@ -288,4 +288,6 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
>  void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
>  				     struct perf_evsel *tracking_evsel);
>  
> +int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw);
> +void perf_evlist__free_stats(struct perf_evlist *evlist);
>  #endif /* __PERF_EVLIST_H */
> -- 
> 1.9.3
--
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