xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-field_read.txt (revision 436bf2bcd5202612ffffe471bbcc1f277cc8d28e)
1libtraceevent(3)
2================
3
4NAME
5----
6tep_read_number_field - Reads a number from raw data.
7
8SYNOPSIS
9--------
10[verse]
11--
12*#include <event-parse.h>*
13
14int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_);
15--
16
17DESCRIPTION
18-----------
19The *tep_read_number_field()* function reads the value of the _field_ from the
20raw _data_ and stores it in the _value_. The function sets the _value_ according
21to the endianness of the raw data and the current machine and stores it in
22_value_.
23
24RETURN VALUE
25------------
26The *tep_read_number_field()* function retunrs 0 in case of success, or -1 in
27case of an error.
28
29EXAMPLE
30-------
31[source,c]
32--
33#include <event-parse.h>
34...
35struct tep_handle *tep = tep_alloc();
36...
37struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start");
38...
39void process_record(struct tep_record *record)
40{
41	unsigned long long pid;
42	struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
43
44	if (tep_read_number_field(field_pid, record->data, &pid) != 0) {
45		/* Failed to get "common_pid" value */
46	}
47}
48...
49--
50FILES
51-----
52[verse]
53--
54*event-parse.h*
55	Header file to include in order to have access to the library APIs.
56*-ltraceevent*
57	Linker switch to add when building a program that uses the library.
58--
59
60SEE ALSO
61--------
62*libtraceevent*(3), *trace-cmd*(1)
63
64AUTHOR
65------
66[verse]
67--
68*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
69*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
70--
71REPORTING BUGS
72--------------
73Report bugs to  <[email protected]>
74
75LICENSE
76-------
77libtraceevent is Free Software licensed under the GNU LGPL 2.1
78
79RESOURCES
80---------
81https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
82