STRUCT PERF_SESSION(9)
π struct perf_session(9) π
ok so bestie, welcome to struct perf_session(9) β the Kernel API Manual page for one of perf's biggest main-character structs. lowkey iconic. no cap.
β¨ NAME β¨
struct perf_session β bestie this is A Perf session, and it's literally the struct that holds the main state when the program is working with live perf events or reading data from an input file. it's giving "the whole vibe lives here." π«Ά
π¦ SYNOPSIS π¦
struct perf_session {
struct perf_header header;
struct machines machines;
struct evlist *evlist;
const struct auxtrace *auxtrace;
struct itrace_synth_opts *itrace_synth_opts;
struct list_head auxtrace_index;
#ifdef HAVE_LIBTRACEEVENT;
struct trace_event tevent;
#endif;
struct perf_record_time_conv time_conv;
bool trace_event_repipe;
bool one_mmap;
void *one_mmap_addr;
u64 one_mmap_offset;
u64 one_mmap_size;
struct ordered_events ordered_events;
struct perf_data *data;
const struct perf_tool *tool;
u64 bytes_transferred;
u64 bytes_compressed;
struct zstd_data zstd_data;
struct decomp_data decomp_data;
struct decomp_data *active_decomp;
};
copy it exactly, bestie, don't go editing it, that's the whole point π
π MEMBERS π
okay now the fun part β let's meet the whole squad, member by member, no skipping, we go through ALL of them π
headerβ the read version of aperf_file_header, or it captures global information from a live session. either way it's carrying the lore.machinesβ Machines within the session: a host and 0 or more guests. the whole little family πΈevlistβ List of evsels/events of the session. the actual events, the stars of the show βauxtraceβ callbacks to allow AUX area data decoding. lowkey the decoder ring π₯itrace_synth_optsβ AUX area tracing synthesis options. all the knobs for synthesis, slay.auxtrace_indexβ index of AUX area tracing events within aperf.datafile. the findability agenda β¨teventβ handles forlibtraceeventand plugins. (only hangs around whenHAVE_LIBTRACEEVENTis defined, iykyk π¦)time_convβ Holds contents of lastPERF_RECORD_TIME_CONVevent. time math, but make it stored π«trace_event_repipeβ When set, causes read trace events to be written tostdout. yes, set it and it's repipe girl summer.one_mmapβ The reader will use a single mmap by default. There may be multiple data files, in particular for aux events. If this istruethen the single big mmap for the data file can be assumed. big one-mmap energy.one_mmap_addrβ Address of initialperfdata file reader mmap. the address, periodt.one_mmap_offsetβ File offset inperf.datafile when mapped.one_mmap_sizeβ Size of the single mmap, in bytes. it's a size. in bytes. respect it π«Άordered_eventsβ Used to turn unordered events into ordered ones. literally the glow-up machine for your event ordering πdataβ Optionalperfdata file being read from. optional bestie, don't assume.toolβ callbacks for event handling. the handlers, the crew, the ones who do the doing πbytes_transferredβ Used byperf recordto count written bytes before compression.bytes_compressedβ Used byperf recordto count written bytes after compression. yes it's a different count, keep both, don't merge them πzstd_dataβ Owner of global compression state, buffers, etc. it holds the compression stuff, it's the owner, it's the moment πdecomp_dataβ decompression data, chillin' right there in the struct.decomp_data*active_decompβ a pointer to the decompression data that's currently active. the one on duty π§
π DESCRIPTION π
kay so The rough organization of a perf_session is literally this, like, whole tree vibe:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Session 1..* -----> Machine 1..* -----> Thread β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
a Session points to 1..* Machines, and each Machine points to 1..* Threads. it's giving nesting dolls. it's giving family tree. it's giving the whole hierarchy eaten and left no crumbs π
π₯ SEE ALSO π₯
- Kernel file
./tools/perf/util/session.hβ go read it, bestie, that's where the real tea is π¦
and that's the page!! sending you so much love and also a single big mmap π from ./tools/perf/util, dated October 2026 β mwah, go slay your perf session bestie πβ¨π
π¦ 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