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

NAME

6       tep_print_event - Writes event information into a trace sequence.
7

SYNOPSIS

9       #include <event-parse.h>
10       #include <trace-seq.h>
11
12       void tep_print_event(struct tep_handle *tep, struct trace_seq*s, struct tep_record *record, const char *fmt, ...)
13

DESCRIPTION

15       The tep_print_event() function parses the event information of the
16       given record and writes it into the trace sequence s, according to the
17       format string fmt. The desired information is specified after the
18       format string. The fmt is printf-like format string, following
19       arguments are supported:
20
21                   TEP_PRINT_PID, "%d"  - PID of the event.
22                   TEP_PRINT_CPU, "%d"  - Event CPU.
23                   TEP_PRINT_COMM, "%s" - Event command string.
24                   TEP_PRINT_NAME, "%s" - Event name.
25                   TEP_PRINT_LATENCY, "%s" - Latency of the event. It prints 4 or more
26                                   fields - interrupt state, scheduling state,
27                                   current context, and preemption count.
28                                   Field 1 is the interrupt enabled state:
29                                           d : Interrupts are disabled
30                                           . : Interrupts are enabled
31                                           X : The architecture does not support this
32                                               information
33                                   Field 2 is the "need resched" state.
34                                           N : The task is set to call the scheduler when
35                                               possible, as another higher priority task
36                                               may need to be scheduled in.
37                                           . : The task is not set to call the scheduler.
38                                   Field 3 is the context state.
39                                           . : Normal context
40                                           s : Soft interrupt context
41                                           h : Hard interrupt context
42                                           H : Hard interrupt context which triggered
43                                               during soft interrupt context.
44                                           z : NMI context
45                                           Z : NMI context which triggered during hard
46                                               interrupt context
47                                   Field 4 is the preemption count.
48                                           . : The preempt count is zero.
49                                   On preemptible kernels (where the task can be scheduled
50                                   out in arbitrary locations while in kernel context), the
51                                   preempt count, when non zero, will prevent the kernel
52                                   from scheduling out the current task. The preempt count
53                                   number is displayed when it is not zero.
54                                   Depending on the kernel, it may show other fields
55                                   (lock depth, or migration disabled, which are unique to
56                                   specialized kernels).
57                   TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be
58                                   specified as part of this format string:
59                                   "%precision.divisord". Example:
60                                   "%3.1000d" - divide the time by 1000 and print the first
61                                   3 digits before the dot. Thus, the time stamp
62                                   "123456000" will be printed as "123.456"
63                   TEP_PRINT_INFO, "%s" - event information.
64                   TEP_PRINT_INFO_RAW, "%s" - event information, in raw format.
65

EXAMPLE

67           #include <event-parse.h>
68           #include <trace-seq.h>
69           ...
70           struct trace_seq seq;
71           trace_seq_init(&seq);
72           struct tep_handle *tep = tep_alloc();
73           ...
74           void print_my_event(struct tep_record *record)
75           {
76                   trace_seq_reset(&seq);
77                   tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s",
78                                   TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU,
79                                   TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME,
80                                   TEP_PRINT_INFO);
81           }
82           ...
83

FILES

85           event-parse.h
86                   Header file to include in order to have access to the library APIs.
87           trace-seq.h
88                   Header file to include in order to have access to trace sequences related APIs.
89                   Trace sequences are used to allow a function to call several other functions
90                   to create a string of data to use.
91           -ltraceevent
92                   Linker switch to add when building a program that uses the library.
93

SEE ALSO

95       libtraceevent(3), trace-cmd(1)
96

AUTHOR

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

REPORTING BUGS

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

LICENSE

105       libtraceevent is Free Software licensed under the GNU LGPL 2.1
106

RESOURCES

108       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
109

NOTES

111        1. rostedt@goodmis.org
112           mailto:rostedt@goodmis.org
113
114        2. tz.stoyanov@gmail.com
115           mailto:tz.stoyanov@gmail.com
116
117        3. linux-trace-devel@vger.kernel.org
118           mailto:linux-trace-devel@vger.kernel.org
119
120
121
122libtraceevent 1.5.3               04/15/2022                  LIBTRACEEVENT(3)
Impressum