STRUCT PT_BUFFER(9)
π struct pt_buffer(9) β Kernel API Manual, but make it a group chat π
okay bestie, so this is a page from the Kernel API Manual and it's literally about struct pt_buffer β which is the buffer configuration, and there's one buffer per task_struct or per cpu, depending on the perf event configuration. slay. two possible situations, one struct, very main character.
β¨ NAME β¨
struct pt_buffer β it's giving buffer configuration energy π one buffer per task_struct or cpu, depending on your perf event configuration. iykyk.
π¦ SYNOPSIS π¦
struct pt_buffer {
struct list_head tables;
struct topa *first, *last, *cur;
unsigned int cur_idx;
size_t output_off;
unsigned long nr_pages;
local_t data_size;
local64_t head;
bool snapshot;
bool single;
bool wrapped;
long stop_pos, intr_pos;
struct topa_entry *stop_te, *intr_te;
void **data_pages;
};
like, that's the whole struct, no cap. copy it exactly if you need it, i'm not touching a single character π
π Members π
okay so now we go through every single member, and no we are not skipping any, bestie. this is the whole list. periodt.
tablesβ the list of ToPA tables chilling in this buffer π«Άfirstβ shorthand for the first topa table, it's just a lil nicknamelastβ shorthand for the last topa table, same vibecurβ the current topa table, the one we're literally on right nowcur_idxβ the index of the current output region withincur's tableoutput_offβ offset within the current output region, yes it's offset-ceptionnr_pagesβ buffer size, in pages (pages!! not bytes, bestie, watch out)data_sizeβ a running total of how much data is in this buffer, like a little counter keeping track πΈheadβ the logical write offset inside the buffer, this is where the writing vibes happensnapshotβtrueif this is for a snapshot/overwrite countersingleβ use Single Range Output instead of ToPAwrappedβ buffer advance wrapped back to the first topa table, it did a little loop πstop_posβ the STOP topa entry indexintr_posβ the INT topa entry indexstop_teβ the STOP topa entry pointerintr_teβ the INT topa entry pointerdata_pagesβ array of pages from perf
π friendly reminder:stop_pos/intr_posare the index versions andstop_te/intr_teare the pointer versions. don't mix them up, i'm begging π
π SEE ALSO π
go look at the kernel file ./arch/x86/events/intel/pt.h, and also these icons:
struct pt_filter(9)struct pt_filters(9)struct pt(9)
β and that's the whole page, bestie. it lives under ./arch/x86/events/intel, dated October 2026, and you can find it chilling in struct pt_buffer(9) whenever you need it. ate and left no crumbs ππ
π¦ 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