STRUCT PERF_SESSION(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 a perf_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 a perf.data file. the findability agenda ✨
  • tevent β€” handles for libtraceevent and plugins. (only hangs around when HAVE_LIBTRACEEVENT is defined, iykyk πŸ¦‹)
  • time_conv β€” Holds contents of last PERF_RECORD_TIME_CONV event. time math, but make it stored πŸ’«
  • trace_event_repipe β€” When set, causes read trace events to be written to stdout. 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 is true then the single big mmap for the data file can be assumed. big one-mmap energy.
  • one_mmap_addr β€” Address of initial perf data file reader mmap. the address, periodt.
  • one_mmap_offset β€” File offset in perf.data file 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 β€” Optional perf data 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 by perf record to count written bytes before compression.
  • bytes_compressed β€” Used by perf record to 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