synth_event_add_val(9)
π synth_event_add_val(9) β like, the Kernel API Manual, but make it make sense
okay so bestie, welcome to the glow-up of synth_event_add_val(9) from the Kernel API Manual. this page is about adding a named field's value to an open synth trace, and honestly? she's iconic for it. let's get into it π
β¨ NAME β¨
synth_event_add_val β add a named field's value to an open synth trace π¦
πΈ SYNOPSIS πΈ
int synth_event_add_val (const char *field_name , u64 val , struct
synth_event_trace_state *trace_state );
like, that's the whole signature, no notes π
π«Ά ARGUMENTS π«Ά
field_nameβ the name of the synthetic event field value you wanna set. it's your little label, your name tag at the party π·οΈvalβ the value you're setting that named field to. the actual content, the main character of the operation β¨trace_stateβ a pointer to the object that's tracking the piecewise trace state. think of her as the group chat admin keeping receipts π
π₯ DESCRIPTION π₯
so what she does is: set the value of the named field in an event that's been opened by synth_event_trace_start. that's the setup, that's the prerequisite, don't skip it π
the val param should be the value cast to u64. and if the value points to a string? then the val param should be a char * cast to u64. yep, that's the move, that's the vibe π§
what she does under the hood: this function looks up the field name, and if found, sets the field to the specified value. lowkey slay. but ngl, this lookup makes this function more expensive than synth_event_add_next_val, so use that β or the none-piecewise synth_event_trace β instead if efficiency is more important. know your tradeoffs, bestie π
note however thatsynth_event_add_next_valandsynth_event_add_valcan't be intermixed for a given event trace β one or the other but not both can be used at the same time. pick a lane, periodt π«
note also that synth_event_trace_end must be called after all values have been added for each event trace, regardless of whether adding all field values succeeded or not. yes even if it went sideways. especially if it went sideways. clean up after yourself π
β RETURN β
0 on success, err otherwise. that's it, that's the whole report card π
π SEE ALSO π
- Kernel file
./kernel/trace/trace_events_synth.cπ synth_event_add_field(9)synth_event_add_field_str(9)synth_event_add_fields(9)__synth_event_gen_cmd_start(9)synth_event_gen_cmd_array_start(9)synth_event_create(9)synth_event_delete(9)synth_event_cmd_init(9)synth_event_trace(9)synth_event_trace_array(9)synth_event_trace_start(9)synth_event_add_next_val(9)synth_event_trace_end(9)
and that's the whole page, babes π this lil sign-off comes to you straight from ./kernel/trace, dated October 2026, and yes it's still synth_event_add_val(9) β she's booked, she's busy, she's in the kernel fr fr π¦β¨π
π¦ 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