LIBTRACEEVENT(3)
π LIBTRACEEVENT π β the tep_find_*_field girlies
okay so bestie, welcome to libtraceevent(3), the manual page formerly known as libtraceevent Manual. this one's about the field-finding trio and honestly? they ate. let's go π¦
β¨ NAME β¨
tep_find_common_field, tep_find_field, tep_find_any_field β searching for a field in an event, fr fr π
πΈ SYNOPSIS πΈ
#include <event-parse.h>
struct tep_format_field *tep_find_common_field(struct tep_event *event, const char *name);
struct tep_format_field *tep_find_field(struct tep_event_ormat *event, const char *name);
struct tep_format_field *tep_find_any_field(struct tep_event *event, const char *name);
π yes bestie, that third-from-top signature really does say struct tep_event_ormat *event. that is not me being silly, that is what the page says. copy it exactly, no cap.
π DESCRIPTION π
so these three functions all go hunting for a field with the given name inside an event. the field they hand back? you can use it to find that field's content from within a data record. it's giving "personal field shopper" energy π
tep_find_common_field()β looks for a common field callednamein the event. the shared ones, the universal ones πtep_find_field()β looks for an event specific field callednamein the event. this one's for the niche faves.tep_find_any_field()β looks for any field at all callednamein the event. she contains multitudes β¨
π«Ά RETURN VALUE π«Ά
tep_find_common_field(), tep_find_field() and _tep_find_any_field() β yes, that one has a little leading underscore on it, that's how the page wrote it, don't come for me π β these functions return a pointer to the found field.
and if there is no field with the requested name? you get NULL. no field, no vibes, just NULL. sorry bestie π§οΈ
π» EXAMPLE π»
here's the whole thing, character for character, because we do not edit code in this house:
#include <event-parse.h>
...
void get_htimer_info(struct tep_handle *tep, struct tep_record *record)
{
struct tep_format_field *field;
struct tep_event *event;
long long softexpires;
int mode;
int pid;
event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
field = tep_find_common_field(event, "common_pid");
if (field == NULL) {
/* Cannot find "common_pid" field in the event */
} else {
/* Get pid from the data record */
pid = tep_read_number(tep, record->data + field->offset,
field->size);
}
field = tep_find_field(event, "softexpires");
if (field == NULL) {
/* Cannot find "softexpires" event specific field in the event */
} else {
/* Get softexpires parameter from the data record */
softexpires = tep_read_number(tep, record->data + field->offset,
field->size);
}
field = tep_find_any_field(event, "mode");
if (field == NULL) {
/* Cannot find "mode" field in the event */
} else
{
/* Get mode parameter from the data record */
mode = tep_read_number(tep, record->data + field->offset,
field->size);
}
}
...
look at her go. three finds, three vibe checks, three NULL guards. main character energy π§
π FILES π
event-parse.hβ the header file you include so you actually have access to the library APIs. no include, no APIs, no slay.-ltraceeventβ the linker switch you add when you're building a program that uses the library. don't forget her, she's important π
β SEE ALSO β
go read those too, iykyk π
π AUTHOR π
- Steven Rostedt
<rostedt@goodmis.org[1]>, author of libtraceevent π - Tzvetomir Stoyanov
<tz.stoyanov@gmail.com[2]>, author of this man page π«‘
π¨ REPORTING BUGS π¨
found a bug? report it to <linux-trace-devel@vger.kernel.org[3]>. they want to know, bestie, tell them everything π
π LICENSE π
libtraceevent is Free Software licensed under the GNU LGPL 2.1. iconic behaviour, honestly.
π RESOURCES π
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ β the whole repo, go wild β¨
π NOTES π
rostedt@goodmis.orgβmailto:rostedt@goodmis.orgtz.stoyanov@gmail.comβmailto:tz.stoyanov@gmail.comlinux-trace-devel@vger.kernel.orgβmailto:linux-trace-devel@vger.kernel.org
and that's the whole page, periodt π this was libtraceevent 1.9.0, dated 06/15/2026 β tysm for reading, love u, go find some fields π¦π
π¦ where this page comes from
- ubuntu stonking: libtraceevent-doc 1:1.9.0-2 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms