xref: /OK3568_Linux_fs/kernel/tools/lib/traceevent/Documentation/libtraceevent-header_page.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyunlibtraceevent(3)
2*4882a593Smuzhiyun================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunNAME
5*4882a593Smuzhiyun----
6*4882a593Smuzhiyuntep_get_header_page_size, tep_get_header_timestamp_size, tep_is_old_format -
7*4882a593SmuzhiyunGet the data stored in the header page, in kernel context.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunSYNOPSIS
10*4882a593Smuzhiyun--------
11*4882a593Smuzhiyun[verse]
12*4882a593Smuzhiyun--
13*4882a593Smuzhiyun*#include <event-parse.h>*
14*4882a593Smuzhiyun
15*4882a593Smuzhiyunint *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_);
16*4882a593Smuzhiyunint *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_);
17*4882a593Smuzhiyunbool *tep_is_old_format*(struct tep_handle pass:[*]_tep_);
18*4882a593Smuzhiyun--
19*4882a593SmuzhiyunDESCRIPTION
20*4882a593Smuzhiyun-----------
21*4882a593SmuzhiyunThese functions retrieve information from kernel context, stored in tracefs
22*4882a593Smuzhiyunevents/header_page. Old kernels do not have header page info, so default values
23*4882a593Smuzhiyunfrom user space context are used.
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThe _tep_get_header_page_size()_ function returns the size of a long integer,
26*4882a593Smuzhiyunin kernel context. The _tep_ argument is trace event parser context.
27*4882a593SmuzhiyunThis information is retrieved from tracefs events/header_page, "commit" field.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunThe _tep_get_header_timestamp_size()_ function returns the size of timestamps,
30*4882a593Smuzhiyunin kernel context. The _tep_ argument is trace event parser context. This
31*4882a593Smuzhiyuninformation is retrieved from tracefs events/header_page, "timestamp" field.
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunThe _tep_is_old_format()_ function returns true if the kernel predates
34*4882a593Smuzhiyunthe addition of events/header_page, otherwise it returns false.
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunRETURN VALUE
37*4882a593Smuzhiyun------------
38*4882a593SmuzhiyunThe _tep_get_header_page_size()_ function returns the size of a long integer,
39*4882a593Smuzhiyunin bytes.
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunThe _tep_get_header_timestamp_size()_ function returns the size of timestamps,
42*4882a593Smuzhiyunin bytes.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunThe _tep_is_old_format()_ function returns true, if an old kernel is used to
45*4882a593Smuzhiyungenerate the tracing data, which has no event/header_page. If the kernel is new,
46*4882a593Smuzhiyunor _tep_ is NULL, false is returned.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunEXAMPLE
49*4882a593Smuzhiyun-------
50*4882a593Smuzhiyun[source,c]
51*4882a593Smuzhiyun--
52*4882a593Smuzhiyun#include <event-parse.h>
53*4882a593Smuzhiyun...
54*4882a593Smuzhiyunstruct tep_handle *tep = tep_alloc();
55*4882a593Smuzhiyun...
56*4882a593Smuzhiyun	int longsize;
57*4882a593Smuzhiyun	int timesize;
58*4882a593Smuzhiyun	bool old;
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun	longsize = tep_get_header_page_size(tep);
61*4882a593Smuzhiyun	timesize = tep_get_header_timestamp_size(tep);
62*4882a593Smuzhiyun	old = tep_is_old_format(tep);
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun	printf ("%s kernel is used to generate the tracing data.\n",
65*4882a593Smuzhiyun		old?"Old":"New");
66*4882a593Smuzhiyun	printf("The size of a long integer is %d bytes.\n", longsize);
67*4882a593Smuzhiyun	printf("The timestamps size is %d bytes.\n", timesize);
68*4882a593Smuzhiyun...
69*4882a593Smuzhiyun--
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunFILES
72*4882a593Smuzhiyun-----
73*4882a593Smuzhiyun[verse]
74*4882a593Smuzhiyun--
75*4882a593Smuzhiyun*event-parse.h*
76*4882a593Smuzhiyun	Header file to include in order to have access to the library APIs.
77*4882a593Smuzhiyun*-ltraceevent*
78*4882a593Smuzhiyun	Linker switch to add when building a program that uses the library.
79*4882a593Smuzhiyun--
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunSEE ALSO
82*4882a593Smuzhiyun--------
83*4882a593Smuzhiyun_libtraceevent(3)_, _trace-cmd(1)_
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunAUTHOR
86*4882a593Smuzhiyun------
87*4882a593Smuzhiyun[verse]
88*4882a593Smuzhiyun--
89*4882a593Smuzhiyun*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*.
90*4882a593Smuzhiyun*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page.
91*4882a593Smuzhiyun--
92*4882a593SmuzhiyunREPORTING BUGS
93*4882a593Smuzhiyun--------------
94*4882a593SmuzhiyunReport bugs to  <linux-trace-devel@vger.kernel.org>
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunLICENSE
97*4882a593Smuzhiyun-------
98*4882a593Smuzhiyunlibtraceevent is Free Software licensed under the GNU LGPL 2.1
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunRESOURCES
101*4882a593Smuzhiyun---------
102*4882a593Smuzhiyunhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
103