'\" 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_data_type, tep_data_pid, tep_data_preempt_count, tep_data_flags \- Extract common fields from a record\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include <event\-parse\&.h>\fR

enum \fBtrace_flag_type\fR {
        \fITRACE_FLAG_IRQS_OFF\fR,
        \fITRACE_FLAG_IRQS_NOSUPPORT\fR,
        \fITRACE_FLAG_NEED_RESCHED\fR,
        \fITRACE_FLAG_HARDIRQ\fR,
        \fITRACE_FLAG_SOFTIRQ\fR,
};

int \fBtep_data_type\fR(struct tep_handle *\fItep\fR, struct tep_record *\fIrec\fR);
int \fBtep_data_pid\fR(struct tep_handle *\fItep\fR, struct tep_record *\fIrec\fR);
int \fBtep_data_preempt_count\fR(struct tep_handle *\fItep\fR, struct tep_record *\fIrec\fR);
int \fBtep_data_flags\fR(struct tep_handle *\fItep\fR, struct tep_record *\fIrec\fR);
.fi
.SH "DESCRIPTION"
.sp
This set of functions can be used to extract common fields from a record\&.
.sp
The \fBtep_data_type()\fR function gets the event id from the record \fIrec\fR\&. It reads the "common_type" field\&. The \fItep\fR argument is the trace event parser context\&.
.sp
The \fBtep_data_pid()\fR function gets the process id from the record \fIrec\fR\&. It reads the "common_pid" field\&. The \fItep\fR argument is the trace event parser context\&.
.sp
The \fBtep_data_preempt_count()\fR function gets the preemption count from the record \fIrec\fR\&. It reads the "common_preempt_count" field\&. The \fItep\fR argument is the trace event parser context\&.
.sp
The \fBtep_data_flags()\fR function gets the latency flags from the record \fIrec\fR\&. It reads the "common_flags" field\&. The \fItep\fR argument is the trace event parser context\&. Supported latency flags are:
.sp
.if n \{\
.RS 4
.\}
.nf
        \fITRACE_FLAG_IRQS_OFF\fR,          Interrupts are disabled\&.
        \fITRACE_FLAG_IRQS_NOSUPPORT\fR,    Reading IRQ flag is not supported by the architecture\&.
        \fITRACE_FLAG_NEED_RESCHED\fR,      Task needs rescheduling\&.
        \fITRACE_FLAG_HARDIRQ\fR,           Hard IRQ is running\&.
        \fITRACE_FLAG_SOFTIRQ\fR,           Soft IRQ is running\&.
.fi
.if n \{\
.RE
.\}
.SH "RETURN VALUE"
.sp
The \fBtep_data_type()\fR function returns an integer, representing the event id\&.
.sp
The \fBtep_data_pid()\fR function returns an integer, representing the process id
.sp
The \fBtep_data_preempt_count()\fR function returns an integer, representing the preemption count\&.
.sp
The \fBtep_data_flags()\fR function returns an integer, representing the latency flags\&. Look at the \fItrace_flag_type\fR enum for supported flags\&.
.sp
All these functions in case of an error return a negative integer\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include <event\-parse\&.h>
\&.\&.\&.
struct tep_handle *tep = tep_alloc();
\&.\&.\&.
void process_record(struct tep_record *record)
{
        int data;

        data = tep_data_type(tep, record);
        if (data >= 0) {
                /* Got the ID of the event */
        }

        data = tep_data_pid(tep, record);
        if (data >= 0) {
                /* Got the process ID */
        }

        data = tep_data_preempt_count(tep, record);
        if (data >= 0) {
                /* Got the preemption count */
        }

        data = tep_data_flags(tep, record);
        if (data >= 0) {
                /* Got the latency flags */
        }
}
\&.\&.\&.
.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
