Remove unneeded "will"s + minor fixes
[lttng-docs.git] / contents / getting-started / tracing-the-linux-kernel.md
CommitLineData
5e0cbfb0
PP
1---
2id: tracing-the-linux-kernel
3---
4
5Make sure LTTng-tools and LTTng-modules packages
6[are installed](#doc-installing-lttng).
7
8Since you're about to trace the Linux kernel itself, let's look at the
9available kernel events using the `lttng` tool, which has a
08060fc1 10Git-like command line structure:
5e0cbfb0
PP
11
12<pre class="term">
13lttng list --kernel
14</pre>
15
f7929219
PP
16Before tracing, you need to create a session:
17
18<pre class="term">
19sudo lttng create my-session
20</pre>
21
5e0cbfb0
PP
22<div class="tip">
23<p>
24 <span class="t">Tip:</span>You can avoid using <code>sudo</code> in
08060fc1 25 the previous and following commands if your user is a member of the
f7929219
PP
26 <a href="/docs/#doc-lttng-sessiond" class="int"><code>tracing</code>
27 group</a>.
5e0cbfb0
PP
28</p>
29</div>
30
5e0cbfb0 31`my-session` is the tracing session name and could be anything you
47bfcb75 32like. `auto` is used if omitted.
5e0cbfb0
PP
33
34Let's now enable some events for this session:
35
36<pre class="term">
37sudo lttng enable-event --kernel sched_switch,sched_process_fork
38</pre>
39
40or you might want to simply enable all available kernel events (beware
47bfcb75 41that trace files grow rapidly when doing this):
5e0cbfb0
PP
42
43<pre class="term">
44sudo lttng enable-event --kernel --all
45</pre>
46
47Start tracing:
48
49<pre class="term">
50sudo lttng start
51</pre>
52
53By default, traces are saved in
54<code>~/lttng-traces/<em>name</em>-<em>date</em>-<em>time</em></code>,
55where <code><em>name</em></code> is the session name.
56
57When you're done tracing:
58
59<pre class="term">
60sudo lttng stop
61sudo lttng destroy
62</pre>
63
64Although `destroy` looks scary here, it doesn't actually destroy the
08060fc1 65outputted trace files: it only destroys the tracing session.
5e0cbfb0
PP
66
67What's next? Have a look at
68[Viewing and analyzing your traces](#doc-viewing-and-analyzing-your-traces)
69to view and analyze the trace you just recorded.
This page took 0.024655 seconds and 4 git commands to generate.