1libtraceevent(3) 2================ 3 4NAME 5---- 6tep_data_type, tep_data_pid,tep_data_preempt_count, tep_data_flags - 7Extract common fields from a record. 8 9SYNOPSIS 10-------- 11[verse] 12-- 13*#include <event-parse.h>* 14 15enum *trace_flag_type* { 16 _TRACE_FLAG_IRQS_OFF_, 17 _TRACE_FLAG_IRQS_NOSUPPORT_, 18 _TRACE_FLAG_NEED_RESCHED_, 19 _TRACE_FLAG_HARDIRQ_, 20 _TRACE_FLAG_SOFTIRQ_, 21}; 22 23int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 24int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 25int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 26int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 27-- 28 29DESCRIPTION 30----------- 31This set of functions can be used to extract common fields from a record. 32 33The _tep_data_type()_ function gets the event id from the record _rec_. 34It reads the "common_type" field. The _tep_ argument is the trace event parser 35context. 36 37The _tep_data_pid()_ function gets the process id from the record _rec_. 38It reads the "common_pid" field. The _tep_ argument is the trace event parser 39context. 40 41The _tep_data_preempt_count()_ function gets the preemption count from the 42record _rec_. It reads the "common_preempt_count" field. The _tep_ argument is 43the trace event parser context. 44 45The _tep_data_flags()_ function gets the latency flags from the record _rec_. 46It reads the "common_flags" field. The _tep_ argument is the trace event parser 47context. Supported latency flags are: 48[verse] 49-- 50 _TRACE_FLAG_IRQS_OFF_, Interrupts are disabled. 51 _TRACE_FLAG_IRQS_NOSUPPORT_, Reading IRQ flag is not supported by the architecture. 52 _TRACE_FLAG_NEED_RESCHED_, Task needs rescheduling. 53 _TRACE_FLAG_HARDIRQ_, Hard IRQ is running. 54 _TRACE_FLAG_SOFTIRQ_, Soft IRQ is running. 55-- 56 57RETURN VALUE 58------------ 59The _tep_data_type()_ function returns an integer, representing the event id. 60 61The _tep_data_pid()_ function returns an integer, representing the process id 62 63The _tep_data_preempt_count()_ function returns an integer, representing the 64preemption count. 65 66The _tep_data_flags()_ function returns an integer, representing the latency 67flags. Look at the _trace_flag_type_ enum for supported flags. 68 69All these functions in case of an error return a negative integer. 70 71EXAMPLE 72------- 73[source,c] 74-- 75#include <event-parse.h> 76... 77struct tep_handle *tep = tep_alloc(); 78... 79void process_record(struct tep_record *record) 80{ 81 int data; 82 83 data = tep_data_type(tep, record); 84 if (data >= 0) { 85 /* Got the ID of the event */ 86 } 87 88 data = tep_data_pid(tep, record); 89 if (data >= 0) { 90 /* Got the process ID */ 91 } 92 93 data = tep_data_preempt_count(tep, record); 94 if (data >= 0) { 95 /* Got the preemption count */ 96 } 97 98 data = tep_data_flags(tep, record); 99 if (data >= 0) { 100 /* Got the latency flags */ 101 } 102} 103... 104-- 105 106FILES 107----- 108[verse] 109-- 110*event-parse.h* 111 Header file to include in order to have access to the library APIs. 112*-ltraceevent* 113 Linker switch to add when building a program that uses the library. 114-- 115 116SEE ALSO 117-------- 118_libtraceevent(3)_, _trace-cmd(1)_ 119 120AUTHOR 121------ 122[verse] 123-- 124*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 125*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 126-- 127REPORTING BUGS 128-------------- 129Report bugs to <linux-trace-devel@vger.kernel.org> 130 131LICENSE 132------- 133libtraceevent is Free Software licensed under the GNU LGPL 2.1 134 135RESOURCES 136--------- 137https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 138