2 id: liblttng-ust-libc-pthread-wrapper
6 `liblttng-ust-libc-wrapper.so` and `liblttng-ust-pthread-wrapper.so`
7 can add instrumentation to respectively some C standard library and
8 POSIX threads functions.
10 The following functions are traceable by `liblttng-ust-libc-wrapper.so`:
13 <table class="func-desc">
16 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
17 <th><abbr title="Tracepoint">TP</abbr> name</th>
18 <th>Instrumented function</th>
24 <code class="no-bg">lttng_ust_libc</code>
27 <code class="no-bg">malloc</code>
30 <code class="no-bg">malloc()</code>
35 <code class="no-bg">calloc</code>
38 <code class="no-bg">calloc()</code>
43 <code class="no-bg">realloc</code>
46 <code class="no-bg">realloc()</code>
51 <code class="no-bg">free</code>
54 <code class="no-bg">free()</code>
59 <code class="no-bg">memalign</code>
62 <code class="no-bg">memalign()</code>
67 <code class="no-bg">posix_memalign</code>
70 <code class="no-bg">posix_memalign()</code>
77 The following functions are traceable by
78 `liblttng-ust-pthread-wrapper.so`:
81 <table class="func-desc">
84 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
85 <th><abbr title="Tracepoint">TP</abbr> name</th>
86 <th>Instrumented function</th>
92 <code class="no-bg">lttng_ust_pthread</code>
95 <code class="no-bg">pthread_mutex_lock_req</code>
98 <code class="no-bg">pthread_mutex_lock()</code> (request time)
103 <code class="no-bg">pthread_mutex_lock_acq</code>
106 <code class="no-bg">pthread_mutex_lock()</code> (acquire time)
111 <code class="no-bg">pthread_mutex_trylock</code>
114 <code class="no-bg">pthread_mutex_trylock()</code>
119 <code class="no-bg">pthread_mutex_unlock</code>
122 <code class="no-bg">pthread_mutex_unlock()</code>
129 All tracepoints have fields corresponding to the arguments of the
130 function they instrument.
132 To use one or the other with any user application, independently of
133 how the latter is built, do:
136 LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
142 LD_PRELOAD=liblttng-ust-pthread-wrapper.so my-app
148 LD_PRELOAD="liblttng-ust-libc-wrapper.so liblttng-ust-pthread-wrapper.so" my-app
151 When the shared object is preloaded, it effectively replaces the
152 functions listed in the above tables by wrappers which add tracepoints
153 and call the replaced functions.
155 Of course, like any other tracepoint, the ones above need to be enabled
156 in order for LTTng-UST to generate events. This is done using the
157 `lttng` command line tool
158 (see [Controlling tracing](#doc-controlling-tracing)).