xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-parse_head.txt (revision 436bf2bcd5202612ffffe471bbcc1f277cc8d28e)
1*436bf2bcSAndroid Build Coastguard Workerlibtraceevent(3)
2*436bf2bcSAndroid Build Coastguard Worker================
3*436bf2bcSAndroid Build Coastguard Worker
4*436bf2bcSAndroid Build Coastguard WorkerNAME
5*436bf2bcSAndroid Build Coastguard Worker----
6*436bf2bcSAndroid Build Coastguard Workertep_parse_header_page - Parses the data stored in the header page.
7*436bf2bcSAndroid Build Coastguard Worker
8*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS
9*436bf2bcSAndroid Build Coastguard Worker--------
10*436bf2bcSAndroid Build Coastguard Worker[verse]
11*436bf2bcSAndroid Build Coastguard Worker--
12*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>*
13*436bf2bcSAndroid Build Coastguard Worker
14*436bf2bcSAndroid Build Coastguard Workerint *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_);
15*436bf2bcSAndroid Build Coastguard Worker--
16*436bf2bcSAndroid Build Coastguard Worker
17*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION
18*436bf2bcSAndroid Build Coastguard Worker-----------
19*436bf2bcSAndroid Build Coastguard WorkerThe *tep_parse_header_page()* function parses the header page data from _buf_,
20*436bf2bcSAndroid Build Coastguard Workerand initializes the _tep_, trace event parser context, with it. The buffer
21*436bf2bcSAndroid Build Coastguard Worker_buf_ is with _size_, and is supposed to be copied from
22*436bf2bcSAndroid Build Coastguard Workertracefs/events/header_page.
23*436bf2bcSAndroid Build Coastguard Worker
24*436bf2bcSAndroid Build Coastguard WorkerSome old kernels do not have header page info, in this case the
25*436bf2bcSAndroid Build Coastguard Worker*tep_parse_header_page()* function  can be called with _size_ equal to 0. The
26*436bf2bcSAndroid Build Coastguard Worker_tep_ context is initialized with default values. The _long_size_ can be used in
27*436bf2bcSAndroid Build Coastguard Workerthis use case, to set the size of a long integer to be used.
28*436bf2bcSAndroid Build Coastguard Worker
29*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE
30*436bf2bcSAndroid Build Coastguard Worker------------
31*436bf2bcSAndroid Build Coastguard WorkerThe *tep_parse_header_page()* function returns 0 in case of success, or -1
32*436bf2bcSAndroid Build Coastguard Workerin case of an error.
33*436bf2bcSAndroid Build Coastguard Worker
34*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE
35*436bf2bcSAndroid Build Coastguard Worker-------
36*436bf2bcSAndroid Build Coastguard Worker[source,c]
37*436bf2bcSAndroid Build Coastguard Worker--
38*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h>
39*436bf2bcSAndroid Build Coastguard Worker...
40*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc();
41*436bf2bcSAndroid Build Coastguard Worker...
42*436bf2bcSAndroid Build Coastguard Workerchar *buf;
43*436bf2bcSAndroid Build Coastguard Workerint size;
44*436bf2bcSAndroid Build Coastguard Workerbuf = read_file("/sys/kernel/tracing/events/header_page", &size);
45*436bf2bcSAndroid Build Coastguard Workerif (tep_parse_header_page(tep, buf, size, sizeof(unsigned long)) != 0) {
46*436bf2bcSAndroid Build Coastguard Worker	/* Failed to parse the header page */
47*436bf2bcSAndroid Build Coastguard Worker}
48*436bf2bcSAndroid Build Coastguard Worker...
49*436bf2bcSAndroid Build Coastguard Worker--
50*436bf2bcSAndroid Build Coastguard Worker
51*436bf2bcSAndroid Build Coastguard WorkerFILES
52*436bf2bcSAndroid Build Coastguard Worker-----
53*436bf2bcSAndroid Build Coastguard Worker[verse]
54*436bf2bcSAndroid Build Coastguard Worker--
55*436bf2bcSAndroid Build Coastguard Worker*event-parse.h*
56*436bf2bcSAndroid Build Coastguard Worker	Header file to include in order to have access to the library APIs.
57*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent*
58*436bf2bcSAndroid Build Coastguard Worker	Linker switch to add when building a program that uses the library.
59*436bf2bcSAndroid Build Coastguard Worker--
60*436bf2bcSAndroid Build Coastguard Worker
61*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO
62*436bf2bcSAndroid Build Coastguard Worker--------
63*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1)
64*436bf2bcSAndroid Build Coastguard Worker
65*436bf2bcSAndroid Build Coastguard WorkerAUTHOR
66*436bf2bcSAndroid Build Coastguard Worker------
67*436bf2bcSAndroid Build Coastguard Worker[verse]
68*436bf2bcSAndroid Build Coastguard Worker--
69*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
70*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
71*436bf2bcSAndroid Build Coastguard Worker--
72*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS
73*436bf2bcSAndroid Build Coastguard Worker--------------
74*436bf2bcSAndroid Build Coastguard WorkerReport bugs to  <[email protected]>
75*436bf2bcSAndroid Build Coastguard Worker
76*436bf2bcSAndroid Build Coastguard WorkerLICENSE
77*436bf2bcSAndroid Build Coastguard Worker-------
78*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1
79*436bf2bcSAndroid Build Coastguard Worker
80*436bf2bcSAndroid Build Coastguard WorkerRESOURCES
81*436bf2bcSAndroid Build Coastguard Worker---------
82*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
83