xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-header_page.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_get_header_page_size, tep_get_header_timestamp_size, tep_is_old_format -
7*436bf2bcSAndroid Build Coastguard WorkerGet the data stored in the header page, in kernel context.
8*436bf2bcSAndroid Build Coastguard Worker
9*436bf2bcSAndroid Build Coastguard WorkerSYNOPSIS
10*436bf2bcSAndroid Build Coastguard Worker--------
11*436bf2bcSAndroid Build Coastguard Worker[verse]
12*436bf2bcSAndroid Build Coastguard Worker--
13*436bf2bcSAndroid Build Coastguard Worker*#include <event-parse.h>*
14*436bf2bcSAndroid Build Coastguard Worker
15*436bf2bcSAndroid Build Coastguard Workerint *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_);
16*436bf2bcSAndroid Build Coastguard Workerint *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_);
17*436bf2bcSAndroid Build Coastguard Workerbool *tep_is_old_format*(struct tep_handle pass:[*]_tep_);
18*436bf2bcSAndroid Build Coastguard Worker--
19*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION
20*436bf2bcSAndroid Build Coastguard Worker-----------
21*436bf2bcSAndroid Build Coastguard WorkerThese functions retrieve information from kernel context, stored in tracefs
22*436bf2bcSAndroid Build Coastguard Workerevents/header_page. Old kernels do not have header page info, so default values
23*436bf2bcSAndroid Build Coastguard Workerfrom user space context are used.
24*436bf2bcSAndroid Build Coastguard Worker
25*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_header_page_size()* function returns the size of a long integer,
26*436bf2bcSAndroid Build Coastguard Workerin kernel context. The _tep_ argument is trace event parser context.
27*436bf2bcSAndroid Build Coastguard WorkerThis information is retrieved from tracefs events/header_page, "commit" field.
28*436bf2bcSAndroid Build Coastguard Worker
29*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_header_timestamp_size()* function returns the size of timestamps,
30*436bf2bcSAndroid Build Coastguard Workerin kernel context. The _tep_ argument is trace event parser context. This
31*436bf2bcSAndroid Build Coastguard Workerinformation is retrieved from tracefs events/header_page, "timestamp" field.
32*436bf2bcSAndroid Build Coastguard Worker
33*436bf2bcSAndroid Build Coastguard WorkerThe *tep_is_old_format()* function returns true if the kernel predates
34*436bf2bcSAndroid Build Coastguard Workerthe addition of events/header_page, otherwise it returns false.
35*436bf2bcSAndroid Build Coastguard Worker
36*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE
37*436bf2bcSAndroid Build Coastguard Worker------------
38*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_header_page_size()* function returns the size of a long integer,
39*436bf2bcSAndroid Build Coastguard Workerin bytes.
40*436bf2bcSAndroid Build Coastguard Worker
41*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_header_timestamp_size()* function returns the size of timestamps,
42*436bf2bcSAndroid Build Coastguard Workerin bytes.
43*436bf2bcSAndroid Build Coastguard Worker
44*436bf2bcSAndroid Build Coastguard WorkerThe *tep_is_old_format()* function returns true, if an old kernel is used to
45*436bf2bcSAndroid Build Coastguard Workergenerate the tracing data, which has no event/header_page. If the kernel is new,
46*436bf2bcSAndroid Build Coastguard Workeror _tep_ is NULL, false is returned.
47*436bf2bcSAndroid Build Coastguard Worker
48*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE
49*436bf2bcSAndroid Build Coastguard Worker-------
50*436bf2bcSAndroid Build Coastguard Worker[source,c]
51*436bf2bcSAndroid Build Coastguard Worker--
52*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h>
53*436bf2bcSAndroid Build Coastguard Worker...
54*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc();
55*436bf2bcSAndroid Build Coastguard Worker...
56*436bf2bcSAndroid Build Coastguard Worker	int longsize;
57*436bf2bcSAndroid Build Coastguard Worker	int timesize;
58*436bf2bcSAndroid Build Coastguard Worker	bool old;
59*436bf2bcSAndroid Build Coastguard Worker
60*436bf2bcSAndroid Build Coastguard Worker	longsize = tep_get_header_page_size(tep);
61*436bf2bcSAndroid Build Coastguard Worker	timesize = tep_get_header_timestamp_size(tep);
62*436bf2bcSAndroid Build Coastguard Worker	old = tep_is_old_format(tep);
63*436bf2bcSAndroid Build Coastguard Worker
64*436bf2bcSAndroid Build Coastguard Worker	printf ("%s kernel is used to generate the tracing data.\n",
65*436bf2bcSAndroid Build Coastguard Worker		old?"Old":"New");
66*436bf2bcSAndroid Build Coastguard Worker	printf("The size of a long integer is %d bytes.\n", longsize);
67*436bf2bcSAndroid Build Coastguard Worker	printf("The timestamps size is %d bytes.\n", timesize);
68*436bf2bcSAndroid Build Coastguard Worker...
69*436bf2bcSAndroid Build Coastguard Worker--
70*436bf2bcSAndroid Build Coastguard Worker
71*436bf2bcSAndroid Build Coastguard WorkerFILES
72*436bf2bcSAndroid Build Coastguard Worker-----
73*436bf2bcSAndroid Build Coastguard Worker[verse]
74*436bf2bcSAndroid Build Coastguard Worker--
75*436bf2bcSAndroid Build Coastguard Worker*event-parse.h*
76*436bf2bcSAndroid Build Coastguard Worker	Header file to include in order to have access to the library APIs.
77*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent*
78*436bf2bcSAndroid Build Coastguard Worker	Linker switch to add when building a program that uses the library.
79*436bf2bcSAndroid Build Coastguard Worker--
80*436bf2bcSAndroid Build Coastguard Worker
81*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO
82*436bf2bcSAndroid Build Coastguard Worker--------
83*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1)
84*436bf2bcSAndroid Build Coastguard Worker
85*436bf2bcSAndroid Build Coastguard WorkerAUTHOR
86*436bf2bcSAndroid Build Coastguard Worker------
87*436bf2bcSAndroid Build Coastguard Worker[verse]
88*436bf2bcSAndroid Build Coastguard Worker--
89*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
90*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
91*436bf2bcSAndroid Build Coastguard Worker--
92*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS
93*436bf2bcSAndroid Build Coastguard Worker--------------
94*436bf2bcSAndroid Build Coastguard WorkerReport bugs to  <[email protected]>
95*436bf2bcSAndroid Build Coastguard Worker
96*436bf2bcSAndroid Build Coastguard WorkerLICENSE
97*436bf2bcSAndroid Build Coastguard Worker-------
98*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1
99*436bf2bcSAndroid Build Coastguard Worker
100*436bf2bcSAndroid Build Coastguard WorkerRESOURCES
101*436bf2bcSAndroid Build Coastguard Worker---------
102*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
103