Remove "etc."
[lttng-docs.git] / contents / using-lttng / controlling-tracing / adding-context.md
CommitLineData
5e0cbfb0
PP
1---
2id: adding-context
3---
4
5If you read all the sections of
6[Controlling tracing](#doc-controlling-tracing) so far, you should be
7able to create tracing sessions, create and enable channels and events
8within them and start/stop the LTTng tracers. Event fields recorded in
9trace files provide important information about occurring events, but
10sometimes external context may help you solve a problem faster. This
11section discusses how to add context information to events of a
12specific channel using the `lttng` tool.
13
14There are various available context values which can accompany events
15recorded by LTTng, for example:
16
17 * **process information**:
18 * identifier (PID)
19 * name
20 * priority
21 * scheduling priority (niceness)
22 * thread identifier (TID)
23 * the **hostname** of the system on which the event occurred
ba3b1994
PP
24 * plenty of **performance counters** using perf, for example:
25 * CPU cycles, stalled cycles, idle cycles, and the other cycle types
5e0cbfb0 26 * cache misses
ba3b1994 27 * branch instructions, misses, loads
5e0cbfb0 28 * CPU faults
5e0cbfb0
PP
29
30The full list is available in the output of `lttng add-context --help`.
31Some of them are reserved for a specific domain (kernel or
32user space) while others are available for both.
33
34To add context information to one or all channels of a given tracing
35session, use the `add-context` command:
36
37<pre class="term">
38lttng add-context --userspace --type vpid --type perf:thread:cpu-cycles
39</pre>
40
41The above example adds the virtual process identifier and per-thread
42CPU cycles count values to all recorded user space domain events of the
43current tracing session. Use the `--channel` option to select a specific
44channel:
45
46<pre class="term">
47lttng add-context --kernel --channel my-channel --type tid
48</pre>
49
50adds the thread identifier value to all recorded kernel domain events
51in the channel `my-channel` of the current tracing session.
52
53Beware that context information cannot be removed from channels once
54it's added for a given tracing session.
This page took 0.023971 seconds and 4 git commands to generate.