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: <YDfMdQCfO6ivN71v@krava>
Date:   Thu, 25 Feb 2021 17:12:37 +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 <peterz@...radead.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>,
        Ian Rogers <irogers@...gle.com>
Subject: Re: [PATCH v2 1/2] libperf: Add perf_evlist__reset_id_hash()

On Thu, Feb 25, 2021 at 12:51:47PM +0900, Namhyung Kim wrote:
> Add the perf_evlist__reset_id_hash() function as an internal function
> so that it can be called by perf to reset the hash table.  This is
> necessary for perf stat to run the workload multiple times.
> 
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

for the patchset

Acked-by: Jiri Olsa <jolsa@...hat.com>

thanks,
jirka


> ---
>  tools/lib/perf/evlist.c                  | 13 +++++++++----
>  tools/lib/perf/include/internal/evlist.h |  2 ++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
> index 17465d454a0e..a0aaf385cbb5 100644
> --- a/tools/lib/perf/evlist.c
> +++ b/tools/lib/perf/evlist.c
> @@ -26,13 +26,10 @@
>  
>  void perf_evlist__init(struct perf_evlist *evlist)
>  {
> -	int i;
> -
> -	for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
> -		INIT_HLIST_HEAD(&evlist->heads[i]);
>  	INIT_LIST_HEAD(&evlist->entries);
>  	evlist->nr_entries = 0;
>  	fdarray__init(&evlist->pollfd, 64);
> +	perf_evlist__reset_id_hash(evlist);
>  }
>  
>  static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
> @@ -237,6 +234,14 @@ static void perf_evlist__id_hash(struct perf_evlist *evlist,
>  	hlist_add_head(&sid->node, &evlist->heads[hash]);
>  }
>  
> +void perf_evlist__reset_id_hash(struct perf_evlist *evlist)
> +{
> +	int i;
> +
> +	for (i = 0; i < PERF_EVLIST__HLIST_SIZE; ++i)
> +		INIT_HLIST_HEAD(&evlist->heads[i]);
> +}
> +
>  void perf_evlist__id_add(struct perf_evlist *evlist,
>  			 struct perf_evsel *evsel,
>  			 int cpu, int thread, u64 id)
> diff --git a/tools/lib/perf/include/internal/evlist.h b/tools/lib/perf/include/internal/evlist.h
> index 2d0fa02b036f..212c29063ad4 100644
> --- a/tools/lib/perf/include/internal/evlist.h
> +++ b/tools/lib/perf/include/internal/evlist.h
> @@ -124,4 +124,6 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist,
>  			   struct perf_evsel *evsel,
>  			   int cpu, int thread, int fd);
>  
> +void perf_evlist__reset_id_hash(struct perf_evlist *evlist);
> +
>  #endif /* __LIBPERF_INTERNAL_EVLIST_H */
> -- 
> 2.30.0.617.g56c4b15f3c-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ