1libtraceevent(3) 2================ 3 4NAME 5---- 6tep_print_field_content, tep_print_fields, tep_print_num_field, tep_print_func_field, tep_record_print_fields, tep_record_print_selected_fields - 7Print the field content. 8 9SYNOPSIS 10-------- 11[verse] 12-- 13*#include <event-parse.h>* 14*#include <trace-seq.h>* 15 16void *tep_print_field_content*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int size, struct tep_format_field pass:[*]_field_); 17void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_); 18int *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_); 19int *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_); 20void *tep_record_print_fields*(struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, struct tep_event pass:[*]_event_); 21void *tep_record_print_selected_fields*(struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, struct tep_event pass:[*]_event_, int _select_mask_); 22-- 23 24DESCRIPTION 25----------- 26These functions print recorded field's data, according to the field's type. 27 28The *tep_print_field_content()* function extracts from the recorded raw _data_ value of 29the _field_ and prints it into _s_, according to the field type. 30 31The *tep_print_fields()* prints each field name followed by the record's field 32value according to the field's type: 33[verse] 34-- 35"field1_name=field1_value field2_name=field2_value ..." 36-- 37It iterates all fields of the _event_, and calls *tep_print_field_content()* for each of 38them. 39 40The *tep_print_num_field()* function prints a numeric field with given format 41string. A search is performed in the _event_ for a field with _name_. If such 42field is found, its value is extracted from the _record_ and is printed in the 43_s_, according to the given format string _fmt_. If the argument _err_ is 44non-zero, and an error occures - it is printed in the _s_. 45 46The *tep_print_func_field()* function prints a function field with given format 47string. A search is performed in the _event_ for a field with _name_. If such 48field is found, its value is extracted from the _record_. The value is assumed 49to be a function address, and a search is perform to find the name of this 50function. The function name (if found) and its address are printed in the _s_, 51according to the given format string _fmt_. If the argument _err_ is non-zero, 52and an error occures - it is printed in _s_. 53 54The *tep_record_print_fields()* prints the field's name followed by its value 55for all record's field. 56 57The *tep_record_print_selected_fields()* prints the field's name followed by 58its value for selected subset of record field. The fields to be printed are 59defined by the _select_mask_ bit mask. 60 61RETURN VALUE 62------------ 63The *tep_print_num_field()* and *tep_print_func_field()* functions return 1 64on success, -1 in case of an error or 0 if the print buffer _s_ is full. 65 66EXAMPLE 67------- 68[source,c] 69-- 70#include <event-parse.h> 71#include <trace-seq.h> 72... 73struct tep_handle *tep = tep_alloc(); 74... 75struct trace_seq seq; 76trace_seq_init(&seq); 77struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start"); 78... 79void process_record(struct tep_record *record) 80{ 81 struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid"); 82 83 trace_seq_reset(&seq); 84 85 /* Print the value of "common_pid" */ 86 tep_print_field_content(&seq, record->data, record->size, field_pid); 87 88 /* Print all fields of the "hrtimer_start" event */ 89 tep_print_fields(&seq, record->data, record->size, event); 90 91 /* Print the value of "expires" field with custom format string */ 92 tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0); 93 94 /* Print the address and the name of "function" field with custom format string */ 95 tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0); 96 } 97 ... 98-- 99 100FILES 101----- 102[verse] 103-- 104*event-parse.h* 105 Header file to include in order to have access to the library APIs. 106*trace-seq.h* 107 Header file to include in order to have access to trace sequences related APIs. 108 Trace sequences are used to allow a function to call several other functions 109 to create a string of data to use. 110*-ltraceevent* 111 Linker switch to add when building a program that uses the library. 112-- 113 114SEE ALSO 115-------- 116*libtraceevent*(3), *trace-cmd*(1) 117 118AUTHOR 119------ 120[verse] 121-- 122*Steven Rostedt* <[email protected]>, author of *libtraceevent*. 123*Tzvetomir Stoyanov* <[email protected]>, author of this man page. 124-- 125REPORTING BUGS 126-------------- 127Report bugs to <[email protected]> 128 129LICENSE 130------- 131libtraceevent is Free Software licensed under the GNU LGPL 2.1 132 133RESOURCES 134--------- 135https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ 136