• Steven Rostedt (Google)'s avatar
    eprobes: Remove redundant event type information · b61edd57
    Steven Rostedt (Google) authored
    Currently, the event probes save the type of the event they are attached
    to when recording the event. For example:
    
      # echo 'e:switch sched/sched_switch prev_state=$prev_state prev_prio=$prev_prio next_pid=$next_pid next_prio=$next_prio' > dynamic_events
      # cat events/eprobes/switch/format
    
     name: switch
     ID: 1717
     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:unsigned int __probe_type;        offset:8;       size:4; signed:0;
            field:u64 prev_state;   offset:12;      size:8; signed:0;
            field:u64 prev_prio;    offset:20;      size:8; signed:0;
            field:u64 next_pid;     offset:28;      size:8; signed:0;
            field:u64 next_prio;    offset:36;      size:8; signed:0;
    
     print fmt: "(%u) prev_state=0x%Lx prev_prio=0x%Lx next_pid=0x%Lx next_prio=0x%Lx", REC->__probe_type, REC->prev_state, REC->prev_prio, REC->next_pid, REC->next_prio
    
    The __probe_type adds 4 bytes to every event.
    
    One of the reasons for creating eprobes is to limit what is traced in an
    event to be able to limit what is written into the ring buffer. Having
    this redundant 4 bytes to every event takes away from this.
    
    The event that is recorded can be retrieved from the event probe itself,
    that is available when the trace is happening. For user space tools, it
    could simply read the dynamic_event file to find the event they are for.
    So there is really no reason to write this information into the ring
    buffer for every event.
    
    Link: https://lkml.kernel.org/r/20220218190057.2f5a19a8@gandalf.local.homeAcked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Reviewed-by: default avatarJoel Fernandes <joel@joelfernandes.org>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    b61edd57
trace_probe.c 27.8 KB