linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Subject: Re: [PATCH] perf annotate-data: Set bitfield member offset and size properly
Date: Tue, 20 Aug 2024 17:42:28 -0300	[thread overview]
Message-ID: <ZsT_tHyuwb8L3KVB@x1> (raw)
In-Reply-To: <20240815223823.2402285-1-namhyung@kernel.org>

On Thu, Aug 15, 2024 at 03:38:23PM -0700, Namhyung Kim wrote:
> The bitfield members might not have DW_AT_data_member_location.  Let's
> use DW_AT_data_bit_offset to set the member offset correct.  Also use
> DW_AT_bit_size for the name like in a C program.

Thanks, applied and added the series of steps to reproduce your results:

    Commiter notes:
    
    Collect some data:
    
      root@number:~# perf mem record -a --ldlat 5 -- ping -s 8193 -f 192.168.86.1
      Memory events are enabled on a subset of CPUs: 16-27
      PING 192.168.86.1 (192.168.86.1) 8193(8221) bytes of data.
      .^C
      --- 192.168.86.1 ping statistics ---
      13881 packets transmitted, 13880 received, 0.00720409% packet loss, time 8664ms
      rtt min/avg/max/mdev = 0.510/0.599/7.768/0.115 ms, ipg/ewma 0.624/0.593 ms
      [ perf record: Woken up 8 times to write data ]
      [ perf record: Captured and wrote 14.877 MB perf.data (46785 samples) ]
    
      root@number:~#
      root@number:~# perf evlist
      cpu_atom/mem-loads,ldlat=5/P
      cpu_atom/mem-stores/P
      dummy:u
      root@number:~# perf evlist -v
      cpu_atom/mem-loads,ldlat=5/P: type: 10 (cpu_atom), size: 136, config: 0x5d0 (mem-loads), { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|IDENTIFIER|DATA_SRC|WEIGHT_STRUCT, read_format: ID|LOST, disabled: 1, inherit: 1, freq: 1, precise_ip: 3, sample_id_all: 1, { bp_addr, config1 }: 0x7
      cpu_atom/mem-stores/P: type: 10 (cpu_atom), size: 136, config: 0x6d0 (mem-stores), { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|IDENTIFIER|DATA_SRC|WEIGHT_STRUCT, read_format: ID|LOST, disabled: 1, inherit: 1, freq: 1, precise_ip: 3, sample_id_all: 1
      dummy:u: type: 1 (software), size: 136, config: 0x9 (PERF_COUNT_SW_DUMMY), { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|ADDR|CPU|IDENTIFIER|DATA_SRC|WEIGHT_STRUCT, read_format: ID|LOST, inherit: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, task: 1, mmap_data: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
      root@number:~#
    
    Ok, now lets see what changes from before this patch to after it:
    
      root@number:~# perf annotate --data-type > /tmp/before
    
    Apply the patch, build:
    
      root@number:~# perf annotate --data-type > /tmp/after
    
    The first hunk of the diff, for a glib data structure, in userspace,
    look at those bitfields:
    
      root@number:~# diff -u10 /tmp/before /tmp/after | head -20
      --- /tmp/before       2024-08-20 17:29:58.306765780 -0300
      +++ /tmp/after        2024-08-20 17:33:13.210582596 -0300
      @@ -163,22 +163,22 @@
    
       Annotate type: 'GHashTable' in /usr/lib64/libglib-2.0.so.0.8000.3 (1 samples):
       ============================================================================
        Percent     offset       size  field
         100.00          0         96  GHashTable    {
           0.00          0          8      gsize    size;
           0.00          8          4      gint     mod;
         100.00         12          4      guint    mask;
           0.00         16          4      guint    nnodes;
           0.00         20          4      guint    noccupied;
      -    0.00          0          4      guint    have_big_keys;
      -    0.00          0          4      guint    have_big_values;
      +    0.00         24          1      guint    have_big_keys:1;
      +    0.00         24          1      guint    have_big_values:1;
           0.00         32          8      gpointer keys;
           0.00         40          8      guint*   hashes;
           0.00         48          8      gpointer values;
      root@number:~#
    
    As advertised :-)
    
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>


  reply	other threads:[~2024-08-20 20:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 22:38 [PATCH] perf annotate-data: Set bitfield member offset and size properly Namhyung Kim
2024-08-20 20:42 ` Arnaldo Carvalho de Melo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-13  3:08 Namhyung Kim

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=ZsT_tHyuwb8L3KVB@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).