'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 05/23/2021
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent 1.3.0
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "05/23/2021" "libtraceevent 1\&.3\&.0" "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_parse_event, tep_parse_format \- Parse the event format information
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
enum tep_errno \fBtep_parse_event\fR(struct tep_handle *\fItep\fR, const char *\fIbuf\fR, unsigned long \fIsize\fR, const char *\fIsys\fR);
enum tep_errno \fBtep_parse_format\fR(struct tep_handle *\fItep\fR, struct tep_event **\fIeventp\fR, const char *\fIbuf\fR, unsigned long \fIsize\fR, const char *\fIsys\fR);
.fi
.SH "DESCRIPTION"
.sp
The \fItep_parse_event()\fR function parses the event format and creates an event structure to quickly parse raw data for a given event\&. The \fItep\fR argument is the trace event parser context\&. The created event structure is stored in the \fItep\fR context\&. The \fIbuf\fR argument is a buffer with \fIsize\fR, where the event format data is\&. The event format data can be taken from tracefs/events/\&.../\&.../format files\&. The \fIsys\fR argument is the system of the event\&.
.sp
The \fItep_parse_format()\fR function does the same as \fItep_parse_event()\fR\&. The only difference is in the extra \fIeventp\fR argument, where the newly created event structure is returned\&.
.SH "RETURN VALUE"
.sp
Both \fItep_parse_event()\fR and \fItep_parse_format()\fR functions return 0 on success, or TEP_ERRNO__\&... in case of an error\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
\&.\&.\&.
struct tep_handle *tep = tep_alloc();
\&.\&.\&.
char *buf;
int size;
struct tep_event *event = NULL;
buf = read_file("/sys/kernel/tracing/events/ftrace/print/format", &size);
if (tep_parse_event(tep, buf, size, "ftrace") != 0) {
/* Failed to parse the ftrace print format */
}
if (tep_parse_format(tep, &event, buf, size, "ftrace") != 0) {
/* Failed to parse the ftrace print format */
}
\&.\&.\&.
.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
\fIlibtraceevent(3)\fR, \fItrace\-cmd(1)\fR
.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