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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z89R43ObY3tQptmb@x1>
Date: Mon, 10 Mar 2025 17:56:03 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...ux.intel.com>,
	Yicong Yang <yangyicong@...ilicon.com>,
	James Clark <james.clark@...aro.org>,
	"Dr. David Alan Gilbert" <linux@...blig.org>,
	Levi Yun <yeoreum.yun@....com>, Ze Gao <zegao2021@...il.com>,
	Weilin Wang <weilin.wang@...el.com>, Xu Yang <xu.yang_2@....com>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	Howard Chu <howardchu95@...il.com>
Subject: Re: [PATCH v2 09/11] perf python: Add evlist all_cpus accessor

On Fri, Feb 28, 2025 at 02:23:06PM -0800, Ian Rogers wrote:
> Add a means to get the reference counted all_cpus CPU map from an
> evlist in its python form.

Reviewed-by: Arnaldo Carvalho de Melo <acme@...hat.com>

- Arnaldo
 
> Reviewed-by: Howard Chu <howardchu95@...il.com>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/util/python.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index 7f2513ffe866..c55c8392bc07 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -874,6 +874,16 @@ static void pyrf_evlist__delete(struct pyrf_evlist *pevlist)
>  	Py_TYPE(pevlist)->tp_free((PyObject*)pevlist);
>  }
>  
> +static PyObject *pyrf_evlist__all_cpus(struct pyrf_evlist *pevlist)
> +{
> +	struct pyrf_cpu_map *pcpu_map = PyObject_New(struct pyrf_cpu_map, &pyrf_cpu_map__type);
> +
> +	if (pcpu_map)
> +		pcpu_map->cpus = perf_cpu_map__get(pevlist->evlist.core.all_cpus);
> +
> +	return (PyObject *)pcpu_map;
> +}
> +
>  static PyObject *pyrf_evlist__mmap(struct pyrf_evlist *pevlist,
>  				   PyObject *args, PyObject *kwargs)
>  {
> @@ -1057,6 +1067,12 @@ static PyObject *pyrf_evlist__enable(struct pyrf_evlist *pevlist)
>  }
>  
>  static PyMethodDef pyrf_evlist__methods[] = {
> +	{
> +		.ml_name  = "all_cpus",
> +		.ml_meth  = (PyCFunction)pyrf_evlist__all_cpus,
> +		.ml_flags = METH_NOARGS,
> +		.ml_doc	  = PyDoc_STR("CPU map union of all evsel CPU maps.")
> +	},
>  	{
>  		.ml_name  = "mmap",
>  		.ml_meth  = (PyCFunction)pyrf_evlist__mmap,
> -- 
> 2.48.1.711.g2feabab25a-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ