Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / tools / lib / traceevent / Documentation / libtraceevent-fields.txt
1 libtraceevent(3)
2 ================
3
4 NAME
5 ----
6 tep_event_common_fields, tep_event_fields - Get a list of fields for an event.
7
8 SYNOPSIS
9 --------
10 [verse]
11 --
12 *#include <event-parse.h>*
13
14 struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_);
15 struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_);
16 --
17
18 DESCRIPTION
19 -----------
20 The _tep_event_common_fields()_ function returns an array of pointers to common
21 fields for the _event_. The array is allocated in the function and must be freed
22 by free(). The last element of the array is NULL.
23
24 The _tep_event_fields()_ function returns an array of pointers to event specific
25 fields for the _event_. The array is allocated in the function and must be freed
26 by free(). The last element of the array is NULL.
27
28 RETURN VALUE
29 ------------
30 Both _tep_event_common_fields()_ and _tep_event_fields()_ functions return
31 an array of pointers to tep_format_field structures in case of success, or
32 NULL in case of an error.
33
34 EXAMPLE
35 -------
36 [source,c]
37 --
38 #include <event-parse.h>
39 ...
40 struct tep_handle *tep = tep_alloc();
41 ...
42 int i;
43 struct tep_format_field **fields;
44 struct tep_event *event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
45 if (event != NULL) {
46         fields = tep_event_common_fields(event);
47         if (fields != NULL) {
48                 i = 0;
49                 while (fields[i]) {
50                         /*
51                           walk through the list of the common fields
52                           of the kvm_exit event
53                         */
54                         i++;
55                 }
56                 free(fields);
57         }
58         fields = tep_event_fields(event);
59         if (fields != NULL) {
60                 i = 0;
61                 while (fields[i]) {
62                         /*
63                           walk through the list of the event specific
64                           fields of the kvm_exit event
65                         */
66                         i++;
67                 }
68                 free(fields);
69         }
70 }
71 ...
72 --
73
74 FILES
75 -----
76 [verse]
77 --
78 *event-parse.h*
79         Header file to include in order to have access to the library APIs.
80 *-ltraceevent*
81         Linker switch to add when building a program that uses the library.
82 --
83
84 SEE ALSO
85 --------
86 _libtraceevent(3)_, _trace-cmd(1)_
87
88 AUTHOR
89 ------
90 [verse]
91 --
92 *Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
93 *Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
94 --
95 REPORTING BUGS
96 --------------
97 Report bugs to  <linux-trace-devel@vger.kernel.org>
98
99 LICENSE
100 -------
101 libtraceevent is Free Software licensed under the GNU LGPL 2.1
102
103 RESOURCES
104 ---------
105 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git