1LIBTRACEEVENT(3) libtraceevent Manual LIBTRACEEVENT(3)
2
3
4
6 tep_find_event, tep_find_event_by_name, tep_find_event_by_record - Find
7 events by given key.
8
10 #include <event-parse.h>
11
12 struct tep_event *tep_find_event(struct tep_handle *tep, int id);
13 struct tep_event *tep_find_event_by_name(struct tep_handle *tep, const char *sys, const char *name);
14 struct tep_event *tep_find_event_by_record(struct tep_handle *tep, struct tep_record *record);
15
17 This set of functions can be used to search for an event, based on a
18 given criteria. All functions require a pointer to a tep, trace event
19 parser context.
20
21 The tep_find_event() function searches for an event by given event id.
22 The event ID is assigned dynamically and can be viewed in event’s
23 format file, "ID" field.
24
25 The tep_find_event_by_name() function searches for an event by given
26 event name, under the system sys. If the sys is NULL (not specified),
27 the first event with name is returned.
28
29 The tep_find_event_by_record()* function searches for an event from a
30 given record.
31
33 All these functions return a pointer to the found event, or NULL if
34 there is no such event.
35
37 #include <event-parse.h>
38 ...
39 struct tep_handle *tep = tep_alloc();
40 ...
41 struct tep_event *event;
42
43 event = tep_find_event(tep, 1857);
44 if (event == NULL) {
45 /* There is no event with ID 1857 */
46 }
47
48 event = tep_find_event_by_name(tep, "kvm", "kvm_exit");
49 if (event == NULL) {
50 /* There is no kvm_exit event, from kvm system */
51 }
52
53 void event_from_record(struct tep_record *record)
54 {
55 struct tep_event *event = tep_find_event_by_record(tep, record);
56 if (event == NULL) {
57 /* There is no event from given record */
58 }
59 }
60 ...
61
63 event-parse.h
64 Header file to include in order to have access to the library APIs.
65 -ltraceevent
66 Linker switch to add when building a program that uses the library.
67
69 libtraceevent(3), trace-cmd(1)
70
72 Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
73 Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
74
76 Report bugs to <linux-trace-devel@vger.kernel.org[3]>
77
79 libtraceevent is Free Software licensed under the GNU LGPL 2.1
80
82 https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
83
85 1. rostedt@goodmis.org
86 mailto:rostedt@goodmis.org
87
88 2. tz.stoyanov@gmail.com
89 mailto:tz.stoyanov@gmail.com
90
91 3. linux-trace-devel@vger.kernel.org
92 mailto:linux-trace-devel@vger.kernel.org
93
94
95
96libtraceevent 1.7.2 04/05/2023 LIBTRACEEVENT(3)