STRUCT SAMPLE(9)
πΈ 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 fromcore_avg_perfso 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
- 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