Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1356700
| From | Jan Kiszka <jan.kiszka@siemens.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv3 10/13] scripts/gdb: Add cpu iterators |
| Date | 2016-03-13 17:40 +0100 |
| Message-ID | <rchdD-8dH-1@gated-at.bofh.it> (permalink) |
| References | <r8zVv-6xi-3@gated-at.bofh.it> <r8zVy-6xi-65@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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@linaro.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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCHv3 10/13] scripts/gdb: Add cpu iterators Jan Kiszka <jan.kiszka@siemens.com> - 2016-03-13 17:40 +0100 Re: [PATCHv3 10/13] scripts/gdb: Add cpu iterators Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-13 19:40 +0100
csiph-web