lttng-ust(3): document `lttng_ust_loaded` symbol
[lttng-ust.git] / doc / man / lttng-ust.3.txt
index 3159d6278e491a9eee06cbfa2d9b2e1186f60775..9fd3e8b8035f2a728e700007f03e475a06547f0d 100644 (file)
@@ -769,12 +769,16 @@ information about event filtering.
     reverse-lookup the source location that caused the event
     to be emitted.
 
-+perf:thread:COUNTER+::
+`perf:thread:COUNTER`::
     perf counter named 'COUNTER'. Use `lttng add-context --list` to
     list the available perf counters.
 +
 Only available on IA-32 and x86-64 architectures.
 
+`perf:thread:raw:rN:NAME`::
+    perf counter with raw ID 'N' and custom name 'NAME'. See
+    man:lttng-add-context(1) for more details.
+
 `pthread_id`::
     POSIX thread identifier. Can be used on architectures where
     `pthread_t` maps nicely to an `unsigned long` type.
@@ -987,6 +991,33 @@ Fields:
 |===
 
 
+Detect if LTTng-UST is loaded
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+To detect if `liblttng-ust` is loaded from an application:
+
+. Define the `lttng_ust_loaded` weak symbol globally:
++
+------------------------------------------------------------------------
+int lttng_ust_loaded __attribute__((weak));
+------------------------------------------------------------------------
++
+This weak symbol is set by the constructor of `liblttng-ust`.
+
+. Test `lttng_ust_loaded` where needed:
++
+------------------------------------------------------------------------
+/* ... */
+
+if (lttng_ust_loaded) {
+    /* LTTng-UST is loaded */
+} else {
+    /* LTTng-UST is NOT loaded */
+}
+
+/* ... */
+------------------------------------------------------------------------
+
+
 [[example]]
 EXAMPLE
 -------
This page took 0.023711 seconds and 4 git commands to generate.