0001 libtraceevent(3)
0002 ================
0003
0004 NAME
0005 ----
0006 tep_data_type, tep_data_pid,tep_data_preempt_count, tep_data_flags -
0007 Extract common fields from a record.
0008
0009 SYNOPSIS
0010 --------
0011 [verse]
0012 --
0013 *#include <event-parse.h>*
0014
0015 enum *trace_flag_type* {
0016 _TRACE_FLAG_IRQS_OFF_,
0017 _TRACE_FLAG_IRQS_NOSUPPORT_,
0018 _TRACE_FLAG_NEED_RESCHED_,
0019 _TRACE_FLAG_HARDIRQ_,
0020 _TRACE_FLAG_SOFTIRQ_,
0021 };
0022
0023 int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
0024 int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
0025 int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
0026 int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_);
0027 --
0028
0029 DESCRIPTION
0030 -----------
0031 This set of functions can be used to extract common fields from a record.
0032
0033 The _tep_data_type()_ function gets the event id from the record _rec_.
0034 It reads the "common_type" field. The _tep_ argument is the trace event parser
0035 context.
0036
0037 The _tep_data_pid()_ function gets the process id from the record _rec_.
0038 It reads the "common_pid" field. The _tep_ argument is the trace event parser
0039 context.
0040
0041 The _tep_data_preempt_count()_ function gets the preemption count from the
0042 record _rec_. It reads the "common_preempt_count" field. The _tep_ argument is
0043 the trace event parser context.
0044
0045 The _tep_data_flags()_ function gets the latency flags from the record _rec_.
0046 It reads the "common_flags" field. The _tep_ argument is the trace event parser
0047 context. Supported latency flags are:
0048 [verse]
0049 --
0050 _TRACE_FLAG_IRQS_OFF_, Interrupts are disabled.
0051 _TRACE_FLAG_IRQS_NOSUPPORT_, Reading IRQ flag is not supported by the architecture.
0052 _TRACE_FLAG_NEED_RESCHED_, Task needs rescheduling.
0053 _TRACE_FLAG_HARDIRQ_, Hard IRQ is running.
0054 _TRACE_FLAG_SOFTIRQ_, Soft IRQ is running.
0055 --
0056
0057 RETURN VALUE
0058 ------------
0059 The _tep_data_type()_ function returns an integer, representing the event id.
0060
0061 The _tep_data_pid()_ function returns an integer, representing the process id
0062
0063 The _tep_data_preempt_count()_ function returns an integer, representing the
0064 preemption count.
0065
0066 The _tep_data_flags()_ function returns an integer, representing the latency
0067 flags. Look at the _trace_flag_type_ enum for supported flags.
0068
0069 All these functions in case of an error return a negative integer.
0070
0071 EXAMPLE
0072 -------
0073 [source,c]
0074 --
0075 #include <event-parse.h>
0076 ...
0077 struct tep_handle *tep = tep_alloc();
0078 ...
0079 void process_record(struct tep_record *record)
0080 {
0081 int data;
0082
0083 data = tep_data_type(tep, record);
0084 if (data >= 0) {
0085 /* Got the ID of the event */
0086 }
0087
0088 data = tep_data_pid(tep, record);
0089 if (data >= 0) {
0090 /* Got the process ID */
0091 }
0092
0093 data = tep_data_preempt_count(tep, record);
0094 if (data >= 0) {
0095 /* Got the preemption count */
0096 }
0097
0098 data = tep_data_flags(tep, record);
0099 if (data >= 0) {
0100 /* Got the latency flags */
0101 }
0102 }
0103 ...
0104 --
0105
0106 FILES
0107 -----
0108 [verse]
0109 --
0110 *event-parse.h*
0111 Header file to include in order to have access to the library APIs.
0112 *-ltraceevent*
0113 Linker switch to add when building a program that uses the library.
0114 --
0115
0116 SEE ALSO
0117 --------
0118 _libtraceevent(3)_, _trace-cmd(1)_
0119
0120 AUTHOR
0121 ------
0122 [verse]
0123 --
0124 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
0125 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
0126 --
0127 REPORTING BUGS
0128 --------------
0129 Report bugs to <linux-trace-devel@vger.kernel.org>
0130
0131 LICENSE
0132 -------
0133 libtraceevent is Free Software licensed under the GNU LGPL 2.1
0134
0135 RESOURCES
0136 ---------
0137 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git