LIBTRACEEVENT(3)

πŸ’– LIBTRACEEVENT(3) β€” the libtraceevent manual, bestie edition πŸ’–

okay so welcome to the libtraceevent manual page, and today's episode is all about peeking at the header page β€” that little chunk of kernel-context info that lives in tracefs and tells you how big stuff is πŸŽ€


✨ NAME ✨

tep_get_header_page_size, tep_get_header_timestamp_size, tep_is_old_format β€” get the data stored in the header page, in kernel context 🫢


🌸 SYNOPSIS 🌸

#include <event-parse.h>

int tep_get_header_page_size(struct tep_handle *tep);
int tep_get_header_timestamp_size(struct tep_handle *tep);
bool tep_is_old_format(struct tep_handle *tep);

πŸ’… DESCRIPTION πŸ’…

So these three functions go and grab info from kernel context, and that info is stored in tracefs events/header_page. But plot twist 😭: old kernels literally don't have header page info at all, so in that case the default values from user space context get used instead. not me crying over backwards compatibility fr fr.

The tep_get_header_page_size() function returns the size of a long integer, in kernel context. The tep argument is the trace event parser context. This info is retrieved from tracefs events/header_page, the "commit" field. lowkey iconic, highkey useful.

The tep_get_header_timestamp_size() function returns the size of timestamps, in kernel context. The tep argument is the trace event parser context. This info is retrieved from tracefs events/header_page, the "timestamp" field. the way it just... knows πŸ¦‹

The tep_is_old_format() function returns true if the kernel predates the addition of events/header_page, otherwise it returns false. vibe check on your kernel, basically πŸ’€


⭐ RETURN VALUE ⭐

  • tep_get_header_page_size() β€” returns the size of a long integer, in bytes. one number, no drama.
  • tep_get_header_timestamp_size() β€” returns the size of timestamps, in bytes. same energy.
  • tep_is_old_format() β€” returns true if an old kernel is being used to generate the tracing data, which has no event/header_page. If the kernel is new, or tep is NULL, false is returned. yes bestie, NULL gives you false, it does not crash out πŸ™ˆ

🌈 EXAMPLE 🌈

#include <event-parse.h>
...
struct tep_handle *tep = tep_alloc();
...
        int longsize;
        int timesize;
        bool old;

        longsize = tep_get_header_page_size(tep);
        timesize = tep_get_header_timestamp_size(tep);
        old = tep_is_old_format(tep);

        printf ("%s kernel is used to generate the tracing data.\n",
                old?"Old":"New");
        printf("The size of a long integer is %d bytes.\n", longsize);
        printf("The timestamps size is %d bytes.\n", timesize);
...

look at that. main character code right there πŸ‘‘


πŸŽ€ FILES πŸŽ€

  • event-parse.h β€” the header file you include so you can actually touch the library APIs.
  • -ltraceevent β€” the linker switch you add when building a program that uses the library. don't forget it or the linker will simply not know you πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

libtraceevent(3), trace-cmd(1)


πŸ’œ AUTHOR πŸ’œ

  • Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
  • Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.

πŸ› REPORTING BUGS πŸ›

Report bugs to <linux-trace-devel@vger.kernel.org[3]> 🫢


πŸ“œ LICENSE πŸ“œ

libtraceevent is Free Software licensed under the GNU LGPL 2.1.


🧚 RESOURCES 🧚

https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/


πŸ“ NOTES πŸ“

  1. rostedt@goodmis.org β€” mailto:rostedt@goodmis.org
  2. tz.stoyanov@gmail.com β€” mailto:tz.stoyanov@gmail.com
  3. linux-trace-devel@vger.kernel.org β€” mailto:linux-trace-devel@vger.kernel.org

aaaaand that's the whole page, bestie πŸ’– this was libtraceevent 1.9.0, served fresh on 06/15/2026, and it's your girl LIBTRACEEVENT(3) signing off β€” go read your header pages, stay hydrated, slay βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from