STRUCT SAMPLE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct sample(9) β€” Kernel API Manual 🌸

okay so bestie, we're diving into struct sample from the kernel API manual and honestly?? it's giving "tiny struct, big responsibilities" πŸ’… lowkey it's the little data-holder that helps your CPU pick its next vibe (that's a P State, iykyk).


✨ NAME ✨

struct sample β€” Store performance sample πŸŽ€


✨ SYNOPSIS ✨

struct sample {
    int32_t core_avg_perf;
    int32_t busy_scaled;
    u64 aperf;
    u64 mperf;
    u64 tsc;
    u64 time;
 };

✨ Members ✨

  • core_avg_perf β€” the ratio of APERF/MPERF, which is literally the actual average performance during the last sample period. no cap, that's the whole thing 🫢
  • busy_scaled β€” a scaled busy value, and it's the one used to calculate the next P state. it can be different from core_avg_perf so it can account for the cpu idle period β€” like yeah, she adjusts πŸ’…
  • aperf β€” the difference of the actual performance frequency clock count read from the APERF MSR between the last and current sample.
  • mperf β€” the difference of the maximum performance frequency clock count read from the MPERF MSR between the last and current sample.
  • tsc β€” the difference of the time stamp counter between the last and current sample ⭐
  • time β€” current time from scheduler πŸ•

✨ Description ✨

so this structure lives inside the cpudata structure and its whole job is storing performance sample data for choosing the next P State. that's it, that's the arc 🌈 main character energy but make it data storage, fr fr.


✨ SEE ALSO ✨

Kernel file ./drivers/cpufreq/intel_pstate.c with struct pstate_data(9), struct vid_data(9), struct global_params(9), struct cpudata(9), struct pstate_funcs(9). go read the whole friend group, they're all connected πŸ¦‹


ngl this one's short and sweet β€” but every field matters, so don't go skipping any of them πŸ’–

and that's a wrap, bestie!! this page came from ./drivers/cpufreq and it's dated October 2026 β€” iconic of it, honestly. mwah πŸ’‹πŸ‘‘

πŸ“¦ where this page comes from