STRUCT TRACER(9)
πΈ 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 theavailable_tracersfileinitβ 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 whenevertracing_threshgets updatedopenβ gets called when thetracefile is openedpipe_openβ gets called when thetrace_pipefile is openedcloseβ gets called when thetracefile is releasedpipe_closeβ gets called when thetrace_pipefile is releasedreadβ overrides the defaultreadcallback ontrace_pipesplice_readβ overrides the defaultsplice_readcallback ontrace_pipeselftestβ the selftest that runs on boot (seetrace_selftest.c)print_lineβ the callback that prints a trace, literally its whole moment β¨set_flagβ signals that one of your private flags changed (thetrace_optionsfile)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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms