table of contents
| LTTNG-ADD-MAP-CHA(1) | LTTng Manual | LTTNG-ADD-MAP-CHA(1) |
NAME¶
lttng-add-map-channel - Add a map channel to an LTTng recording session
SYNOPSIS¶
Add a Linux kernel map channel:
lttng [GENERAL OPTIONS] add-map-channel --type=kernel
[--value-type=(signed-int-32 | signed-int-64 | signed-int-max)]
[--max-key-count=COUNT]
[--update-policy=(per-event | per-rule-match)]
[--session=SESSION] [CHANNEL]
Add a user space map channel with a per-user buffer ownership model:
lttng [GENERAL OPTIONS] add-map-channel --type=user
[--value-type=(signed-int-32 | signed-int-64 | signed-int-max)]
[--max-key-count=COUNT]
[--update-policy=(per-event | per-rule-match)]
[--session=SESSION] [CHANNEL]
Add a user space map channel with a per-process buffer ownership model:
lttng [GENERAL OPTIONS] add-map-channel --type=user
[--value-type=(signed-int-32 | signed-int-64 | signed-int-max)]
[--max-key-count=COUNT] --buffer-ownership=process
[--update-policy=(per-event | per-rule-match)]
[--dead-process-policy=(drop | sum-into-shared)]
[--session=SESSION] [CHANNEL]
DESCRIPTION¶
The lttng add-map-channel command adds a map channel to a recording session.
A map channel configures a set of per-CPU counters: named integer values, keyed by strings, which accumulate over time. The counters of a map channel are grouped into per-CPU stores known as maps. A map channel is similar to an event record channel (see lttng-enable-channel(1)), except that instead of containing ring buffers to record events, it contains maps of counters.
Map channels and event record channels are independent and may coexist within the same recording session: you don’t need a separate recording session to add a map channel alongside event record channels.
All the maps within a map channel share the same value type and maximum key count.
To populate the counters of a map, use the lttng-add-trigger(1) command to create a trigger with an “increment map value” action which targets the map channel.
The name of the map channel to add is:
With the CHANNEL non-option argument
Without the CHANNEL non-option argument
The map channel to add belongs to:
With the --session=SESSION option
Without the --session option
See lttng-concepts(7) to learn more about recording sessions and maps channels.
See the “EXAMPLES” section below for usage examples.
List the map channels of a given recording session with the lttng-list(1) command. Show the values of the map channels of a given recording session with the lttng-show-maps(1) command, or export them as a SQL script with the lttng-export-maps(1) command.
OPTIONS¶
See lttng(1) for GENERAL OPTIONS.
Map channel type¶
-t TYPE, --type=TYPE
TYPE is one of:
kernel
user
Recording target¶
-s SESSION, --session=SESSION
Map channel properties¶
--buffer-ownership=MODEL
Only available with the --type=user option: with the --type=kernel option, LTTng always allocates a single set of maps (one per CPU) for the whole system.
MODEL is one of:
process
user (default)
As of LTTng 2.16.0, the default is user, but this may change in the future.
--dead-process-policy=POLICY
POLICY is one of:
drop
sum-into-shared (default)
When the addition would overflow the effective value type (see the --value-type option), the result wraps around (modular arithmetic) and LTTng sets the overflow flag of the shared counter.
--max-key-count=COUNT
This value directly controls the size of the underlying map buffer.
When a map is full, LTTng silently drops any new key.
Default: 4096.
--value-type=TYPE
This sets the configured value type. The effective 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:
The host is the session daemon (see lttng-sessiond(8)) for a user space map channel and the Linux kernel for a Linux kernel map channel.
Therefore, asking for a 64-bit counter on a 32-bit host makes the channel creation fail.
A 64-bit application can access a counter of any width, whereas a 32-bit application can only access a 32-bit counter.
This access limit doesn’t 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.
TYPE is one of:
signed-int-32
LTTng can always create such a map channel, and any instrumented application can access its counters.
signed-int-64
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’t access the counters.
For a Linux kernel map channel, this requires a 64-bit kernel: with a 32-bit kernel, the channel creation fails.
signed-int-max (default)
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.
For a Linux kernel map channel, this is the bitness of the session daemon, which reads the counters.
--update-policy=POLICY
Depending on POLICY, when LTTng emits an event E and multiple “event rule matches” triggers with an “increment map value” action which targets this map channel match E:
per-event (default)
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 lttng-concepts(7)).
per-rule-match
This policy only affects triggers with an “event rule matches” condition (see lttng-add-trigger(1)). For triggers with another condition type, each firing results in a single increment, regardless of POLICY.
Program information¶
-h, --help
This option attempts to launch /usr/bin/man to view this manual page. Override the manual pager path with the LTTNG_MAN_BIN_PATH environment variable.
--list-options
EXIT STATUS¶
0
1
2
3
4
ENVIRONMENT¶
LTTNG_ABORT_ON_ERROR
LTTNG_HOME
Defaults to $HOME.
Useful when the Unix user running the commands has a non-writable home directory.
LTTNG_LIST_LEGACY
Note that the legacy output doesn’t show anything related to features introduced after LTTng 2.14.
LTTNG_MAN_BIN_PATH
LTTNG_NO_UTF_8
LTTNG_SESSION_CONFIG_XSD_PATH
LTTNG_SESSIOND_PATH
The --sessiond-path general option overrides this environment variable.
LTTNG_TERM_COLOR
The NO_COLOR environment variable overrides this.
One of:
auto (default)
always
never
NO_COLOR
See NO_COLOR <https://no-color.org/> to learn more.
FILES¶
$LTTNG_HOME/.lttngrc
This is where LTTng stores the name of the Unix user’s current recording session between executions of lttng(1). lttng-create(1) and lttng-set-session(1) set the current recording session.
$LTTNG_HOME/lttng-traces
Override this path with the --output option of the lttng-create(1) command.
$LTTNG_HOME/.lttng
$LTTNG_HOME/.lttng/sessions
/etc/lttng/sessions
Note
$LTTNG_HOME defaults to the value of the HOME environment variable.
EXAMPLES¶
Example 1. Add a Linux kernel map channel named my-counters with default attributes to the current recording session.
$ lttng add-map-channel --type=kernel my-counters
Example 2. Add a user space map channel with a per-process buffer ownership model and a maximum of 8192 keys.
See the --buffer-ownership and --max-key-count options.
$ lttng add-map-channel --type=user \
--buffer-ownership=process \
--max-key-count=8192 my-counters
Example 3. Add a user space map channel with 32-bit signed integer values.
See the --value-type option.
The resulting map channel is accessible from both 32-bit and 64-bit instrumented applications.
$ lttng add-map-channel --type=user \
--value-type=signed-int-32 my-counters
Example 4. Add a user space map channel with an automatically generated name to a specific recording session.
See the --session option.
$ lttng add-map-channel --session=my-session --type=user
Example 5. Add a map channel and create a trigger to count events per name.
First, add the map channel:
$ lttng add-map-channel --session=my-session --type=user my-counters
Then, create a trigger to increment a map value for each event, using the event name as the map key:
$ lttng add-trigger --condition=event-rule-matches \
--type=user --name='*' \
--action=incr-map-value \
--session=my-session \
--type=user \
--channel=my-counters \
--key='{event_name}_count'
RESOURCES¶
COPYRIGHT¶
This program is part of the LTTng-tools project.
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 LICENSE <https://github.com/lttng/lttng-tools/blob/master/LICENSE> file for details.
THANKS¶
Special thanks to Michel Dagenais and the DORSAL laboratory <http://www.dorsal.polymtl.ca/> at École Polytechnique de Montréal for the LTTng journey.
Also thanks to the Ericsson teams working on tracing which helped us greatly with detailed bug reports and unusual test cases.
SEE ALSO¶
lttng(1), lttng-add-trigger(1), lttng-export-maps(1), lttng-list(1), lttng-show-maps(1), lttng-concepts(7)
| 21 April 2026 | LTTng 2.16.0 |