LIBTRACEEVENT(3)
π LIBTRACEEVENT(3) β the libtraceevent manual, bestie edition π
okay so you're here for tep_read_number and honestly? good taste. this is the libtraceevent manual page and i'm gonna walk you through it like we're texting at 2am. grab a snack π
β¨ NAME β¨
tep_read_number β reads a number from raw data. that's it, that's the whole gig. no cap.
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the header:
#include <event-parse.h>
unsigned long long tep_read_number(struct tep_handle *tep, const void *ptr, int size);
look at that signature. look at it. unsigned long long?? she's giving big number energy π
π¦ DESCRIPTION π¦
okay so tep_read_number() reads an integer straight out of raw data, and the way it does this is so smart β it takes into account both the endianness of the raw data and the endianness of the current host. mixing endianness is a whole situation and this function just handles it for you. iconique.
let's break down the cast of characters:
tepβ the trace event parser context. she's the main character, everything runs through her.ptrβ a pointer to the raw data, like, the actual spot where the integer is chillin'.sizeβ the size of the integer. yes bestie, you have to tell it. it's not psychic.
π₯ RETURN VALUE π₯
tep_read_number() hands you back the integer in the byte order of the current host. so whatever chaos the raw data was in, you get it in your host's native vibe. π«Ά
but listen β if something goes wrong? it returns 0. zero. the void. the empty plate. so don't be out here assuming 0 always means "the number was zero", okay?? fr fr, check your errors.
π EXAMPLE π
here's how the girlies actually use it:
#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
void process_record(struct tep_record *record)
{
int offset = 24;
int data = tep_read_number(tep, record->data + offset, 4);
/* Read the 4 bytes at the offset 24 of data as an integer */
}
...
see what's happening? we're grabbing 4 bytes starting at offset 24 inside record->data and reading them as an integer. chef's kiss. πβ¨
π FILES π
event-parse.hβ the header file you include so you can actually access the library APIs. no include, no access, no exceptions.-ltraceeventβ the linker switch you add when building a program that uses the library. yes you need it. yes it goes in your build. don't forget it and then panic. π
β SEE ALSO β
go forth and read more, bestie:
π AUTHOR π
- Steven Rostedt <rostedt@goodmis.org> β author of libtraceevent. the originator. the blueprint.
- Tzvetomir Stoyanov <tz.stoyanov@gmail.com> β author of this man page. thank her for the lore.
π REPORTING BUGS π
found a bug? don't suffer in silence, tell someone:
Report bugs to <linux-trace-devel@vger.kernel.org>
π LICENSE π
libtraceevent is Free Software licensed under the GNU LGPL 2.1. free as in freedom, protected as in license. periodt.
π§ RESOURCES π§
go, click, explore, become ungovernable.
π 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
that's the whole page, you ate it up, i'm so proud of you. π₯Ήβ¨
this was libtraceevent version 1.9.0, dated 06/15/2026, and yeah β it's LIBTRACEEVENT(3), like we've been saying this whole time. mwah. ππ
π¦ 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