create_field_var_hist(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– create_field_var_hist(9) πŸ’–

okay so bestie, we're in the Kernel API Manual today and this one is lowkey a little baddie β€” it's all about making a histogram and a variable for a field, automatically, so nobody has to do it by hand ✨


πŸŽ€ NAME πŸŽ€

create_field_var_hist β€” automatically create a histogram and var for a field 🫢


🌸 SYNOPSIS 🌸

struct hist_field * create_field_var_hist (struct hist_trigger_data
     *target_hist_data , char *subsys_name , char *event_name , char
     *field_name );

✨ ARGUMENTS ✨

  • target_hist_data β€” the target hist trigger πŸ‘‘ like, the one everything's getting built around
  • subsys_name β€” optional subsystem name (optional!! she doesn't have to show up)
  • event_name β€” optional event name (also optional, no pressure πŸ’…)
  • field_name β€” the name of the field β€” and fr fr, this is also the name of the resulting variable πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea β˜• β€” hist trigger actions fetch their data from variables, not directly from events. That's just how it is.

But because the kernel devs are actually sweeties and want your life to be easy, users are allowed to just straight-up name an event field inside an action β€” and the kernel will convert that into a variable on your behalf. Not me doing the work for you… the kernel doing the work for you πŸ’…

Now. If you specify a field on an event that isn't the event of the histogram currently being defined (aka the target event histogram), there's literally only one way that can happen: a whole new hist trigger has to get created, and the field variable gets defined on that one. Main character energy for the new trigger, honestly.

Which brings us to what this function does:

  • it creates a new histogram that's compatible with the target event β€” and by compatible we mean a histogram with the same key as the target histogram πŸ”‘
  • and it creates a variable for the specified field

…but bestie, listen πŸ‘€ β€” the variable name gets 'synthetic_' prepended to it, specifically so it does not collide with normal field variables. Safety first, always 🌸


πŸ’œ RETURN πŸ’œ

The variable created for the field. That's it, that's the prize 🎁


🌈 SEE ALSO 🌈

the whole friend group honestly 🫢


and that's the page!! mwah πŸ’‹ this lil kernel API doc lives over in ./kernel/trace, and it's dated October 2026 β€” so yeah, she's from the future, iconic behavior only πŸ‘‘β­πŸ’€

πŸ“¦ where this page comes from