xref: /aosp_15_r20/external/libtraceevent/Documentation/libtraceevent-page_size.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_page_size, tep_set_page_size, tep_get_sub_buffer_data_size, tep_get_sub_buffer_size - Get / set the size of a memory page on
7*436bf2bcSAndroid Build Coastguard Workerthe machine, where the trace is generated
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_page_size*(struct tep_handle pass:[*]_tep_);
16*436bf2bcSAndroid Build Coastguard Workervoid *tep_set_page_size*(struct tep_handle pass:[*]_tep_, int _page_size_);
17*436bf2bcSAndroid Build Coastguard Workerint *tep_get_sub_buffer_size*(struct tep_handle pass:[*]_tep_);
18*436bf2bcSAndroid Build Coastguard Workerint *tep_get_sub_buffer_data_size*(struct tep_handle pass:[*]_tep_);
19*436bf2bcSAndroid Build Coastguard Workerint *tep_get_sub_buffer_commit_offset*(struct tep_handle pass:[*]_tep_);
20*436bf2bcSAndroid Build Coastguard Worker--
21*436bf2bcSAndroid Build Coastguard Worker
22*436bf2bcSAndroid Build Coastguard WorkerDESCRIPTION
23*436bf2bcSAndroid Build Coastguard Worker-----------
24*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_page_size()* function returns the size of a memory page on
25*436bf2bcSAndroid Build Coastguard Workerthe machine, where the trace is generated. The _tep_ argument is trace
26*436bf2bcSAndroid Build Coastguard Workerevent parser context.
27*436bf2bcSAndroid Build Coastguard Worker
28*436bf2bcSAndroid Build Coastguard WorkerThe *tep_set_page_size()* function stores in the _tep_ context the size of a
29*436bf2bcSAndroid Build Coastguard Workermemory page on the machine, where the trace is generated.
30*436bf2bcSAndroid Build Coastguard WorkerThe _tep_ argument is trace event parser context.
31*436bf2bcSAndroid Build Coastguard WorkerThe _page_size_ argument is the size of a memory page, in bytes.
32*436bf2bcSAndroid Build Coastguard Worker
33*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_sub_buffer_size()* returns the size of each "sub buffer" of the
34*436bf2bcSAndroid Build Coastguard Workerring buffer. The Linux kernel ring buffer is broken up into sections called
35*436bf2bcSAndroid Build Coastguard Workersub buffers. This returns the size of those buffers.
36*436bf2bcSAndroid Build Coastguard Worker
37*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_sub_buffer_data_size()* returns the size of just the data portion
38*436bf2bcSAndroid Build Coastguard Workerof the sub buffers.
39*436bf2bcSAndroid Build Coastguard Worker
40*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_sub_buffer_commit_offset()* returns the offset on the sub buffer
41*436bf2bcSAndroid Build Coastguard Workerthat holds the committed portion of data. This number contains the index from
42*436bf2bcSAndroid Build Coastguard Workerthe data portion of the sub buffer that is the end of the last element on the
43*436bf2bcSAndroid Build Coastguard Workersub buffer.
44*436bf2bcSAndroid Build Coastguard Worker
45*436bf2bcSAndroid Build Coastguard WorkerRETURN VALUE
46*436bf2bcSAndroid Build Coastguard Worker------------
47*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_page_size()* function returns size of the memory page, in bytes.
48*436bf2bcSAndroid Build Coastguard Worker
49*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_sub_buffer_size()* function returns the number of bytes each sub
50*436bf2bcSAndroid Build Coastguard Workerbuffer is made up of.
51*436bf2bcSAndroid Build Coastguard Worker
52*436bf2bcSAndroid Build Coastguard WorkerThe *tep_get_sub_buffer_commit_offset()* function returns the location on the
53*436bf2bcSAndroid Build Coastguard Workersub buffer that contains the index of the last element.
54*436bf2bcSAndroid Build Coastguard Worker
55*436bf2bcSAndroid Build Coastguard WorkerEXAMPLE
56*436bf2bcSAndroid Build Coastguard Worker-------
57*436bf2bcSAndroid Build Coastguard Worker[source,c]
58*436bf2bcSAndroid Build Coastguard Worker--
59*436bf2bcSAndroid Build Coastguard Worker#include <unistd.h>
60*436bf2bcSAndroid Build Coastguard Worker#include <event-parse.h>
61*436bf2bcSAndroid Build Coastguard Worker...
62*436bf2bcSAndroid Build Coastguard Workerstruct tep_handle *tep = tep_alloc();
63*436bf2bcSAndroid Build Coastguard Worker...
64*436bf2bcSAndroid Build Coastguard Worker	int page_size = getpagesize();
65*436bf2bcSAndroid Build Coastguard Worker
66*436bf2bcSAndroid Build Coastguard Worker	tep_set_page_size(tep, page_size);
67*436bf2bcSAndroid Build Coastguard Worker
68*436bf2bcSAndroid Build Coastguard Worker	printf("The page size for this machine is %d\n", tep_get_page_size(tep));
69*436bf2bcSAndroid Build Coastguard Worker
70*436bf2bcSAndroid Build Coastguard Worker--
71*436bf2bcSAndroid Build Coastguard Worker
72*436bf2bcSAndroid Build Coastguard WorkerFILES
73*436bf2bcSAndroid Build Coastguard Worker-----
74*436bf2bcSAndroid Build Coastguard Worker[verse]
75*436bf2bcSAndroid Build Coastguard Worker--
76*436bf2bcSAndroid Build Coastguard Worker*event-parse.h*
77*436bf2bcSAndroid Build Coastguard Worker	Header file to include in order to have access to the library APIs.
78*436bf2bcSAndroid Build Coastguard Worker*-ltraceevent*
79*436bf2bcSAndroid Build Coastguard Worker	Linker switch to add when building a program that uses the library.
80*436bf2bcSAndroid Build Coastguard Worker--
81*436bf2bcSAndroid Build Coastguard Worker
82*436bf2bcSAndroid Build Coastguard WorkerSEE ALSO
83*436bf2bcSAndroid Build Coastguard Worker--------
84*436bf2bcSAndroid Build Coastguard Worker*libtraceevent*(3), *trace-cmd*(1)
85*436bf2bcSAndroid Build Coastguard Worker
86*436bf2bcSAndroid Build Coastguard WorkerAUTHOR
87*436bf2bcSAndroid Build Coastguard Worker------
88*436bf2bcSAndroid Build Coastguard Worker[verse]
89*436bf2bcSAndroid Build Coastguard Worker--
90*436bf2bcSAndroid Build Coastguard Worker*Steven Rostedt* <[email protected]>, author of *libtraceevent*.
91*436bf2bcSAndroid Build Coastguard Worker*Tzvetomir Stoyanov* <[email protected]>, author of this man page.
92*436bf2bcSAndroid Build Coastguard Worker--
93*436bf2bcSAndroid Build Coastguard WorkerREPORTING BUGS
94*436bf2bcSAndroid Build Coastguard Worker--------------
95*436bf2bcSAndroid Build Coastguard WorkerReport bugs to  <[email protected]>
96*436bf2bcSAndroid Build Coastguard Worker
97*436bf2bcSAndroid Build Coastguard WorkerLICENSE
98*436bf2bcSAndroid Build Coastguard Worker-------
99*436bf2bcSAndroid Build Coastguard Workerlibtraceevent is Free Software licensed under the GNU LGPL 2.1
100*436bf2bcSAndroid Build Coastguard Worker
101*436bf2bcSAndroid Build Coastguard WorkerRESOURCES
102*436bf2bcSAndroid Build Coastguard Worker---------
103*436bf2bcSAndroid Build Coastguard Workerhttps://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
104