[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56E5965F.5030001@siemens.com>
Date: Sun, 13 Mar 2016 17:33:35 +0100
From: Jan Kiszka <jan.kiszka@...mens.com>
To: Kieran Bingham <kieran.bingham@...aro.org>,
linux-kernel@...r.kernel.org
Cc: lee.jones@...aro.org, peter.griffin@...aro.org,
maxime.coquelin@...com
Subject: Re: [PATCHv3 10/13] scripts/gdb: Add cpu iterators
On 2016-03-03 12:41, Kieran Bingham wrote:
> The linux kernel provides macro's for iterating against values from the
> cpu_list masks. By providing some commonly used masks, we can mirror the
> kernels helper macros with easy to use generators.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@...aro.org>
> ---
> scripts/gdb/linux/cpus.py | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py
> index 4297b83fedef..59e24472c507 100644
> --- a/scripts/gdb/linux/cpus.py
> +++ b/scripts/gdb/linux/cpus.py
> @@ -100,6 +100,27 @@ def cpu_list(mask_name):
> yield cpu
>
>
> +def each_online_cpu():
> + for cpu in cpu_list("cpu_online_mask"):
> + yield cpu
> +
> +
> +def each_present_cpu():
> + for cpu in cpu_list("cpu_present_mask"):
> + yield cpu
> +
> +
> +def each_possible_cpu():
> + for cpu in cpu_list("cpu_possible_mask"):
> + yield cpu
> +
This patch requires rebasing over master (these masks became macros).
In general, please base on master or even next before posting.
> +
> +def print_cpus():
> + gdb.write("Possible CPUS : {}\n".format(list(each_possible_cpu())))
> + gdb.write("Present CPUS : {}\n".format(list(each_present_cpu())))
> + gdb.write("Online CPUS : {}\n".format(list(each_online_cpu())))
I think this can be useful. Let's make it a real, discoverable command.
lx-cpus?
> +
> +
> class PerCpu(gdb.Function):
> """Return per-cpu variable.
>
>
Jan
--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
Powered by blists - more mailing lists