1LIBTRACEEVENT(3) libtraceevent Manual LIBTRACEEVENT(3)
2
3
4
6 tep_read_number_field - Reads a number from raw data.
7
9 #include <event-parse.h>
10
11 int tep_read_number_field(struct tep_format_field *field, const void *data, unsigned long long *value);
12
14 The tep_read_number_field() function reads the value of the field from
15 the raw data and stores it in the value. The function sets the value
16 according to the endianness of the raw data and the current machine and
17 stores it in value.
18
20 The tep_read_number_field() function retunrs 0 in case of success, or
21 -1 in case of an error.
22
24 #include <event-parse.h>
25 ...
26 struct tep_handle *tep = tep_alloc();
27 ...
28 struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
29 ...
30 void process_record(struct tep_record *record)
31 {
32 unsigned long long pid;
33 struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
34
35 if (tep_read_number_field(field_pid, record->data, &pid) != 0) {
36 /* Failed to get "common_pid" value */
37 }
38 }
39 ...
40
42 event-parse.h
43 Header file to include in order to have access to the library APIs.
44 -ltraceevent
45 Linker switch to add when building a program that uses the library.
46
48 libtraceevent(3), trace-cmd(1)
49
51 Steven Rostedt <rostedt@goodmis.org[1]>, author of libtraceevent.
52 Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>, author of this man page.
53
55 Report bugs to <linux-trace-devel@vger.kernel.org[3]>
56
58 libtraceevent is Free Software licensed under the GNU LGPL 2.1
59
61 https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
62
64 1. rostedt@goodmis.org
65 mailto:rostedt@goodmis.org
66
67 2. tz.stoyanov@gmail.com
68 mailto:tz.stoyanov@gmail.com
69
70 3. linux-trace-devel@vger.kernel.org
71 mailto:linux-trace-devel@vger.kernel.org
72
73
74
75libtraceevent 1.1.1 02/08/2021 LIBTRACEEVENT(3)