'\" t
.\" Title: lttng-add-map-channel
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 21 April 2026
.\" Manual: LTTng Manual
.\" Source: LTTng 2.16.0
.\" Language: English
.\"
.TH "LTTNG\-ADD\-MAP\-CHA" "1" "21 April 2026" "LTTng 2\&.16\&.0" "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-map-channel \- Add a map channel to an LTTng recording session
.SH "SYNOPSIS"
.sp
Add a Linux kernel map channel:
.sp
.nf
\fBlttng\fR [\fIGENERAL OPTIONS\fR] \fBadd\-map\-channel\fR \fB--type\fR=\fBkernel\fR
[\fB--value-type\fR=(\fBsigned\-int\-32\fR | \fBsigned\-int\-64\fR | \fBsigned\-int\-max\fR)]
[\fB--max-key-count\fR=\fICOUNT\fR]
[\fB--update-policy\fR=(\fBper\-event\fR | \fBper\-rule\-match\fR)]
[\fB--session\fR=\fISESSION\fR] [\fICHANNEL\fR]
.fi
.sp
Add a user space map channel with a per\-user buffer ownership model:
.sp
.nf
\fBlttng\fR [\fIGENERAL OPTIONS\fR] \fBadd\-map\-channel\fR \fB--type\fR=\fBuser\fR
[\fB--value-type\fR=(\fBsigned\-int\-32\fR | \fBsigned\-int\-64\fR | \fBsigned\-int\-max\fR)]
[\fB--max-key-count\fR=\fICOUNT\fR]
[\fB--update-policy\fR=(\fBper\-event\fR | \fBper\-rule\-match\fR)]
[\fB--session\fR=\fISESSION\fR] [\fICHANNEL\fR]
.fi
.sp
Add a user space map channel with a per\-process buffer ownership model:
.sp
.nf
\fBlttng\fR [\fIGENERAL OPTIONS\fR] \fBadd\-map\-channel\fR \fB--type\fR=\fBuser\fR
[\fB--value-type\fR=(\fBsigned\-int\-32\fR | \fBsigned\-int\-64\fR | \fBsigned\-int\-max\fR)]
[\fB--max-key-count\fR=\fICOUNT\fR] \fB--buffer-ownership\fR=\fBprocess\fR
[\fB--update-policy\fR=(\fBper\-event\fR | \fBper\-rule\-match\fR)]
[\fB--dead-process-policy\fR=(\fBdrop\fR | \fBsum\-into\-shared\fR)]
[\fB--session\fR=\fISESSION\fR] [\fICHANNEL\fR]
.fi
.SH "DESCRIPTION"
.sp
The \fBlttng add-map-channel\fR command adds a map channel to a recording session\&.
.sp
A \fImap channel\fR configures a set of per\-CPU \fIcounters\fR: named integer values, keyed by strings, which accumulate over time\&. The counters of a map channel are grouped into per\-CPU stores known as \fImaps\fR\&. A map channel is similar to an event record channel (see \fBlttng-enable-channel\fR(1)), except that instead of containing ring buffers to record events, it contains maps of counters\&.
.sp
Map channels and event record channels are independent and may coexist within the same recording session: you don\(cqt need a separate recording session to add a map channel alongside event record channels\&.
.sp
All the maps within a map channel share the same value type and maximum key count\&.
.sp
To populate the counters of a map, use the \fBlttng-add-trigger\fR(1) command to create a trigger with an \(lqincrement map value\(rq action which targets the map channel\&.
.sp
The name of the map channel to add is:
.PP
With the \fICHANNEL\fR non\-option argument
.RS 4
\fICHANNEL\fR\&.
.RE
.PP
Without the \fICHANNEL\fR non\-option argument
.RS 4
Automatically generated by the session daemon\&.
.RE
.sp
The map channel to add belongs to:
.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
.sp
See \fBlttng-concepts\fR(7) to learn more about recording sessions and maps channels\&.
.sp
See the \(lqEXAMPLES\(rq section below for usage examples\&.
.sp
List the map channels of a given recording session with the \fBlttng-list\fR(1) command\&. Show the values of the map channels of a given recording session with the \fBlttng-show-maps\fR(1) command, or export them as a SQL script with the \fBlttng-export-maps\fR(1) command\&.
.SH "OPTIONS"
.sp
See \fBlttng\fR(1) for \fIGENERAL OPTIONS\fR\&.
.SS "Map channel type"
.PP
\fB-t\fR \fITYPE\fR, \fB--type\fR=\fITYPE\fR
.RS 4
Set the type of the map channel to
\fITYPE\fR\&.
.sp
\fITYPE\fR
is one of:
.PP
\fBkernel\fR
.RS 4
Linux kernel map channel\&.
.RE
.PP
\fBuser\fR
.RS 4
User space map channel\&.
.RE
.RE
.SS "Recording target"
.PP
\fB-s\fR \fISESSION\fR, \fB--session\fR=\fISESSION\fR
.RS 4
Add the map channel to the recording session named
\fISESSION\fR
instead of the current recording session\&.
.RE
.SS "Map channel properties"
.PP
\fB--buffer-ownership\fR=\fIMODEL\fR
.RS 4
Set the buffer ownership model of the map channel to
\fIMODEL\fR\&.
.sp
Only available with the
\fB--type\fR=\fBuser\fR
option: with the
\fB--type\fR=\fBkernel\fR
option, LTTng always allocates a single set of maps (one per CPU) for the whole system\&.
.sp
\fIMODEL\fR
is one of:
.PP
\fBprocess\fR
.RS 4
Allocate one set of maps (one per CPU) for each instrumented process\&.
.RE
.PP
\fBuser\fR (default)
.RS 4
Allocate one set of maps (one per CPU) shared by all the instrumented processes of each Unix user\&.
.RE
.sp
As of LTTng\ \&2\&.16\&.0, the default is
\fBuser\fR, but this may change in the future\&.
.RE
.PP
\fB--dead-process-policy\fR=\fIPOLICY\fR
.RS 4
With the
\fB--buffer-ownership\fR=\fBprocess\fR
option, set what LTTng does with the counter values of an instrumented process when this process terminates while the map channel still exists\&.
.sp
\fIPOLICY\fR
is one of:
.PP
\fBdrop\fR
.RS 4
Discard the maps of the terminated process: their counter values, which the process accumulated since the start of the recording session, are lost\&.
.RE
.PP
\fBsum-into-shared\fR (default)
.RS 4
For each map of the terminated process, add each value to the corresponding
\fIshared counter\fR
of the map channel (see
\fBlttng-concepts\fR(7)
to learn more about shared counters)\&.
.sp
When the addition would overflow the effective value type (see the
\fB--value-type\fR
option), the result wraps around (modular arithmetic) and LTTng sets the overflow flag of the shared counter\&.
.RE
.RE
.PP
\fB--max-key-count\fR=\fICOUNT\fR
.RS 4
Set the maximum number of keys per map to
\fICOUNT\fR\&.
.sp
This value directly controls the size of the underlying map buffer\&.
.sp
When a map is full, LTTng silently drops any new key\&.
.sp
Default:
\fB4096\fR\&.
.RE
.PP
\fB--value-type\fR=\fITYPE\fR
.RS 4
Set the value type of the maps within the map channel to
\fITYPE\fR\&.
.sp
This sets the
\fIconfigured\fR
value type\&. The
\fIeffective\fR
value type, that is, the value type which LTTng actually creates for a given instrumented application or for the Linux kernel, may differ from the configured one, following two simple rules:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A counter can\(cqt be wider than whatever hosts it\&.
.sp
The host is the session daemon (see
\fBlttng-sessiond\fR(8)) for a user space map channel and the Linux kernel for a Linux kernel map channel\&.
.sp
Therefore, asking for a 64\-bit counter on a 32\-bit host makes the channel creation fail\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The bitness of an instrumented application doesn\(cqt affect whether LTTng creates a user space map channel, since LTTng doesn\(cqt know it at that time; it only affects access afterwards\&.
.sp
A 64\-bit application can access a counter of any width, whereas a 32\-bit application can only access a 32\-bit counter\&.
.sp
This access limit doesn\(cqt apply to Linux kernel map channels, of which the session daemon reads the counters directly: a 32\-bit session daemon reads a 64\-bit kernel counter fine\&.
.RE
.sp
\fITYPE\fR
is one of:
.PP
\fBsigned-int-32\fR
.RS 4
Use 32\-bit signed integer values\&.
.sp
LTTng can always create such a map channel, and any instrumented application can access its counters\&.
.RE
.PP
\fBsigned-int-64\fR
.RS 4
Use 64\-bit signed integer values\&.
.sp
For a user space map channel, this requires a 64\-bit session daemon: with a 32\-bit session daemon, the channel creation fails\&. Instrumented 32\-bit applications can\(cqt access the counters\&.
.sp
For a Linux kernel map channel, this requires a 64\-bit kernel: with a 32\-bit kernel, the channel creation fails\&.
.RE
.PP
\fBsigned-int-max\fR (default)
.RS 4
Use the widest signed integer values which keep the counters accessible without making the channel creation fail\&.
.sp
For a user space map channel, each instrumented application gets a counter of its own bitness, but never wider than the session daemon\&. Both 32\-bit and 64\-bit applications can therefore always access such a map channel, and LTTng can always create it\&.
.sp
For a Linux kernel map channel, this is the bitness of the session daemon, which reads the counters\&.
.RE
.RE
.PP
\fB--update-policy\fR=\fIPOLICY\fR
.RS 4
Set the update policy of the map channel to
\fIPOLICY\fR, that is, how LTTng increments map values when triggers (see
\fBlttng-add-trigger\fR(1)) with an \(lqincrement map value\(rq action which targets this map channel fire\&.
.sp
Depending on
\fIPOLICY\fR, when LTTng emits an event\ \&\fIE\fR
and multiple \(lqevent rule matches\(rq triggers with an \(lqincrement map value\(rq action which targets this map channel match\ \&\fIE\fR:
.PP
\fBper-event\fR (default)
.RS 4
LTTng increments a single map value per resulting key, regardless of how many of those triggers match\ \&\fIE\fR\&.
.sp
This is similar to how LTTng writes a single event record to a given event record channel when multiple recording event rules of the channel match the same event (see
\fBlttng-concepts\fR(7))\&.
.RE
.PP
\fBper-rule-match\fR
.RS 4
LTTng performs one map value increment per matching trigger, even when several matching triggers produce the same key\&.
.RE
.sp
This policy only affects triggers with an \(lqevent rule matches\(rq condition (see
\fBlttng-add-trigger\fR(1))\&. For triggers with another condition type, each firing results in a single increment, regardless of
\fIPOLICY\fR\&.
.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_LIST_LEGACY\fR
.RS 4
Set to
\fB1\fR
to use the legacy output format (LTTng\ \&2\&.14 and earlier) for the
\fBlttng-list\fR(1)
command instead of the modern output format\&.
.sp
Note that the legacy output doesn\(cqt show anything related to features introduced after LTTng\ \&2\&.14\&.
.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_NO_UTF_8\fR
.RS 4
Set to
\fB1\fR
to NOT emit multi\-byte UTF\-8 sequences, even if the locale claims to support it\&.
.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
.PP
\fBLTTNG_TERM_COLOR\fR
.RS 4
Controls when to emit terminal SGR codes in the output\&.
.sp
The
\fBNO_COLOR\fR
environment variable overrides this\&.
.sp
One of:
.PP
\fBauto\fR (default)
.RS 4
Only emit SGR codes when the standard output is connected to a color\-capable terminal\&.
.RE
.PP
\fBalways\fR
.RS 4
Always emit SGR codes\&.
.RE
.PP
\fBnever\fR
.RS 4
Never emit SGR codes\&.
.RE
.RE
.PP
\fBNO_COLOR\fR
.RS 4
If set and not empty, then it\(cqs equivalent to setting
\fBLTTNG_TERM_COLOR\fR
to
\fBnever\fR\&.
.sp
See
NO_COLOR
to learn more\&.
.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.\ \&Add a Linux kernel map channel named \fBmy-counters\fR with default attributes to the current recording session\&.\fR
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-map\-channel \-\-type=kernel my\-counters
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&2.\ \&Add a user space map channel with a per\-process buffer ownership model and a maximum of 8192\ \&keys\&.\fR
.RS 4
.sp
See the \fB--buffer-ownership\fR and \fB--max-key-count\fR options\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-map\-channel \-\-type=user \e
\-\-buffer\-ownership=process \e
\-\-max\-key\-count=8192 my\-counters
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&3.\ \&Add a user space map channel with 32\-bit signed integer values\&.\fR
.RS 4
.sp
See the \fB--value-type\fR option\&.
.sp
The resulting map channel is accessible from both 32\-bit and 64\-bit instrumented applications\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-map\-channel \-\-type=user \e
\-\-value\-type=signed\-int\-32 my\-counters
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&4.\ \&Add a user space map channel with an automatically generated name to a specific recording session\&.\fR
.RS 4
.sp
See the \fB--session\fR option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-map\-channel \-\-session=my\-session \-\-type=user
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fBExample\ \&5.\ \&Add a map channel and create a trigger to count events per name\&.\fR
.RS 4
.sp
First, add the map channel:
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-map\-channel \-\-session=my\-session \-\-type=user my\-counters
.fi
.if n \{\
.RE
.\}
.sp
Then, create a trigger to increment a map value for each event, using the event name as the map key:
.sp
.if n \{\
.RS 4
.\}
.nf
$ lttng add\-trigger \-\-condition=event\-rule\-matches \e
\-\-type=user \-\-name=\*(Aq*\*(Aq \e
\-\-action=incr\-map\-value \e
\-\-session=my\-session \e
\-\-type=user \e
\-\-channel=my\-counters \e
\-\-key=\*(Aq{event_name}_count\*(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
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
LTTng documentation
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
LTTng bug tracker
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Git repositories
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
GitHub organization
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Continuous integration
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Mailing list
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 :
\fB#lttng\fR
on
\fBirc.oftc.net\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Mastodon
.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 \&. See the \fBLICENSE\fR file for details\&.
.SH "THANKS"
.sp
Special thanks to Michel Dagenais and the DORSAL laboratory 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-add-trigger\fR(1), \fBlttng-export-maps\fR(1), \fBlttng-list\fR(1), \fBlttng-show-maps\fR(1), \fBlttng-concepts\fR(7)