'\" t
.\"     Title: libtraceevent
.\"    Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 01/16/2026
.\"    Manual: libtraceevent Manual
.\"    Source: libtraceevent 1.8.4
.\"  Language: English
.\"
.TH "LIBTRACEEVENT" "3" "01/16/2026" "libtraceevent 1\&.8\&.4" "libtraceevent Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
tep_get_event, tep_get_first_event, tep_get_events_count \- Access events\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include <event\-parse\&.h>\fR

struct tep_event *\fBtep_get_event\fR(struct tep_handle *\fItep\fR, int \fIindex\fR);
struct tep_event *\fBtep_get_first_event\fR(struct tep_handle *\fItep\fR);
int \fBtep_get_events_count\fR(struct tep_handle *\fItep\fR);
.fi
.SH "DESCRIPTION"
.sp
The \fBtep_get_event()\fR function returns a pointer to event at the given \fIindex\fR\&. The \fItep\fR argument is trace event parser context, the \fIindex\fR is the index of the requested event\&.
.sp
The \fBtep_get_first_event()\fR function returns a pointer to the first event\&. As events are stored in an array, this function returns the pointer to the beginning of the array\&. The \fItep\fR argument is trace event parser context\&.
.sp
The \fBtep_get_events_count()\fR function returns the number of the events in the array\&. The \fItep\fR argument is trace event parser context\&.
.SH "RETURN VALUE"
.sp
The \fBtep_get_event()\fR returns a pointer to the event located at \fIindex\fR\&. NULL is returned in case of error, in case there are no events or \fIindex\fR is out of range\&.
.sp
The \fBtep_get_first_event()\fR returns a pointer to the first event\&. NULL is returned in case of error, or in case there are no events\&.
.sp
The \fBtep_get_events_count()\fR returns the number of the events\&. 0 is returned in case of error, or in case there are no events\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include <event\-parse\&.h>
\&.\&.\&.
struct tep_handle *tep = tep_alloc();
\&.\&.\&.
int i,count = tep_get_events_count(tep);
struct tep_event *event, *events = tep_get_first_event(tep);

if (events == NULL) {
        /* There are no events */
} else {
        for (i = 0; i < count; i++) {
                event = (events+i);
                /* process events[i] */
        }

        /* Get the last event */
        event = tep_get_event(tep, count\-1);
}
.fi
.if n \{\
.RE
.\}
.SH "FILES"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBevent\-parse\&.h\fR
        Header file to include in order to have access to the library APIs\&.
\fB\-ltraceevent\fR
        Linker switch to add when building a program that uses the library\&.
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
\fBlibtraceevent\fR(3), \fBtrace\-cmd\fR(1)
.SH "AUTHOR"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBSteven Rostedt\fR <\m[blue]\fBrostedt@goodmis\&.org\fR\m[]\&\s-2\u[1]\d\s+2>, author of \fBlibtraceevent\fR\&.
\fBTzvetomir Stoyanov\fR <\m[blue]\fBtz\&.stoyanov@gmail\&.com\fR\m[]\&\s-2\u[2]\d\s+2>, author of this man page\&.
.fi
.if n \{\
.RE
.\}
.SH "REPORTING BUGS"
.sp
Report bugs to <\m[blue]\fBlinux\-trace\-devel@vger\&.kernel\&.org\fR\m[]\&\s-2\u[3]\d\s+2>
.SH "LICENSE"
.sp
libtraceevent is Free Software licensed under the GNU LGPL 2\&.1
.SH "RESOURCES"
.sp
\m[blue]\fBhttps://git\&.kernel\&.org/pub/scm/libs/libtrace/libtraceevent\&.git/\fR\m[]
.SH "NOTES"
.IP " 1." 4
rostedt@goodmis.org
.RS 4
\%mailto:rostedt@goodmis.org
.RE
.IP " 2." 4
tz.stoyanov@gmail.com
.RS 4
\%mailto:tz.stoyanov@gmail.com
.RE
.IP " 3." 4
linux-trace-devel@vger.kernel.org
.RS 4
\%mailto:linux-trace-devel@vger.kernel.org
.RE
