2 id: instrumenting-linux-kernel-tracing
5 The [Controlling tracing](#doc-controlling-tracing) section explains
6 how to use the `lttng` tool to create and control tracing sessions.
7 Although the `lttng` tool loads the appropriate _known_ LTTng kernel
8 modules when needed (by launching `root`'s session daemon), it won't
9 load your custom `lttng-probe-hello` module by default. You need to
10 manually start an LTTng session daemon as `root` and use the
11 `--extra-kmod-probes` option to append your custom probe module to the
15 sudo pkill -u root lttng-sessiond
16 sudo lttng-sessiond --extra-kmod-probes=hello
19 The first command makes sure any existing instance is killed. If
20 you're not interested in using the default probes, or if you only
21 want to use a few of them, you could use `--kmod-probes` instead,
22 which specifies an absolute list:
25 sudo lttng-sessiond --kmod-probes=hello,ext4,net,block,signal,sched
28 Confirm the custom probe module is loaded:
31 lsmod | grep lttng_probe_hello
34 The `hello_world` event should appear in the list when doing
37 lttng list --kernel | grep hello
40 You may now create an LTTng tracing session, enable the `hello_world`
41 kernel event (and others if you wish) and start tracing:
44 sudo lttng create my-session
45 sudo lttng enable-event --kernel hello_world
49 Plug a few USB devices, then stop tracing and inspect the trace (if
50 <a href="http://www.efficios.com/babeltrace" class="ext">Babeltrace</a>
58 Here's a sample output:
61 [15:30:34.835895035] (+?.?????????) hostname hello_world: { cpu_id = 1 }, { my_int = 8, char0 = 68, char1 = 97, product = "DataTraveler 2.0" }
62 [15:30:42.262781421] (+7.426886386) hostname hello_world: { cpu_id = 1 }, { my_int = 9, char0 = 80, char1 = 97, product = "Patriot Memory" }
63 [15:30:48.175621778] (+5.912840357) hostname hello_world: { cpu_id = 1 }, { my_int = 10, char0 = 68, char1 = 97, product = "DataTraveler 2.0" }
66 Two USB flash drives were used for this test.
68 You may change your LTTng custom probe, rebuild it and reload it at
69 any time when not tracing. Make sure you remove the old module
70 (either by killing the root LTTng session daemon which loaded the
71 module in the first place, or by using `modprobe --remove` directly)
72 before loading the updated one.