'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 01/14/2024
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent 1.8.2
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "01/14/2024" "libtraceevent 1\&.8\&.2" "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_find_common_field, tep_find_field, tep_find_any_field \- Search for a field in an event\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
struct tep_format_field *\fBtep_find_common_field\fR(struct tep_event *\fIevent\fR, const char *\fIname\fR);
struct tep_format_field *\fBtep_find_field\fR(struct tep_event_ormat *\fIevent\fR, const char *\fIname\fR);
struct tep_format_field *\fBtep_find_any_field\fR(struct tep_event *\fIevent\fR, const char *\fIname\fR);
.fi
.SH "DESCRIPTION"
.sp
These functions search for a field with given name in an event\&. The field returned can be used to find the field content from within a data record\&.
.sp
The \fBtep_find_common_field()\fR function searches for a common field with \fIname\fR in the \fIevent\fR\&.
.sp
The \fBtep_find_field()\fR function searches for an event specific field with \fIname\fR in the \fIevent\fR\&.
.sp
The \fBtep_find_any_field()\fR function searches for any field with \fIname\fR in the \fIevent\fR\&.
.SH "RETURN VALUE"
.sp
The \fItep_find_common_field(), \fR\fI\fBtep_find_field()\fR\fR\fI and _tep_find_any_field()\fR functions return a pointer to the found field, or NULL in case there is no field with the requested name\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
\&.\&.\&.
void get_htimer_info(struct tep_handle *tep, struct tep_record *record)
{
struct tep_format_field *field;
struct tep_event *event;
long long softexpires;
int mode;
int pid;
event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
field = tep_find_common_field(event, "common_pid");
if (field == NULL) {
/* Cannot find "common_pid" field in the event */
} else {
/* Get pid from the data record */
pid = tep_read_number(tep, record\->data + field\->offset,
field\->size);
}
field = tep_find_field(event, "softexpires");
if (field == NULL) {
/* Cannot find "softexpires" event specific field in the event */
} else {
/* Get softexpires parameter from the data record */
softexpires = tep_read_number(tep, record\->data + field\->offset,
field\->size);
}
field = tep_find_any_field(event, "mode");
if (field == NULL) {
/* Cannot find "mode" field in the event */
} else
{
/* Get mode parameter from the data record */
mode = tep_read_number(tep, record\->data + field\->offset,
field\->size);
}
}
\&.\&.\&.
.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