LIBTRACEEVENT(3)
π NAME π
tep_read_number_field β bestie, it reads a number out of raw data. that's it, that's the whole job π
so like, this is your girl libtraceevent(3) and she's here to help you pull an actual number out of a pile of raw bytes. iconic behavior tbh.
β¨ SYNOPSIS β¨
#include <event-parse.h>
int tep_read_number_field(struct tep_format_field *field, const void *data, unsigned long long *value);
π¦ DESCRIPTION π¦
okay so the way tep_read_number_field() works is: it reads the value of the field straight out of the raw data, and then it stores it in value. no cap.
and here's the cute part β it sets that value according to the endianness of the raw data and the endianness of the current machine, then stores it in value. so it's giving endianness-aware, it's giving portability, it's literally doing the byte math so you don't have to πβ¨
π RETURN VALUE π
0β slay, success, we ate π-1β uh oh, an error happened π
πΈ EXAMPLE πΈ
#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
...
void process_record(struct tep_record *record)
{
unsigned long long pid;
struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
if (tep_read_number_field(field_pid, record->data, &pid) != 0) {
/* Failed to get "common_pid" value */
}
}
...
see how she grabbed the common_pid field and justβ¦ pulled the number right out of record->data? main character energy fr fr π
π§ FILES π§
event-parse.hβ the header file you gotta include so you can have access to the library APIs. yes bestie, you need it, don't skip it π-ltraceeventβ the linker switch you add when building a program that uses the library. it's giving "don't forget to link me" π
π« SEE ALSO π«
libtraceevent(3), trace-cmd(1)
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.
(the legends themselves, no big deal π )
π REPORTING BUGS π
found something cursed? report bugs to <linux-trace-devel@vger.kernel.org[3]> β they wanna know, fr fr π
π LICENSE π
libtraceevent is Free Software licensed under the GNU LGPL 2.1. free as in freedom, bestie π¦
β RESOURCES β
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
(the sacred texts πβ¨)
π NOTES π
rostedt@goodmis.orgmailto:rostedt@goodmis.orgtz.stoyanov@gmail.commailto:tz.stoyanov@gmail.comlinux-trace-devel@vger.kernel.orgmailto:linux-trace-devel@vger.kernel.org
and that's the whole page, bestie π this was libtraceevent 1.9.0, dated 06/15/2026, and it lives in section LIBTRACEEVENT(3) of the manual. periodt. π πΈ
π¦ 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