Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425388

Re: [RFC/PATCH] perf: Add sizeof operator support

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [RFC/PATCH] perf: Add sizeof operator support
Date 2016-06-17 21:10 +0200
Message-ID <rL7jr-22f-3@gated-at.bofh.it> (permalink)
References <rJZxD-7jp-17@gated-at.bofh.it> <rL4EW-my-43@gated-at.bofh.it> <rL4Yh-tv-17@gated-at.bofh.it> <rL5hE-Ak-17@gated-at.bofh.it> <rL79L-1JV-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 17 Jun 2016 13:57:44 -0500
Jeremy Linton <jeremy.linton@arm.com> wrote:


> That is the simple case, initially I was going to just hand code some of 
> the sizeofs in the kernel, but then I started noticing more complex 
> cases, and why I RFCed this patch.
> 
> For example, on x64/xen there are fair number with sizeof(pXXval_t), 
> IIRC I've also seen a fair number of sizeof(struct page *). Some, but I 
> dont think all of these case be determined from the field sizes like 
> this one:

Right, but there's no easy fix for that. Your patch wont fix these,
because they can change over time.

Now, what we can do is add a sizeof() helper that is like the
TRACE_DEFINE_ENUM() macro. We could add a TRACE_DEFINE_SIZEOF(), that
basically does the same, and in update_event_printk() we could
substitute the sizeof() with the actual number value.

You want to take a crack at that?

Take a look at commit 0c564a538aa93.

-- Steve


> 
> [root@X tracing]# cat events/xen/xen_mmu_set_pte/format
> name: xen_mmu_set_pte
> ID: 45
> format:
>          field:unsigned short common_type;       offset:0;       size:2; 
> signed:0;
>          field:unsigned char common_flags;       offset:2;       size:1; 
> signed:0;
>          field:unsigned char common_preempt_count;       offset:3; 
>   size:1; signed:0;
>          field:int common_pid;   offset:4;       size:4; signed:1;
> 
>          field:pte_t * ptep;     offset:8;       size:8; signed:0;
>          field:pteval_t pteval;  offset:16;      size:8; signed:0;
> 
> print fmt: "ptep %p pteval %0*llx (raw %0*llx)", REC->ptep, 
> (int)sizeof(pteval_t) * 2, (unsigned long 
> long)pte_val(native_make_pte(REC->pteval)), (int)sizeof(pteval_t) * 2, 
> (unsigned long long)REC->pteval
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-14 18:40 +0200
  Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 18:20 +0200
    Re: [RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-17 18:40 +0200
      Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 19:00 +0200
        Re: [RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-17 21:00 +0200
          Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 21:10 +0200
            Re: [RFC/PATCH] perf: Add sizeof operator support Namhyung Kim <namhyung@kernel.org> - 2016-06-20 02:50 +0200

csiph-web