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`:
11 <table class="func-desc">
14 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
15 <th><abbr title="Tracepoint">TP</abbr> name</th>
16 <th>Instrumented function</th>
22 <code class="no-bg">ust_libc</code>
25 <code class="no-bg">malloc</code>
28 <code class="no-bg">malloc()</code>
33 <code class="no-bg">calloc</code>
36 <code class="no-bg">calloc()</code>
41 <code class="no-bg">realloc</code>
44 <code class="no-bg">realloc()</code>
49 <code class="no-bg">free</code>
52 <code class="no-bg">free()</code>
57 <code class="no-bg">memalign</code>
60 <code class="no-bg">memalign()</code>
65 <code class="no-bg">posix_memalign</code>
68 <code class="no-bg">posix_memalign()</code>
74 The following functions are traceable by
75 `liblttng-ust-pthread-wrapper.so`:
77 <table class="func-desc">
80 <th><abbr title="Tracepoint">TP</abbr> provider name</th>
81 <th><abbr title="Tracepoint">TP</abbr> name</th>
82 <th>Instrumented function</th>
88 <code class="no-bg">ust_pthread</code>
91 <code class="no-bg">pthread_mutex_lock_req</code>
94 <code class="no-bg">pthread_mutex_lock()</code> (request time)
99 <code class="no-bg">pthread_mutex_lock_acq</code>
102 <code class="no-bg">pthread_mutex_lock()</code> (acquire time)
107 <code class="no-bg">pthread_mutex_trylock</code>
110 <code class="no-bg">pthread_mutex_trylock()</code>
115 <code class="no-bg">pthread_mutex_unlock</code>
118 <code class="no-bg">pthread_mutex_unlock()</code>
124 All tracepoints have fields corresponding to the arguments of the
125 function they instrument.
127 To use one or the other with any user application, independently of
128 how the latter is built, do:
131 LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
137 LD_PRELOAD=liblttng-ust-pthread-wrapper.so my-app
143 LD_PRELOAD="liblttng-ust-libc-wrapper.so liblttng-ust-pthread-wrapper.so" my-app
146 When the shared object is preloaded, it effectively replaces the
147 functions listed in the above tables by wrappers which add tracepoints
148 and call the replaced functions.
150 Of course, like any other tracepoint, the ones above need to be enabled
151 in order for LTTng-UST to generate events. This is done using the
152 `lttng` command line tool
153 (see [Controlling tracing](#doc-controlling-tracing)).