Re: [PATCH v4] perf trace: Introduce --show-cpu option to display cpu id

From: Namhyung Kim

Date: Mon May 18 2026 - 02:51:01 EST


Hello,

On Sat, May 16, 2026 at 10:03:40AM -0400, Aaron Tomlin wrote:
> On Fri, Apr 24, 2026 at 05:29:33PM -0400, Aaron Tomlin wrote:
> > When tracing system-wide workloads or specific events, it is highly
> > valuable to know exactly which CPU executed a specific event. Currently,
> > perf trace output defaults to omitting CPU information.
> >
> > Introduce a new "--show-cpu" command-line option. When provided, this
> > flag extracts the CPU from the perf sample and prints it in a "[000]"
> > format immediately following the timestamp. This mirrors the behaviour of
> > other tracing tools like ftrace and perf script. For example:
> >
> > # perf trace -e sched:sched_switch --max-events 5 --show-cpu
> > 0.000 [002] :0/0 sched:sched_switch(prev_comm: "swapper/2", prev_prio: 120, next_comm: "rcu_preempt", next_pid: 16 (rcu_preempt), next_prio: 120)
> > 0.009 [002] rcu_preempt/16 sched:sched_switch(prev_comm: "rcu_preempt", prev_pid: 16 (rcu_preempt), prev_prio: 120, prev_state: 128, next_comm: "swapper/2", next_prio: 120)
> > 0.033 [002] :0/0 sched:sched_switch(prev_comm: "swapper/2", prev_prio: 120, next_comm: "kworker/u32:48", next_pid: 35840 (kworker/u32:48-), next_prio: 120)
> > 0.041 [002] kworker/u32:48/35840 sched:sched_switch(prev_comm: "kworker/u32:48", prev_pid: 35840 (kworker/u32:48-), prev_prio: 120, prev_state: 128, next_comm: "swapper/2", next_prio: 120)
> > 0.045 [002] :0/0 sched:sched_switch(prev_comm: "swapper/2", prev_prio: 120, next_comm: "kworker/u32:48", next_pid: 35840 (kworker/u32:48-), next_prio: 120)
> >
> > The feature is implemented strictly as an opt-in toggle to prevent
> > cluttering the standard output and to preserve backwards compatibility
> > for scripts parsing the default output format.
>
> Hi Peter, Ingo, Arnaldo, Namhyung,
>
> Just a gentle ping on this patch. It has been a few weeks since v4 was
> submitted [1].
>
> Are there any further comments or revisions needed, or is this in a good
> state to be picked up?
>
> [1]: https://lore.kernel.org/lkml/20260424212933.151154-1-atomlin@xxxxxxxxxxx/

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks,
Namhyung