lttng-ust(3): sort ctf_*() macro parameter definitions
[lttng-ust.git] / doc / man / lttng-ust-cyg-profile.3.txt
CommitLineData
4ddbd0b7
PP
1lttng-ust-dl(3)
2===============
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]
21*LD_PRELOAD=liblttng-ust-cyg-profile-fast.so* my-app
22
23Launch your application by preloading
24`liblttng-ust-cyg-profile.so` for slower, more verbose function
25tracing:
26
27[role="term"]
28[verse]
29*LD_PRELOAD=liblttng-ust-cyg-profile.so* my-app
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
103`TRACE_DEBUG_FUNCTION`.
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"]
112|=========================================================================
113| Field name | Description
114| `func_addr` | Function address
115|=========================================================================
116
117`lttng_ust_cyg_profile_fast:func_exit`::
118 Emitted when an application function returns, or more
119 specifically, when `__cyg_profile_func_exit()` is called.
120+
121This event has no fields. Since the `liblttng-ust-cyg-profile-fast.so`
122library should only be used when it can be guaranteed that the complete
123event stream is recorded without any missing events, a per-thread,
124stack-based approach can be used on the trace analyzer side to match
125function entry and return events.
126
127
128[[ftrace-verbose]]
129Verbose function tracing
130~~~~~~~~~~~~~~~~~~~~~~~~
131The following LTTng-UST events are available when using
132`liblttng-ust-cyg-profile.so`. Their log level is set to
133`TRACE_DEBUG_FUNCTION`.
134
135`lttng_ust_cyg_profile:func_entry`::
136 Emitted when an application function is entered, or more
137 specifically, when `__cyg_profile_func_enter()` is called.
138+
139Fields:
140+
141[options="header"]
142|=========================================================================
143| Field name | Description
144| `func_addr` | Function address
145| `call_site` | Address from which this function was called
146|=========================================================================
147
148`lttng_ust_cyg_profile:func_exit`::
149 Emitted when an application function returns, or more
150 specifically, when `__cyg_profile_func_exit()` is called.
151+
152Fields:
153+
154[options="header"]
155|=========================================================================
156| Field name | Description
157| `func_addr` | Function address
158| `call_site` | Address from which this function was called
159|=========================================================================
160
161
162include::common-footer.txt[]
163
164include::common-copyrights.txt[]
165
166include::common-authors.txt[]
167
168
169SEE ALSO
170--------
171man:lttng-ust(3),
172man:lttng(1),
173man:gcc(1),
174man:ld.so(8)
This page took 0.028348 seconds and 4 git commands to generate.