'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 08/28/2021
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent 1.3.3
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "08/28/2021" "libtraceevent 1\&.3\&.3" "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_print_field, tep_print_fields, tep_print_num_field, tep_print_func_field \- Print the field content\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
\fB#include \fR
void \fBtep_print_field\fR(struct trace_seq *\fIs\fR, void *\fIdata\fR, struct tep_format_field *\fIfield\fR);
void \fBtep_print_fields\fR(struct trace_seq *\fIs\fR, void *\fIdata\fR, int \fIsize\fR, struct tep_event *\fIevent\fR);
int \fBtep_print_num_field\fR(struct trace_seq *\fIs\fR, const char *\fIfmt\fR, struct tep_event *\fIevent\fR, const char *\fIname\fR, struct tep_record *\fIrecord\fR, int \fIerr\fR);
int \fBtep_print_func_field\fR(struct trace_seq *\fIs\fR, const char *\fIfmt\fR, struct tep_event *\fIevent\fR, const char *\fIname\fR, struct tep_record *\fIrecord\fR, int \fIerr\fR);
.fi
.SH "DESCRIPTION"
.sp
These functions print recorded field\(cqs data, according to the field\(cqs type\&.
.sp
The \fItep_print_field()\fR function extracts from the recorded raw \fIdata\fR value of the \fIfield\fR and prints it into \fIs\fR, according to the field type\&.
.sp
The \fItep_print_fields()\fR prints each field name followed by the record\(cqs field value according to the field\(cqs type:
.sp
.if n \{\
.RS 4
.\}
.nf
"field1_name=field1_value field2_name=field2_value \&..."
.fi
.if n \{\
.RE
.\}
.sp
It iterates all fields of the \fIevent\fR, and calls \fItep_print_field()\fR for each of them\&.
.sp
The \fItep_print_num_field()\fR function prints a numeric field with given format string\&. A search is performed in the \fIevent\fR for a field with \fIname\fR\&. If such field is found, its value is extracted from the \fIrecord\fR and is printed in the \fIs\fR, according to the given format string \fIfmt\fR\&. If the argument \fIerr\fR is non\-zero, and an error occures \- it is printed in the \fIs\fR\&.
.sp
The \fItep_print_func_field()\fR function prints a function field with given format string\&. A search is performed in the \fIevent\fR for a field with \fIname\fR\&. If such field is found, its value is extracted from the \fIrecord\fR\&. The value is assumed to be a function address, and a search is perform to find the name of this function\&. The function name (if found) and its address are printed in the \fIs\fR, according to the given format string \fIfmt\fR\&. If the argument \fIerr\fR is non\-zero, and an error occures \- it is printed in \fIs\fR\&.
.SH "RETURN VALUE"
.sp
The \fItep_print_num_field()\fR and \fItep_print_func_field()\fR functions return 1 on success, \-1 in case of an error or 0 if the print buffer \fIs\fR is full\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
#include
\&.\&.\&.
struct tep_handle *tep = tep_alloc();
\&.\&.\&.
struct trace_seq seq;
trace_seq_init(&seq);
struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
\&.\&.\&.
void process_record(struct tep_record *record)
{
struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
trace_seq_reset(&seq);
/* Print the value of "common_pid" */
tep_print_field(&seq, record\->data, field_pid);
/* Print all fields of the "hrtimer_start" event */
tep_print_fields(&seq, record\->data, record\->size, event);
/* Print the value of "expires" field with custom format string */
tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0);
/* Print the address and the name of "function" field with custom format string */
tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0);
}
\&.\&.\&.
.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\&.
\fBtrace\-seq\&.h\fR
Header file to include in order to have access to trace sequences related APIs\&.
Trace sequences are used to allow a function to call several other functions
to create a string of data to use\&.
\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