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