From: Namhyung Kim <namhyung@kernel.org>
To: Aaron Tomlin <atomlin@atomlin.com>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, howardchu95@gmail.com, neelx@suse.com,
chjohnst@mail.com, sean@ashe.io, steve@abita.co,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] perf trace: Add --bitmask-list command-line option
Date: Wed, 22 Jul 2026 22:49:33 -0700 [thread overview]
Message-ID: <amGrbXzdup2hvg3k@google.com> (raw)
In-Reply-To: <20260722155050.503516-3-atomlin@atomlin.com>
On Wed, Jul 22, 2026 at 11:50:49AM -0400, Aaron Tomlin wrote:
> Introduce a new '--bitmask-list' command-line option for 'perf trace'.
> When this option is specified, the formatting of cpumasks is delegated
> to bitmap_scnprintf(), enabling cpumasks to be displayed as a condensed,
> human-readable list (e.g., "0,2-5,7") instead of the default hexadecimal
> representation. An example is provided below:
Do you know any other places than cpumask use bitmask too? I'm just
curious if it needs to handle other cases or not.
Thanks,
Namhyung
>
> ❯ sudo ./perf trace --show-cpu --bitmask-list --event ipi:ipi_send_cpumask --max-event 5
> 0.000 [000] Xorg/1434 ipi:ipi_send_cpumask(cpumask: 2-3,6, callsite: 0xffffffff9994f8e4, callback: 0xffffffff9994fdd0)
> 694.527 [002] chrome/2894 ipi:ipi_send_cpumask(cpumask: 1,3-5, callsite: 0xffffffff9994f8e4, callback: 0xffffffff9994fdd0)
> 2666.608 [003] Chrome_ChildIO/2948 ipi:ipi_send_cpumask(cpumask: 4,7, callsite: 0xffffffff9994f8e4, callback: 0xffffffff9994fdd0)
> 2673.638 [000] Chrome_IOThrea/2920 ipi:ipi_send_cpumask(cpumask: 2-5, callsite: 0xffffffff9994f8e4, callback: 0xffffffff9994fdd0)
> 2714.228 [005] chrome/3375 ipi:ipi_send_cpumask(cpumask: 0-4,6-7, callsite: 0xffffffff9994f8e4, callback: 0xffffffff9994fdd0)
>
> Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
> ---
> tools/perf/Documentation/perf-trace.txt | 4 ++++
> tools/perf/builtin-trace.c | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
> index d0b6c771a1b9..d20b43ea3d37 100644
> --- a/tools/perf/Documentation/perf-trace.txt
> +++ b/tools/perf/Documentation/perf-trace.txt
> @@ -247,6 +247,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
> pretty-printing serves as a fallback to hand-crafted pretty printers, as the latter can
> better pretty-print integer flags and struct pointers.
>
> +--bitmask-list::
> + Show bitmasks as a human-readable, condensed list (e.g. "0,2-5,7")
> + instead of the default hexadecimal representation.
> +
> --bpf-summary::
> Collect system call statistics in BPF. This is only for live mode and
> works well with -s/--summary option where no argument information is
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 5808adad52ae..9307c2aae4ba 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -226,6 +226,7 @@ struct trace {
> bool force;
> bool vfs_getname;
> bool force_btf;
> + bool bitmask_list;
> bool summary_bpf;
> int trace_pgfaults;
> char *perfconfig_events;
> @@ -3280,6 +3281,9 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct perf_sample *
>
> if (syscall_arg.len == 0) {
> printed += scnprintf(bf + printed, size - printed, "0");
> + } else if (trace->bitmask_list) {
> + printed += bitmap_scnprintf(mask, syscall_arg.len * 8,
> + bf + printed, size - printed);
> } else {
> int i;
> bool skip_zero = true;
> @@ -5590,6 +5594,7 @@ int cmd_trace(int argc, const char **argv)
> "start"),
> OPT_BOOLEAN(0, "force-btf", &trace.force_btf, "Prefer btf_dump general pretty printer"
> "to customized ones"),
> + OPT_BOOLEAN(0, "bitmask-list", &trace.bitmask_list, "Show bitmask as a human-readable list"),
> OPT_BOOLEAN(0, "bpf-summary", &trace.summary_bpf, "Summary syscall stats in BPF"),
> OPT_INTEGER(0, "max-summary", &trace.max_summary,
> "Max number of entries in the summary."),
> --
> 2.54.0
>
prev parent reply other threads:[~2026-07-23 5:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 15:50 [PATCH v4 0/2] perf trace: Correct cpumask formatting and add --bitmask-list Aaron Tomlin
2026-07-22 15:50 ` [PATCH v4 1/2] perf trace: Correct default cpumask formatting to hexadecimal Aaron Tomlin
2026-07-22 15:50 ` [PATCH v4 2/2] perf trace: Add --bitmask-list command-line option Aaron Tomlin
2026-07-23 5:49 ` Namhyung Kim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amGrbXzdup2hvg3k@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atomlin@atomlin.com \
--cc=chjohnst@mail.com \
--cc=howardchu95@gmail.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=neelx@suse.com \
--cc=peterz@infradead.org \
--cc=sean@ashe.io \
--cc=steve@abita.co \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.