1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
|
'\" t
.\" Title: lttng-add-context
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 14 June 2021
.\" Manual: LTTng Manual
.\" Source: LTTng 2.13.15
.\" Language: English
.\"
.TH "LTTNG\-ADD\-CONTEXT" "1" "14 June 2021" "LTTng 2\&.13\&.15" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
lttng-add-context \- Add context fields to be recorded by LTTng
.SH "SYNOPSIS"
.sp
Add context fields to be recorded to the event records of one or more channels:
.sp
.nf
\fBlttng\fR [\fIGENERAL OPTIONS\fR] \fBadd\-context\fR
(\fB--kernel\fR | \fB--userspace\fR | \fB--jul\fR | \fB--log4j\fR)
[\fB--session\fR=\fISESSION\fR] [\fB--channel\fR=\fICHANNEL\fR]
\fB--type\fR=\fITYPE\fR [\fB--type\fR=\fITYPE\fR]\&...
.fi
.sp
List the available context field types:
.sp
.nf
\fBlttng\fR [\fIGENERAL OPTIONS\fR] \fBadd\-context\fR \fB--list\fR
.fi
.SH "DESCRIPTION"
.sp
The \fBlttng add-context\fR command can:
.PP
Without the \fB--list\fR option
.RS 4
Add one or more context fields to be recorded by LTTng to the event records of:
.PP
With the \fB--session\fR=\fISESSION\fR option
.RS 4
The recording session named
\fISESSION\fR\&.
.RE
.PP
Without the \fB--session\fR option
.RS 4
The current recording session (see
\fBlttng-concepts\fR(7)
to learn more about the current recording session)\&.
.RE
.PP
With the \fB--channel\fR=\fICHANNEL\fR
.RS 4
The channel named
\fICHANNEL\fR\&.
.RE
.PP
Without the \fB--channel\fR option
.RS 4
\fBAll\fR
the channels of the selected recording session\&.
.RE
.RE
.PP
With the \fB--list\fR option
.RS 4
List the available context field types\&.
.RE
.sp
See \fBlttng-concepts\fR(7) to learn more about recording sessions and channels\&.
.sp
Repeat the \fB--type\fR=\fITYPE\fR option to add more than one context field to be recorded\&. \fITYPE\fR is one of:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A statically\-known, or built\-in context field named\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A perf counter name:
.PP
Per\-CPU
.RS 4
Prefix:
\fBperf:cpu:\fR
.sp
Only available with the
\fB--kernel\fR
option\&.
.RE
.PP
Per\-thread
.RS 4
Prefix:
\fBperf:thread:\fR
.sp
Only available with the
\fB--userspace\fR,
\fB--jul\fR, or
\fB--log4j\fR
option\&.
.RE
.sp
Add Performance Monitoring Unit (PMU) counter context fields by raw ID with the
\fBperf:cpu:raw:r\fR\fIN\fR\fB:\fR\fINAME\fR
(\fB--kernel\fR
option) or
\fBperf:thread:raw:r\fR\fIN\fR\fB:\fR\fINAME\fR
(\fB--userspace\fR,
\fB--jul\fR, or
\fB--log4j\fR
option) types, with:
.PP
\fIN\fR
.RS 4
A hexadecimal event descriptor which follows the
\fBperf-record\fR(1)
format: a concatenation of the event number and umask value which the manufacturer of the processor provides\&.
.sp
The possible values for this part are processor\-specific\&.
.RE
.PP
\fINAME\fR
.RS 4
Custom name to identify the counter\&.
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
An LTTng application\-specific context field name:
.sp
.if n \{\
.RS 4
.\}
.nf
$app\&.\fIPROVIDER\fR:\fITYPE\fR
.fi
.if n \{\
.RE
.\}
+
\fIPROVIDER\fR:: Provider name\&.
.PP
\fITYPE\fR
.RS 4
Context type name\&.
.RE
.sp
Only available with the
\fB--jul\fR
and
\fB--log4j\fR
options\&.
.RE
.if n \{\
.sp
.\}
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
.RS 4
.sp
Make sure to \fBsingle\-quote\fR \fITYPE\fR when you run the \fBadd-context\fR command from a shell, as \fB$\fR is a special character for variable substitution in most shells\&.
.sp .5v
.RE
.if n \{\
.sp
.\}
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.RS 4
.sp
As of LTTng\ \&2\&.13\&.15, you may NOT add context fields to be recorded to the event records of a given channel once its recording session has been started (see \fBlttng-start\fR(1)) at least once\&.
.sp .5v
.RE
.sp
See the \(lqEXAMPLES\(rq section below for usage examples\&.
.SH "OPTIONS"
.sp
See \fBlttng\fR(1) for \fIGENERAL OPTIONS\fR\&.
.SS "Tracing domain"
.sp
One of:
.PP
\fB-j\fR, \fB--jul\fR
.RS 4
Add context fields to be recorded to the event records of one or more channels of the
\fBjava.util.logging\fR
(JUL) tracing domain\&.
.RE
.PP
\fB-k\fR, \fB--kernel\fR
.RS 4
Add context fields to be recorded to the event records of one or more channels of the Linux kernel tracing domain\&.
.RE
.PP
\fB-l\fR, \fB--log4j\fR
.RS 4
Add context fields to be recorded to the event records of one or more channels of the Apache log4j tracing domain\&.
.RE
.PP
\fB-u\fR, \fB--userspace\fR
.RS 4
Add context fields to be recorded to the event records of one or more channels of the user space tracing domain\&.
.RE
.SS "Recording target"
.PP
\fB-c\fR \fICHANNEL\fR, \fB--channel\fR=\fICHANNEL\fR
.RS 4
Add context fields to be recorded to the event records of a channel named
\fICHANNEL\fR
instead of all the channels of the selected recording session\&.
.RE
.PP
\fB-s\fR \fISESSION\fR, \fB--session\fR=\fISESSION\fR
.RS 4
Add context fields to be recorded to the event records of one or more channels of the recording session named
\fISESSION\fR
instead of the current recording session\&.
.RE
.SS "Context field type"
.PP
\fB--list\fR
.RS 4
List the available context field types\&.
.sp
You may NOT use this option with the
\fB--channel\fR,
\fB--session\fR, or
\fB--type\fR
options\&.
.RE
.PP
\fB-t\fR \fITYPE\fR, \fB--type\fR=\fITYPE\fR
.RS 4
Add a context field having the type
\fITYPE\fR
to be recorded\&.
.sp
Repeat this option to add more than one context field\&.
.RE
.SS "Program information"
.PP
\fB-h\fR, \fB--help\fR
.RS 4
Show help\&.
.sp
This option attempts to launch
\fB/usr/bin/man\fR
to view this manual page\&. Override the manual pager path with the
\fBLTTNG_MAN_BIN_PATH\fR
environment variable\&.
.RE
.PP
\fB--list-options\fR
.RS 4
List available command options and quit\&.
.RE
.SH "EXIT STATUS"
.PP
\fB0\fR
.RS 4
Success
.RE
.PP
\fB1\fR
.RS 4
Command error
.RE
.PP
\fB2\fR
.RS 4
Undefined command
.RE
.PP
\fB3\fR
.RS 4
Fatal error
.RE
.PP
\fB4\fR
.RS 4
Command warning (something went wrong during the command)
.RE
.SH "ENVIRONMENT"
.PP
\fBLTTNG_ABORT_ON_ERROR\fR
.RS 4
Set to
\fB1\fR
to abort the process after the first error is encountered\&.
.RE
.PP
\fBLTTNG_HOME\fR
.RS 4
Path to the LTTng home directory\&.
.sp
Defaults to
\fB$HOME\fR\&.
.sp
Useful when the Unix user running the commands has a non\-writable home directory\&.
.RE
.PP
\fBLTTNG_MAN_BIN_PATH\fR
.RS 4
Absolute path to the manual pager to use to read the LTTng command\-line help (with
\fBlttng-help\fR(1)
or with the
\fB--help\fR
option) instead of
\fB/usr/bin/man\fR\&.
.RE
.PP
\fBLTTNG_SESSION_CONFIG_XSD_PATH\fR
.RS 4
Path to the directory containing the
\fBsession.xsd\fR
recording session configuration XML schema\&.
.RE
.PP
\fBLTTNG_SESSIOND_PATH\fR
.RS 4
Absolute path to the LTTng session daemon binary (see
\fBlttng-sessiond\fR(8)) to spawn from the
\fBlttng-create\fR(1)
command\&.
.sp
The
\fB--sessiond-path\fR
general option overrides this environment variable\&.
.RE
.SH "FILES"
.PP
\fB$LTTNG_HOME/.lttngrc\fR
.RS 4
Unix user\(cqs LTTng runtime configuration\&.
.sp
This is where LTTng stores the name of the Unix user\(cqs current recording session between executions of
\fBlttng\fR(1)\&.
\fBlttng-create\fR(1)
and
\fBlttng-set-session\fR(1)
set the current recording session\&.
.RE
.PP
\fB$LTTNG_HOME/lttng-traces\fR
.RS 4
Default output directory of LTTng traces in local and snapshot modes\&.
.sp
Override this path with the
\fB--output\fR
option of the
\fBlttng-create\fR(1)
command\&.
.RE
.PP
\fB$LTTNG_HOME/.lttng\fR
.RS 4
Unix user\(cqs LTTng runtime and configuration directory\&.
.RE
.PP
\fB$LTTNG_HOME/.lttng/sessions\fR
.RS 4
Default directory containing the Unix user\(cqs saved recording session configurations (see
\fBlttng-save\fR(1)
and
\fBlttng-load\fR(1))\&.
.RE
.PP
\fB/usr/local/etc/lttng/sessions\fR
.RS 4
Directory containing the system\-wide saved recording session configurations (see
\fBlttng-save\fR(1)
and
\fBlttng-load\fR(1))\&.
.RE
.if n \{\
.sp
.\}
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.RS 4
.sp
\fB$LTTNG_HOME\fR defaults to the value of the \fBHOME\fR environment variable\&.
.sp .5v
.RE
.SH "EXAMPLES"
.PP
\fBExample\ \&1.\ \&List the available context field types\&.\fR
.RS 4
.sp
See the \fB--list\fR option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-context \-\-list
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&2.\ \&Add a single statically\-known context field to be recorded to all the Linux kernel channels of the current recording session\&.\fR
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-context \-\-kernel \-\-type=pid
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&3.\ \&Add three statically\-known context fields to be recorded to a specific user space channel of a specific recording session\&.\fR
.RS 4
.sp
See the \fB--session\fR and \fB--channel\fR options\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-context \-\-userspace \-\-session=my\-session \e
\-\-channel=my\-channel \e
\-\-type=vpid \-\-type=procname \-\-type=ip
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&4.\ \&Add a perf counter context field to be recorded to a specific Linux kernel channel of the current recording session\&.\fR
.RS 4
.sp
See the \fB--channel\fR option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-context \-\-kernel \-\-channel=my\-channel \e
\-\-type=perf:cpu:cache\-misses
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&5.\ \&Add an LTTng application\-specific context field to be recorded to all the JUL channels of the current recording session\&.\fR
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-context \-\-jul \-\-type=\*(Aq$app\&.my_server:user_cnt\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.SH "RESOURCES"
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
LTTng project website <https://lttng.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
LTTng documentation <https://lttng.org/docs>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
LTTng bug tracker <https://bugs.lttng.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Git repositories <https://git.lttng.org>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
GitHub organization <https://github.com/lttng>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Continuous integration <https://ci.lttng.org/>
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Mailing list <https://lists.lttng.org/>
for support and development:
\fBlttng-dev@lists.lttng.org\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
IRC channel <irc://irc.oftc.net/lttng>:
\fB#lttng\fR
on
\fBirc.oftc.net\fR
.RE
.SH "COPYRIGHT"
.sp
This program is part of the LTTng\-tools project\&.
.sp
LTTng\-tools is distributed under the GNU General Public License version\ \&2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html>\&. See the \fBLICENSE\fR <https://github.com/lttng/lttng-tools/blob/master/LICENSE> file for details\&.
.SH "THANKS"
.sp
Special thanks to Michel Dagenais and the DORSAL laboratory <http://www.dorsal.polymtl.ca/> at \('Ecole Polytechnique de Montr\('eal for the LTTng journey\&.
.sp
Also thanks to the Ericsson teams working on tracing which helped us greatly with detailed bug reports and unusual test cases\&.
.SH "SEE ALSO"
.sp
\fBlttng\fR(1), \fBlttng-enable-channel\fR(1), \fBlttng-concepts\fR(7)
|