Use compiler-agnostic defines to silence warning
[lttng-tools.git] / doc / man / lttng-add-context.1.txt
CommitLineData
2e4886b8
PP
1lttng-add-context(1)
2====================
e9711845 3:revdate: 14 June 2021
2e4886b8
PP
4
5
6NAME
7----
484b2a0c 8lttng-add-context - Add context fields to be recorded by LTTng
2e4886b8
PP
9
10
11SYNOPSIS
12--------
26f0c779
PP
13Add context fields to be recorded to the event records of one or more
14channels:
2e4886b8
PP
15
16[verse]
ce19b9ed 17*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context*
f1f15c35 18 (option:--kernel | option:--userspace | option:--jul | option:--log4j | option:--log4j2)
2e4886b8
PP
19 [option:--session='SESSION'] [option:--channel='CHANNEL']
20 option:--type='TYPE' [option:--type='TYPE']...
21
484b2a0c 22List the available context field types:
2e4886b8
PP
23
24[verse]
d1cff337 25*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context* option:--list
2e4886b8
PP
26
27
28DESCRIPTION
29-----------
26f0c779 30The `lttng add-context` command can:
484b2a0c 31
26f0c779
PP
32Without the option:--list option::
33 Add one or more context fields to be recorded by LTTng to the event
f14111c9 34 records of:
26f0c779
PP
35+
36With the option:--session='SESSION' option:::
e9711845 37 The recording session named 'SESSION'.
26f0c779
PP
38
39Without the option:--session option:::
e9711845
PP
40 The current recording session (see man:lttng-concepts(7) to learn
41 more about the current recording session).
484b2a0c 42
f14111c9
PP
43With the option:--channel='CHANNEL':::
44 The channel named 'CHANNEL'.
45
46Without the option:--channel option:::
e9711845 47 *All* the channels of the selected recording session.
f14111c9 48
26f0c779
PP
49With the option:--list option::
50 List the available context field types.
484b2a0c 51
e9711845 52See man:lttng-concepts(7) to learn more about recording sessions and
26f0c779 53channels.
484b2a0c 54
26f0c779
PP
55Repeat the option:--type='TYPE' option to add more than one context
56field to be recorded. 'TYPE' is one of:
484b2a0c 57
d1e97bd6 58* A statically-known, or built-in context field name.
484b2a0c 59
26f0c779
PP
60* A perf counter name:
61+
62--
484b2a0c 63Per-CPU::
26f0c779 64 Prefix: `perf:cpu:`
484b2a0c 65+
26f0c779 66Only available with the option:--kernel option.
484b2a0c
PP
67
68Per-thread::
26f0c779 69 Prefix: `perf:thread:`
484b2a0c 70+
f1f15c35
MJ
71Only available with the option:--userspace, option:--jul,
72option:--log4j, or option:--log4j2 option.
26f0c779
PP
73--
74+
75Add Performance Monitoring Unit (PMU) counter context fields by raw ID
76with the ++perf:cpu:raw:r++__N__++:++__NAME__ (option:--kernel option)
77or ++perf:thread:raw:r++__N__++:++__NAME__ (option:--userspace,
f1f15c35 78option:--jul, option:--log4j, or option:--log4j2 option) types, with:
26f0c779
PP
79+
80--
484b2a0c
PP
81'N'::
82 A hexadecimal event descriptor which follows the man:perf-record(1)
83 format: a concatenation of the event number and umask value which
84 the manufacturer of the processor provides.
85+
26f0c779 86The possible values for this part are processor-specific.
484b2a0c
PP
87
88'NAME'::
26f0c779
PP
89 Custom name to identify the counter.
90--
2e4886b8 91
26f0c779
PP
92* An LTTng application-specific context field name:
93+
ed0a071d 94--
2e4886b8
PP
95[verse]
96$app.'PROVIDER':__TYPE__
26f0c779 97+
2e4886b8
PP
98'PROVIDER'::
99 Provider name.
100
101'TYPE'::
102 Context type name.
ed0a071d
PP
103--
104+
f1f15c35 105Only available with the option:--jul, option:--log4j and option:--log4j2 options.
2e4886b8 106
26f0c779
PP
107IMPORTANT: Make sure to **single-quote** 'TYPE' when you run the
108`add-context` command from a shell, as `$` is a special character for
109variable substitution in most shells.
484b2a0c 110
26f0c779 111NOTE: As of LTTng{nbsp}{lttng_version}, you may :not: add context fields
e9711845
PP
112to be recorded to the event records of a given channel once its
113recording session has been started (see man:lttng-start(1)) at least
114once.
2e4886b8 115
da39b67c 116See the ``<<examples,EXAMPLES>>'' section below for usage examples.
ed0a071d 117
2e4886b8 118
f5511eea 119include::common-lttng-cmd-options-head.txt[]
2e4886b8
PP
120
121
484b2a0c
PP
122Tracing domain
123~~~~~~~~~~~~~~
2e4886b8
PP
124One of:
125
126option:-j, option:--jul::
484b2a0c
PP
127 Add context fields to be recorded to the event records of one or
128 more channels of the `java.util.logging` (JUL) tracing domain.
2e4886b8
PP
129
130option:-k, option:--kernel::
484b2a0c
PP
131 Add context fields to be recorded to the event records of one or
132 more channels of the Linux kernel tracing domain.
2e4886b8
PP
133
134option:-l, option:--log4j::
484b2a0c 135 Add context fields to be recorded to the event records of one or
f1f15c35
MJ
136 more channels of the Apache Log4j 1.x tracing domain.
137
138option:--log4j2::
139 Add context fields to be recorded to the event records of one or
140 more channels of the Apache Log4j 2 tracing domain.
2e4886b8
PP
141
142option:-u, option:--userspace::
484b2a0c
PP
143 Add context fields to be recorded to the event records of one or
144 more channels of the user space tracing domain.
2e4886b8
PP
145
146
484b2a0c
PP
147Recording target
148~~~~~~~~~~~~~~~~
59b19c3c 149option:-c 'CHANNEL', option:--channel='CHANNEL'::
484b2a0c
PP
150 Add context fields to be recorded to the event records of a channel
151 named 'CHANNEL' instead of all the channels of the selected
e9711845 152 recording session.
2e4886b8 153
59b19c3c 154option:-s 'SESSION', option:--session='SESSION'::
484b2a0c 155 Add context fields to be recorded to the event records of one or
e9711845
PP
156 more channels of the recording session named 'SESSION' instead of
157 the current recording session.
2e4886b8
PP
158
159
484b2a0c
PP
160Context field type
161~~~~~~~~~~~~~~~~~~
2e4886b8 162option:--list::
484b2a0c
PP
163 List the available context field types.
164+
165You may :not: use this option with the option:--channel,
166option:--session, or option:--type options.
2e4886b8 167
59b19c3c 168option:-t 'TYPE', option:--type='TYPE'::
484b2a0c
PP
169 Add a context field having the type 'TYPE' to be recorded.
170+
171Repeat this option to add more than one context field.
2e4886b8
PP
172
173
f5511eea 174include::common-lttng-cmd-help-options.txt[]
2e4886b8
PP
175
176
f5511eea
PP
177include::common-lttng-cmd-after-options.txt[]
178
179
ed0a071d
PP
180[[examples]]
181EXAMPLES
182--------
183.List the available context field types.
184====
185See the option:--list option.
186
187[role="term"]
188----
189$ lttng add-context --list
190----
191====
192
e9711845 193.Add a single statically-known context field to be recorded to all the Linux kernel channels of the current recording session.
ed0a071d
PP
194====
195[role="term"]
196----
197$ lttng add-context --kernel --type=pid
198----
199====
200
e9711845 201.Add three statically-known context fields to be recorded to a specific user space channel of a specific recording session.
ed0a071d 202====
dca99295
PP
203See the option:--session and option:--channel options.
204
ed0a071d
PP
205[role="term"]
206----
207$ lttng add-context --userspace --session=my-session \
208 --channel=my-channel \
209 --type=vpid --type=procname --type=ip
210----
211====
212
e9711845 213.Add a perf counter context field to be recorded to a specific Linux kernel channel of the current recording session.
ed0a071d 214====
dca99295
PP
215See the option:--channel option.
216
ed0a071d
PP
217[role="term"]
218----
219$ lttng add-context --kernel --channel=my-channel \
220 --type=perf:cpu:cache-misses
221----
222====
223
e9711845 224.Add an LTTng application-specific context field to be recorded to all the JUL channels of the current recording session.
ed0a071d
PP
225====
226[role="term"]
227----
228$ lttng add-context --jul --type='$app.my_server:user_cnt'
229----
230====
231
232
f5511eea 233include::common-footer.txt[]
2e4886b8
PP
234
235
236SEE ALSO
237--------
484b2a0c 238man:lttng(1),
af1c4164
PP
239man:lttng-enable-channel(1),
240man:lttng-concepts(7)
This page took 0.062623 seconds and 5 git commands to generate.