doc/man: document LTTng-UST 2.13
[lttng-ust.git] / doc / man / lttng-ust-cyg-profile.3.txt
CommitLineData
fb24f1b6
PP
1lttng-ust-cyg-profile(3)
2========================
4ddbd0b7
PP
3:object-type: library
4
5
6NAME
7----
8lttng-ust-cyg-profile - Function tracing (LTTng-UST helper)
9
10
11SYNOPSIS
12--------
13Compile your application with compiler option
14nloption:-finstrument-functions.
15
16Launch your application by preloading
17`liblttng-ust-cyg-profile-fast.so` for fast function tracing:
18
19[role="term"]
20[verse]
636cf2a0 21$ *LD_PRELOAD=liblttng-ust-cyg-profile-fast.so* my-app
4ddbd0b7
PP
22
23Launch your application by preloading
24`liblttng-ust-cyg-profile.so` for slower, more verbose function
25tracing:
26
27[role="term"]
28[verse]
636cf2a0 29$ *LD_PRELOAD=liblttng-ust-cyg-profile.so* my-app
4ddbd0b7
PP
30
31
32DESCRIPTION
33-----------
34When the `liblttng-ust-cyg-profile.so` or the
35`liblttng-ust-cyg-profile-fast.so` library is preloaded before a given
36application starts, all function entry and return points are traced by
37LTTng-UST (see man:lttng-ust(3)), provided said application was compiled
38with the nloption:-finstrument-functions compiler option.
39
40See man:lttng(1) to learn more about how to control LTTng tracing
41sessions.
42
43Function tracing with LTTng-UST comes in two flavors, each one
44providing a different trade-off between performance and robustness:
45
46`liblttng-ust-cyg-profile-fast.so`::
47 This is a lightweight variant that should only be used where it can
48 be _guaranteed_ that the complete event stream is recorded without
49 any missing events. Any kind of duplicate information is left out.
50+
51At each function entry, the address of the called function is
52recorded in an LTTng-UST event. Function exits are recorded as
53another, empty LTTng-UST event.
54+
55See the <<ftrace-fast,Fast function tracing>> section below for the
56complete list of emitted events and their fields.
57
58`liblttng-ust-cyg-profile.so`::
59 This is a more robust variant which also works for use cases where
60 events might get discarded, or not recorded from application
61 startup. In these cases, the trace analyzer needs extra
62 information to be able to reconstruct the program flow.
63+
64At each function entry _and_ exit, the address of the called
65function _and_ the call site address are recorded in an LTTng-UST
66event.
67+
68See the <<ftrace-verbose,Verbose function tracing>> section below for
69the complete list of emitted events and their fields.
70
71
72Usage
73~~~~~
74To use LTTng-UST function tracing, you need to make sure the sources of
75your application are compiled with the nloption:-finstrument-functions
76compiler option.
77
78It might be necessary to limit the number of source files where this
79option is used to prevent excessive amount of trace data to be generated
80at run time. Usually, there are additional compiler flags that allow
81you to specify a more fine-grained selection of function
82instrumentation.
83
84For each instrumented function, the executable will contain calls to
85profiling function hooks (after function entry, named `__cyg_profile_func_enter()`,
86and just before function exit, named `__cyg_profile_func_exit()`).
87
88By preloading (using the `LD_PRELOAD` environment variable) one of the
89provided shared libraries, these profiling hooks get defined to emit
90LTTng events (as described below).
91
92NOTE: Using this feature can result in a *massive amount* of trace data
93to be generated by the instrumented application. Application run time is
94also considerably affected. Be careful on systems with limited
95resources.
96
97
98[[ftrace-fast]]
99Fast function tracing
100~~~~~~~~~~~~~~~~~~~~~
101The following LTTng-UST events are available when using
102`liblttng-ust-cyg-profile-fast.so`. Their log level is set to
fb24f1b6 103`LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION`.
4ddbd0b7
PP
104
105`lttng_ust_cyg_profile_fast:func_entry`::
106 Emitted when an application function is entered, or more
107 specifically, when `__cyg_profile_func_enter()` is called.
108+
109Fields:
110+
111[options="header"]
8902dadc
PP
112|===
113|Field name |Description
114
115|`func_addr`
d01f365a 116|Function address.
8902dadc 117|===
4ddbd0b7
PP
118
119`lttng_ust_cyg_profile_fast:func_exit`::
120 Emitted when an application function returns, or more
121 specifically, when `__cyg_profile_func_exit()` is called.
122+
123This event has no fields. Since the `liblttng-ust-cyg-profile-fast.so`
124library should only be used when it can be guaranteed that the complete
125event stream is recorded without any missing events, a per-thread,
126stack-based approach can be used on the trace analyzer side to match
127function entry and return events.
128
129
130[[ftrace-verbose]]
131Verbose function tracing
132~~~~~~~~~~~~~~~~~~~~~~~~
133The following LTTng-UST events are available when using
134`liblttng-ust-cyg-profile.so`. Their log level is set to
fb24f1b6 135`LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION`.
4ddbd0b7
PP
136
137`lttng_ust_cyg_profile:func_entry`::
138 Emitted when an application function is entered, or more
139 specifically, when `__cyg_profile_func_enter()` is called.
140+
141Fields:
142+
143[options="header"]
8902dadc
PP
144|===
145|Field name |Description
146
147|`func_addr`
d01f365a 148|Function address.
8902dadc
PP
149
150|`call_site`
d01f365a 151|Address from which this function was called.
8902dadc 152|===
4ddbd0b7
PP
153
154`lttng_ust_cyg_profile:func_exit`::
155 Emitted when an application function returns, or more
156 specifically, when `__cyg_profile_func_exit()` is called.
157+
158Fields:
159+
160[options="header"]
8902dadc
PP
161|===
162|Field name |Description
163
164|`func_addr`
d01f365a 165|Function address.
8902dadc
PP
166
167|`call_site`
d01f365a 168|Address from which this function was called.
8902dadc 169|===
4ddbd0b7
PP
170
171
172include::common-footer.txt[]
173
174include::common-copyrights.txt[]
175
176include::common-authors.txt[]
177
178
179SEE ALSO
180--------
181man:lttng-ust(3),
182man:lttng(1),
183man:gcc(1),
184man:ld.so(8)
This page took 0.035546 seconds and 4 git commands to generate.