Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib traceevent: Man pages for APIs used to extract common fields from a record

Create man pages for libtraceevent APIs:

tep_data_type(),
tep_data_pid(),
tep_data_preempt_count(),
tep_data_flags()

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/linux-trace-devel/20190503091119.23399-26-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190510200110.284281830@goodmis.org
[ Fixed missing T in description of NOSUPPORT flag ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
0133fc60 73b6b470

+137
+137
tools/lib/traceevent/Documentation/libtraceevent-record_parse.txt
··· 1 + libtraceevent(3) 2 + ================ 3 + 4 + NAME 5 + ---- 6 + tep_data_type, tep_data_pid,tep_data_preempt_count, tep_data_flags - 7 + Extract common fields from a record. 8 + 9 + SYNOPSIS 10 + -------- 11 + [verse] 12 + -- 13 + *#include <event-parse.h>* 14 + 15 + enum *trace_flag_type* { 16 + _TRACE_FLAG_IRQS_OFF_, 17 + _TRACE_FLAG_IRQS_NOSUPPORT_, 18 + _TRACE_FLAG_NEED_RESCHED_, 19 + _TRACE_FLAG_HARDIRQ_, 20 + _TRACE_FLAG_SOFTIRQ_, 21 + }; 22 + 23 + int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 24 + int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 25 + int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 26 + int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 27 + -- 28 + 29 + DESCRIPTION 30 + ----------- 31 + This set of functions can be used to extract common fields from a record. 32 + 33 + The _tep_data_type()_ function gets the event id from the record _rec_. 34 + It reads the "common_type" field. The _tep_ argument is the trace event parser 35 + context. 36 + 37 + The _tep_data_pid()_ function gets the process id from the record _rec_. 38 + It reads the "common_pid" field. The _tep_ argument is the trace event parser 39 + context. 40 + 41 + The _tep_data_preempt_count()_ function gets the preemption count from the 42 + record _rec_. It reads the "common_preempt_count" field. The _tep_ argument is 43 + the trace event parser context. 44 + 45 + The _tep_data_flags()_ function gets the latency flags from the record _rec_. 46 + It reads the "common_flags" field. The _tep_ argument is the trace event parser 47 + context. Supported latency flags are: 48 + [verse] 49 + -- 50 + _TRACE_FLAG_IRQS_OFF_, Interrupts are disabled. 51 + _TRACE_FLAG_IRQS_NOSUPPORT_, Reading IRQ flag is not supported by the architecture. 52 + _TRACE_FLAG_NEED_RESCHED_, Task needs rescheduling. 53 + _TRACE_FLAG_HARDIRQ_, Hard IRQ is running. 54 + _TRACE_FLAG_SOFTIRQ_, Soft IRQ is running. 55 + -- 56 + 57 + RETURN VALUE 58 + ------------ 59 + The _tep_data_type()_ function returns an integer, representing the event id. 60 + 61 + The _tep_data_pid()_ function returns an integer, representing the process id 62 + 63 + The _tep_data_preempt_count()_ function returns an integer, representing the 64 + preemption count. 65 + 66 + The _tep_data_flags()_ function returns an integer, representing the latency 67 + flags. Look at the _trace_flag_type_ enum for supported flags. 68 + 69 + All these functions in case of an error return a negative integer. 70 + 71 + EXAMPLE 72 + ------- 73 + [source,c] 74 + -- 75 + #include <event-parse.h> 76 + ... 77 + struct tep_handle *tep = tep_alloc(); 78 + ... 79 + void process_record(struct tep_record *record) 80 + { 81 + int data; 82 + 83 + data = tep_data_type(tep, record); 84 + if (data >= 0) { 85 + /* Got the ID of the event */ 86 + } 87 + 88 + data = tep_data_pid(tep, record); 89 + if (data >= 0) { 90 + /* Got the process ID */ 91 + } 92 + 93 + data = tep_data_preempt_count(tep, record); 94 + if (data >= 0) { 95 + /* Got the preemption count */ 96 + } 97 + 98 + data = tep_data_flags(tep, record); 99 + if (data >= 0) { 100 + /* Got the latency flags */ 101 + } 102 + } 103 + ... 104 + -- 105 + 106 + FILES 107 + ----- 108 + [verse] 109 + -- 110 + *event-parse.h* 111 + Header file to include in order to have access to the library APIs. 112 + *-ltraceevent* 113 + Linker switch to add when building a program that uses the library. 114 + -- 115 + 116 + SEE ALSO 117 + -------- 118 + _libtraceevent(3)_, _trace-cmd(1)_ 119 + 120 + AUTHOR 121 + ------ 122 + [verse] 123 + -- 124 + *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 125 + *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 126 + -- 127 + REPORTING BUGS 128 + -------------- 129 + Report bugs to <linux-trace-devel@vger.kernel.org> 130 + 131 + LICENSE 132 + ------- 133 + libtraceevent is Free Software licensed under the GNU LGPL 2.1 134 + 135 + RESOURCES 136 + --------- 137 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git