STRUCT TRACER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

struct tracer β€” it's the blueprint for one specific tracer, like, all the callbacks it uses to vibe with tracefs 🫢


✨ SYNOPSIS ✨

okay bestie, here's the whole struct, no notes, copy it exactly:

struct tracer {
    const char              *name;
    int (*init)(struct trace_array *tr);
    void (*reset)(struct trace_array *tr);
    void (*start)(struct trace_array *tr);
    void (*stop)(struct trace_array *tr);
    int (*update_thresh)(struct trace_array *tr);
    void (*open)(struct trace_iterator *iter);
    void (*pipe_open)(struct trace_iterator *iter);
    void (*close)(struct trace_iterator *iter);
    void (*pipe_close)(struct trace_iterator *iter);
    ssize_t (*read)(struct trace_iterator *iter, struct file *filp, char
__user *ubuf, size_t cnt, loff_t *ppos);
    ssize_t (*splice_read)(struct trace_iterator *iter, struct file
*filp, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned
int flags);
  #ifdef CONFIG_FTRACE_STARTUP_TEST;
    int (*selftest)(struct tracer *trace, struct trace_array *tr);
  #endif;
    void (*print_header)(struct seq_file *m);
    enum print_line_t       (*print_line)(struct trace_iterator *iter);
    int (*set_flag)(struct trace_array *tr, u32 old_flags, u32 bit, int
set);
    int (*flag_changed)(struct trace_array *tr, u64 mask, int set);
    struct tracer           *next;
    struct tracer_flags     *flags;
    struct tracer_flags     *default_flags;
    int enabled;
    bool print_max;
    bool allow_instances;
  #ifdef CONFIG_TRACER_MAX_TRACE;
    bool use_max_tr;
  #endif;
    bool noboot;
 };

πŸ‘‘ Members

okay so here's the cast of characters, each one doing its little job πŸ’…

  • name β€” the name you chose for it, the one that shows up so you can select it from the available_tracers file
  • init β€” gets called when you switch over to this tracer (echo name > current_tracer)
  • reset β€” gets called when you switch to some other tracer, byee πŸ‘‹
  • start β€” gets called when tracing gets unpaused (echo 1 > tracing_on)
  • stop β€” gets called when tracing gets paused (echo 0 > tracing_on)
  • update_thresh β€” gets called whenever tracing_thresh gets updated
  • open β€” gets called when the trace file is opened
  • pipe_open β€” gets called when the trace_pipe file is opened
  • close β€” gets called when the trace file is released
  • pipe_close β€” gets called when the trace_pipe file is released
  • read β€” overrides the default read callback on trace_pipe
  • splice_read β€” overrides the default splice_read callback on trace_pipe
  • selftest β€” the selftest that runs on boot (see trace_selftest.c)
  • print_line β€” the callback that prints a trace, literally its whole moment ✨
  • set_flag β€” signals that one of your private flags changed (the trace_options file)
  • flags β€” your private flags, your lil collection πŸŽ€

🌈 SEE ALSO 🌈

Kernel file ./kernel/trace/trace.h struct cond_snapshot(9), tracer_tracing_is_on_cpu(9), event_trigger_unlock_commit(9), struct event_command(9), enum event_command_flags(9) β€” go read those next, iykyk πŸ”₯


ngl that's the whole page, bestie. go forth and tracer πŸ’–

mwah, this one's from ./kernel/trace, dated October 2026, and it's struct tracer(9) β€” slay, periodt πŸ‘‘

πŸ“¦ where this page comes from