Re: [PATCH v5 08/12] perf annotate: Add 'T' hot key to toggle data type display
From: Namhyung Kim
Date: Wed Aug 20 2025 - 19:44:36 EST
On Wed, Aug 20, 2025 at 06:13:15PM -0300, Arnaldo Carvalho de Melo wrote:
> On Fri, Aug 15, 2025 at 08:16:31PM -0700, Namhyung Kim wrote:
> > Support data type display with a key press so that users can toggle the
> > output dynamically on TUI. Also display "[Type]" in the title line if
> > it's enabled.
>
> Testing here I see:
>
> 0.81 │ mov 0x9c(%r8),%r11d # data-type: struct cfs_rq +0x9c
>
> If I ask for source code by pressing 's':
>
> │ delta += sa->period_contrib; ▒
> 0.97 │ mov 0x9c(%r8),%r11d # data-type: struct cfs_rq +0x9c
>
> So it is the 'period_contrib' field of 'struct cfs_rq', humm, not:
>
> root@number:~# pahole -E --hex cfs_rq | grep 0x9c -B 10 -A10
> struct sched_entity * next; /* 0x60 0x8 */
>
> /* XXX 24 bytes hole, try to pack */
>
> /* --- cacheline 2 boundary (128 bytes) --- */
> struct sched_avg {
> /* typedef u64 -> __u64 */ long long unsigned int last_update_time; /* 0x80 0x8 */
> /* typedef u64 -> __u64 */ long long unsigned int load_sum; /* 0x88 0x8 */
> /* typedef u64 -> __u64 */ long long unsigned int runnable_sum; /* 0x90 0x8 */
> /* typedef u32 -> __u32 */ unsigned int util_sum; /* 0x98 0x4 */
> /* typedef u32 -> __u32 */ unsigned int period_contrib; /* 0x9c 0x4 */
> long unsigned int load_avg; /* 0xa0 0x8 */
> long unsigned int runnable_avg; /* 0xa8 0x8 */
> long unsigned int util_avg; /* 0xb0 0x8 */
> unsigned int util_est; /* 0xb8 0x4 */
> } avg __attribute__((__aligned__(64))); /* 0x80 0x40 */
>
> /* XXX last struct has 4 bytes of padding */
>
> /* --- cacheline 3 boundary (192 bytes) --- */
> struct {
> root@number:~#
>
> So it is in a subtype and probably this is an improvement to be made,
> right?
It seems %r8 contains a pointer to cfs_rq and there's a variable for sa
(sched_avg) but it actually uses the same register as it's embeded. I
think DWARF has correct location expression to find the containing data
type and the output looks ok. In general, I'd prefer seeing outer types.
Thanks,
Namhyung