1LIBTRACEEVENT(3)             libtraceevent Manual             LIBTRACEEVENT(3)
2
3
4

NAME

6       tep_event_common_fields, tep_event_fields - Get a list of fields for an
7       event.
8

SYNOPSIS

10       #include <event-parse.h>
11
12       struct tep_format_field **tep_event_common_fields(struct tep_event *event);
13       struct tep_format_field **tep_event_fields(struct tep_event *event);
14

DESCRIPTION

16       The tep_event_common_fields() function returns an array of pointers to
17       common fields for the event. The array is allocated in the function and
18       must be freed by free(). The last element of the array is NULL.
19
20       The tep_event_fields() function returns an array of pointers to event
21       specific fields for the event. The array is allocated in the function
22       and must be freed by free(). The last element of the array is NULL.
23

RETURN VALUE

25       Both tep_event_common_fields() and tep_event_fields() functions return
26       an array of pointers to tep_format_field structures in case of success,
27       or NULL in case of an error.
28

EXAMPLE

30           #include <event-parse.h>
31           ...
32           struct tep_handle *tep = tep_alloc();
33           ...
34           int i;
35           struct tep_format_field **fields;
36           struct tep_event *event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
37           if (event != NULL) {
38                   fields = tep_event_common_fields(event);
39                   if (fields != NULL) {
40                           i = 0;
41                           while (fields[i]) {
42                                   /*
43                                     walk through the list of the common fields
44                                     of the kvm_exit event
45                                   */
46                                   i++;
47                           }
48                           free(fields);
49                   }
50                   fields = tep_event_fields(event);
51                   if (fields != NULL) {
52                           i = 0;
53                           while (fields[i]) {
54                                   /*
55                                     walk through the list of the event specific
56                                     fields of the kvm_exit event
57                                   */
58                                   i++;
59                           }
60                           free(fields);
61                   }
62           }
63           ...
64

FILES

66           event-parse.h
67                   Header file to include in order to have access to the library APIs.
68           -ltraceevent
69                   Linker switch to add when building a program that uses the library.
70

SEE ALSO

72       libtraceevent(3), trace-cmd(1)
73

AUTHOR

75           Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
76           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
77

REPORTING BUGS

79       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
80

LICENSE

82       libtraceevent is Free Software licensed under the GNU LGPL 2.1
83

RESOURCES

85       https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
86

NOTES

88        1. rostedt@goodmis.org
89           mailto:rostedt@goodmis.org
90
91        2. tz.stoyanov@gmail.com
92           mailto:tz.stoyanov@gmail.com
93
94        3. linux-trace-devel@vger.kernel.org
95           mailto:linux-trace-devel@vger.kernel.org
96
97
98
99libtraceevent 1.5.3               04/15/2022                  LIBTRACEEVENT(3)
Impressum