1LIBTRACEEVENT(3)             libtraceevent Manual             LIBTRACEEVENT(3)
2
3
4

NAME

6       tep_data_type, tep_data_pid, tep_data_preempt_count, tep_data_flags -
7       Extract common fields from a record.
8

SYNOPSIS

10       #include <event-parse.h>
11
12       enum trace_flag_type {
13               TRACE_FLAG_IRQS_OFF,
14               TRACE_FLAG_IRQS_NOSUPPORT,
15               TRACE_FLAG_NEED_RESCHED,
16               TRACE_FLAG_HARDIRQ,
17               TRACE_FLAG_SOFTIRQ,
18       };
19
20       int tep_data_type(struct tep_handle *tep, struct tep_record *rec);
21       int tep_data_pid(struct tep_handle *tep, struct tep_record *rec);
22       int tep_data_preempt_count(struct tep_handle *tep, struct tep_record *rec);
23       int tep_data_flags(struct tep_handle *tep, struct tep_record *rec);
24

DESCRIPTION

26       This set of functions can be used to extract common fields from a
27       record.
28
29       The tep_data_type() function gets the event id from the record rec. It
30       reads the "common_type" field. The tep argument is the trace event
31       parser context.
32
33       The tep_data_pid() function gets the process id from the record rec. It
34       reads the "common_pid" field. The tep argument is the trace event
35       parser context.
36
37       The tep_data_preempt_count() function gets the preemption count from
38       the record rec. It reads the "common_preempt_count" field. The tep
39       argument is the trace event parser context.
40
41       The tep_data_flags() function gets the latency flags from the record
42       rec. It reads the "common_flags" field. The tep argument is the trace
43       event parser context. Supported latency flags are:
44
45                   TRACE_FLAG_IRQS_OFF,          Interrupts are disabled.
46                   TRACE_FLAG_IRQS_NOSUPPORT,    Reading IRQ flag is not supported by the architecture.
47                   TRACE_FLAG_NEED_RESCHED,      Task needs rescheduling.
48                   TRACE_FLAG_HARDIRQ,           Hard IRQ is running.
49                   TRACE_FLAG_SOFTIRQ,           Soft IRQ is running.
50

RETURN VALUE

52       The tep_data_type() function returns an integer, representing the event
53       id.
54
55       The tep_data_pid() function returns an integer, representing the
56       process id
57
58       The tep_data_preempt_count() function returns an integer, representing
59       the preemption count.
60
61       The tep_data_flags() function returns an integer, representing the
62       latency flags. Look at the trace_flag_type enum for supported flags.
63
64       All these functions in case of an error return a negative integer.
65

EXAMPLE

67           #include <event-parse.h>
68           ...
69           struct tep_handle *tep = tep_alloc();
70           ...
71           void process_record(struct tep_record *record)
72           {
73                   int data;
74
75                   data = tep_data_type(tep, record);
76                   if (data >= 0) {
77                           /* Got the ID of the event */
78                   }
79
80                   data = tep_data_pid(tep, record);
81                   if (data >= 0) {
82                           /* Got the process ID */
83                   }
84
85                   data = tep_data_preempt_count(tep, record);
86                   if (data >= 0) {
87                           /* Got the preemption count */
88                   }
89
90                   data = tep_data_flags(tep, record);
91                   if (data >= 0) {
92                           /* Got the latency flags */
93                   }
94           }
95           ...
96

FILES

98           event-parse.h
99                   Header file to include in order to have access to the library APIs.
100           -ltraceevent
101                   Linker switch to add when building a program that uses the library.
102

SEE ALSO

104       libtraceevent(3), trace-cmd(1)
105

AUTHOR

107           Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
108           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
109

REPORTING BUGS

111       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
112

LICENSE

114       libtraceevent is Free Software licensed under the GNU LGPL 2.1
115

RESOURCES

117       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
118

NOTES

120        1. rostedt@goodmis.org
121           mailto:rostedt@goodmis.org
122
123        2. tz.stoyanov@gmail.com
124           mailto:tz.stoyanov@gmail.com
125
126        3. linux-trace-devel@vger.kernel.org
127           mailto:linux-trace-devel@vger.kernel.org
128
129
130
131libtraceevent 1.1.1               02/08/2021                  LIBTRACEEVENT(3)
Impressum