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