Back to home page

OSCL-LXR

 
 

    


0001 libtraceevent(3)
0002 ================
0003 
0004 NAME
0005 ----
0006 tep_print_event - Writes event information into a trace sequence.
0007 
0008 SYNOPSIS
0009 --------
0010 [verse]
0011 --
0012 *#include <event-parse.h>*
0013 *#include <trace-seq.h>*
0014 
0015 void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seqpass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._)
0016 --
0017 
0018 DESCRIPTION
0019 -----------
0020 
0021 The _tep_print_event()_ function parses the event information of the given
0022 _record_ and writes it into the trace sequence _s_, according to the format
0023 string _fmt_. The desired information is specified after the format string.
0024 The _fmt_ is printf-like format string, following arguments are supported:
0025 [verse]
0026 --
0027         TEP_PRINT_PID, "%d"  - PID of the event.
0028         TEP_PRINT_CPU, "%d"  - Event CPU.
0029         TEP_PRINT_COMM, "%s" - Event command string.
0030         TEP_PRINT_NAME, "%s" - Event name.
0031         TEP_PRINT_LATENCY, "%s" - Latency of the event. It prints 4 or more
0032                         fields - interrupt state, scheduling state,
0033                         current context, and preemption count.
0034                         Field 1 is the interrupt enabled state:
0035                                 d : Interrupts are disabled
0036                                 . : Interrupts are enabled
0037                                 X : The architecture does not support this
0038                                     information
0039                         Field 2 is the "need resched" state.
0040                                 N : The task is set to call the scheduler when
0041                                     possible, as another higher priority task
0042                                     may need to be scheduled in.
0043                                 . : The task is not set to call the scheduler.
0044                         Field 3 is the context state.
0045                                 . : Normal context
0046                                 s : Soft interrupt context
0047                                 h : Hard interrupt context
0048                                 H : Hard interrupt context which triggered
0049                                     during soft interrupt context.
0050                                 z : NMI context
0051                                 Z : NMI context which triggered during hard
0052                                     interrupt context
0053                         Field 4 is the preemption count.
0054                                 . : The preempt count is zero.
0055                         On preemptible kernels (where the task can be scheduled
0056                         out in arbitrary locations while in kernel context), the
0057                         preempt count, when non zero, will prevent the kernel
0058                         from scheduling out the current task. The preempt count
0059                         number is displayed when it is not zero.
0060                         Depending on the kernel, it may show other fields
0061                         (lock depth, or migration disabled, which are unique to
0062                         specialized kernels).
0063         TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be
0064                         specified as part of this format string:
0065                         "%precision.divisord". Example:
0066                         "%3.1000d" - divide the time by 1000 and print the first
0067                         3 digits before the dot. Thus, the time stamp
0068                         "123456000" will be printed as "123.456"
0069         TEP_PRINT_INFO, "%s" - event information.
0070         TEP_PRINT_INFO_RAW, "%s" - event information, in raw format.
0071 
0072 --
0073 EXAMPLE
0074 -------
0075 [source,c]
0076 --
0077 #include <event-parse.h>
0078 #include <trace-seq.h>
0079 ...
0080 struct trace_seq seq;
0081 trace_seq_init(&seq);
0082 struct tep_handle *tep = tep_alloc();
0083 ...
0084 void print_my_event(struct tep_record *record)
0085 {
0086         trace_seq_reset(&seq);
0087         tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s",
0088                         TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU,
0089                         TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME,
0090                         TEP_PRINT_INFO);
0091 }
0092 ...
0093 --
0094 
0095 FILES
0096 -----
0097 [verse]
0098 --
0099 *event-parse.h*
0100         Header file to include in order to have access to the library APIs.
0101 *trace-seq.h*
0102         Header file to include in order to have access to trace sequences related APIs.
0103         Trace sequences are used to allow a function to call several other functions
0104         to create a string of data to use.
0105 *-ltraceevent*
0106         Linker switch to add when building a program that uses the library.
0107 --
0108 
0109 SEE ALSO
0110 --------
0111 _libtraceevent(3)_, _trace-cmd(1)_
0112 
0113 AUTHOR
0114 ------
0115 [verse]
0116 --
0117 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0118 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0119 --
0120 REPORTING BUGS
0121 --------------
0122 Report bugs to  <linux-trace-devel@vger.kernel.org>
0123 
0124 LICENSE
0125 -------
0126 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0127 
0128 RESOURCES
0129 ---------
0130 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git