include/linux/trace_events.h
Source file repositories/reference/linux-study-clean/include/linux/trace_events.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/trace_events.h- Extension
.h- Size
- 30895 bytes
- Lines
- 993
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ring_buffer.hlinux/trace_seq.hlinux/percpu.hlinux/hardirq.hlinux/perf_event.hlinux/tracepoint.h
Detected Declarations
struct trace_arraystruct array_bufferstruct tracerstruct dentrystruct bpf_progstruct trace_iteratorstruct trace_eventstruct trace_dynamic_infostruct trace_entrystruct trace_iteratorstruct trace_event_functionsstruct trace_eventstruct trace_event_filestruct event_filterstruct trace_event_callstruct trace_event_fieldsstruct trace_event_classstruct trace_event_bufferstruct trace_event_callstruct trace_subsystem_dirstruct dynevent_cmdstruct dynevent_cmdstruct synth_field_descstruct synth_eventstruct synth_event_trace_statestruct trace_event_filestruct bpf_raw_tp_linkstruct bpf_raw_tp_linkstruct perf_eventenum trace_iter_flagsenum print_line_tenum trace_flag_typeenum trace_regenum dynevent_typeenum event_trigger_typefunction tracing_generic_entry_updatefunction tracing_gen_ctx_flagsfunction tracing_gen_ctxfunction tracing_gen_ctx_decfunction trace_event_dyn_try_get_reffunction trace_event_dyn_put_reffunction trace_event_try_get_reffunction trace_event_put_reffunction bpf_prog_array_validfunction trace_event_namefunction trace_get_fieldsfunction hist_poll_wakeupfunction hist_poll_wakeup
Annotated Snippet
struct trace_dynamic_info {
#ifdef CONFIG_CPU_BIG_ENDIAN
u16 len;
u16 offset;
#else
u16 offset;
u16 len;
#endif
} __packed;
/*
* The trace entry - the most basic unit of tracing. This is what
* is printed in the end as a single line in the trace output, such as:
*
* bash-15816 [01] 235.197585: idle_cpu <- irq_enter
*/
struct trace_entry {
unsigned short type;
unsigned char flags;
unsigned char preempt_count;
int pid;
};
#define TRACE_EVENT_TYPE_MAX \
((1 << (sizeof(((struct trace_entry *)0)->type) * 8)) - 1)
/*
* Trace iterator - used by printout routines who present trace
* results to users and which routines might sleep, etc:
*/
struct trace_iterator {
struct trace_array *tr;
struct tracer *trace;
struct array_buffer *array_buffer;
void *private;
int cpu_file;
struct mutex mutex;
struct ring_buffer_iter **buffer_iter;
unsigned long iter_flags;
void *temp; /* temp holder */
unsigned int temp_size;
char *fmt; /* modified format holder */
unsigned int fmt_size;
atomic_t wait_index;
/* trace_seq for __print_flags() and __print_symbolic() etc. */
struct trace_seq tmp_seq;
cpumask_var_t started;
/* Set when the file is closed to prevent new waiters */
bool closed;
/* it's true when current open file is snapshot */
bool snapshot;
/* The below is zeroed out in pipe_read */
struct trace_seq seq;
struct trace_entry *ent;
unsigned long lost_events;
int leftover;
int ent_size;
int cpu;
u64 ts;
loff_t pos;
long idx;
/* All new field here will be zeroed out in pipe_read */
};
enum trace_iter_flags {
TRACE_FILE_LAT_FMT = 1,
TRACE_FILE_ANNOTATE = 2,
TRACE_FILE_TIME_IN_NS = 4,
TRACE_FILE_PAUSE = 8,
};
typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
int flags, struct trace_event *event);
struct trace_event_functions {
trace_print_func trace;
trace_print_func raw;
trace_print_func hex;
trace_print_func binary;
};
struct trace_event {
Annotation
- Immediate include surface: `linux/ring_buffer.h`, `linux/trace_seq.h`, `linux/percpu.h`, `linux/hardirq.h`, `linux/perf_event.h`, `linux/tracepoint.h`.
- Detected declarations: `struct trace_array`, `struct array_buffer`, `struct tracer`, `struct dentry`, `struct bpf_prog`, `struct trace_iterator`, `struct trace_event`, `struct trace_dynamic_info`, `struct trace_entry`, `struct trace_iterator`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.