6 tep_print_event - Writes event information into a trace sequence.
12 *#include <event-parse.h>*
13 *#include <trace-seq.h>*
15 void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seqpass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._)
21 The _tep_print_event()_ function parses the event information of the given
22 _record_ and writes it into the trace sequence _s_, according to the format
23 string _fmt_. The desired information is specified after the format string.
24 The _fmt_ is printf-like format string, following arguments are supported:
27 TEP_PRINT_PID, "%d" - PID of the event.
28 TEP_PRINT_CPU, "%d" - Event CPU.
29 TEP_PRINT_COMM, "%s" - Event command string.
30 TEP_PRINT_NAME, "%s" - Event name.
31 TEP_PRINT_LATENCY, "%s" - Latency of the event. It prints 4 or more
32 fields - interrupt state, scheduling state,
33 current context, and preemption count.
34 Field 1 is the interrupt enabled state:
35 d : Interrupts are disabled
36 . : Interrupts are enabled
37 X : The architecture does not support this
39 Field 2 is the "need resched" state.
40 N : The task is set to call the scheduler when
41 possible, as another higher priority task
42 may need to be scheduled in.
43 . : The task is not set to call the scheduler.
44 Field 3 is the context state.
46 s : Soft interrupt context
47 h : Hard interrupt context
48 H : Hard interrupt context which triggered
49 during soft interrupt context.
51 Z : NMI context which triggered during hard
53 Field 4 is the preemption count.
54 . : The preempt count is zero.
55 On preemptible kernels (where the task can be scheduled
56 out in arbitrary locations while in kernel context), the
57 preempt count, when non zero, will prevent the kernel
58 from scheduling out the current task. The preempt count
59 number is displayed when it is not zero.
60 Depending on the kernel, it may show other fields
61 (lock depth, or migration disabled, which are unique to
63 TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be
64 specified as part of this format string:
65 "%precision.divisord". Example:
66 "%3.1000d" - divide the time by 1000 and print the first
67 3 digits before the dot. Thus, the time stamp
68 "123456000" will be printed as "123.456"
69 TEP_PRINT_INFO, "%s" - event information.
70 TEP_PRINT_INFO_RAW, "%s" - event information, in raw format.
77 #include <event-parse.h>
78 #include <trace-seq.h>
82 struct tep_handle *tep = tep_alloc();
84 void print_my_event(struct tep_record *record)
86 trace_seq_reset(&seq);
87 tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s",
88 TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU,
89 TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME,
100 Header file to include in order to have access to the library APIs.
102 Header file to include in order to have access to trace sequences related APIs.
103 Trace sequences are used to allow a function to call several other functions
104 to create a string of data to use.
106 Linker switch to add when building a program that uses the library.
111 _libtraceevent(3)_, _trace-cmd(1)_
117 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
118 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
122 Report bugs to <linux-trace-devel@vger.kernel.org>
126 libtraceevent is Free Software licensed under the GNU LGPL 2.1
130 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git