2 id: liblttng‑ust‑libc‑pthread-wrapper
5 `liblttng-ust-libc-wrapper.so` and `liblttng-ust-pthread-wrapper.so`
6 can add instrumentation to respectively some C standard library and
7 POSIX threads functions.
9 The following functions are traceable by `liblttng-ust-libc-wrapper.so`:
12 <table class="func-desc">
15 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
16 <th><abbr title="Tracepoint">TP</abbr> name</th>
17 <th>Instrumented function</th>
23 <code class="no-bg">ust_libc</code>
26 <code class="no-bg">malloc</code>
29 <code class="no-bg">malloc()</code>
34 <code class="no-bg">calloc</code>
37 <code class="no-bg">calloc()</code>
42 <code class="no-bg">realloc</code>
45 <code class="no-bg">realloc()</code>
50 <code class="no-bg">free</code>
53 <code class="no-bg">free()</code>
58 <code class="no-bg">memalign</code>
61 <code class="no-bg">memalign()</code>
66 <code class="no-bg">posix_memalign</code>
69 <code class="no-bg">posix_memalign()</code>
76 The following functions are traceable by
77 `liblttng-ust-pthread-wrapper.so`:
80 <table class="func-desc">
83 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
84 <th><abbr title="Tracepoint">TP</abbr> name</th>
85 <th>Instrumented function</th>
91 <code class="no-bg">ust_pthread</code>
94 <code class="no-bg">pthread_mutex_lock_req</code>
97 <code class="no-bg">pthread_mutex_lock()</code> (request time)
102 <code class="no-bg">pthread_mutex_lock_acq</code>
105 <code class="no-bg">pthread_mutex_lock()</code> (acquire time)
110 <code class="no-bg">pthread_mutex_trylock</code>
113 <code class="no-bg">pthread_mutex_trylock()</code>
118 <code class="no-bg">pthread_mutex_unlock</code>
121 <code class="no-bg">pthread_mutex_unlock()</code>
128 All tracepoints have fields corresponding to the arguments of the
129 function they instrument.
131 To use one or the other with any user application, independently of
132 how the latter is built, do:
135 LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
141 LD_PRELOAD=liblttng-ust-pthread-wrapper.so my-app
147 LD_PRELOAD="liblttng-ust-libc-wrapper.so liblttng-ust-pthread-wrapper.so" my-app
150 When the shared object is preloaded, it effectively replaces the
151 functions listed in the above tables by wrappers which add tracepoints
152 and call the replaced functions.
154 Of course, like any other tracepoint, the ones above need to be enabled
155 in order for LTTng-UST to generate events. This is done using the
156 `lttng` command line tool
157 (see [Controlling tracing](#doc-controlling-tracing)).