6 tep_print_field, tep_print_fields, tep_print_num_field, tep_print_func_field -
7 Print the field content.
13 *#include <event-parse.h>*
14 *#include <trace-seq.h>*
16 void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_);
17 void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_);
18 int *tep_print_num_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
19 int *tep_print_func_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_);
24 These functions print recorded field's data, according to the field's type.
26 The _tep_print_field()_ function extracts from the recorded raw _data_ value of
27 the _field_ and prints it into _s_, according to the field type.
29 The _tep_print_fields()_ prints each field name followed by the record's field
30 value according to the field's type:
33 "field1_name=field1_value field2_name=field2_value ..."
35 It iterates all fields of the _event_, and calls _tep_print_field()_ for each of
38 The _tep_print_num_field()_ function prints a numeric field with given format
39 string. A search is performed in the _event_ for a field with _name_. If such
40 field is found, its value is extracted from the _record_ and is printed in the
41 _s_, according to the given format string _fmt_. If the argument _err_ is
42 non-zero, and an error occures - it is printed in the _s_.
44 The _tep_print_func_field()_ function prints a function field with given format
45 string. A search is performed in the _event_ for a field with _name_. If such
46 field is found, its value is extracted from the _record_. The value is assumed
47 to be a function address, and a search is perform to find the name of this
48 function. The function name (if found) and its address are printed in the _s_,
49 according to the given format string _fmt_. If the argument _err_ is non-zero,
50 and an error occures - it is printed in _s_.
54 The _tep_print_num_field()_ and _tep_print_func_field()_ functions return 1
55 on success, -1 in case of an error or 0 if the print buffer _s_ is full.
61 #include <event-parse.h>
62 #include <trace-seq.h>
64 struct tep_handle *tep = tep_alloc();
68 struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
70 void process_record(struct tep_record *record)
72 struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
74 trace_seq_reset(&seq);
76 /* Print the value of "common_pid" */
77 tep_print_field(&seq, record->data, field_pid);
79 /* Print all fields of the "hrtimer_start" event */
80 tep_print_fields(&seq, record->data, record->size, event);
82 /* Print the value of "expires" field with custom format string */
83 tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0);
85 /* Print the address and the name of "function" field with custom format string */
86 tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0);
96 Header file to include in order to have access to the library APIs.
98 Header file to include in order to have access to trace sequences related APIs.
99 Trace sequences are used to allow a function to call several other functions
100 to create a string of data to use.
102 Linker switch to add when building a program that uses the library.
107 _libtraceevent(3)_, _trace-cmd(1)_
113 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
114 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
118 Report bugs to <linux-trace-devel@vger.kernel.org>
122 libtraceevent is Free Software licensed under the GNU LGPL 2.1
126 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git