将Trace数据通过TCP发送走而不是保存在目标板上。
如果虚拟机作为上位机,需要网卡配置成桥接模式。
在上位机上打开 LTTng relay daemon:
lttng-relayd
在目标板上开启record session 的时候,指定远程url:
lttng create my-session --set-url=net://remote-system
具体的:
Create a network streaming mode recording session:
lttng [GENERAL OPTIONS] create [SESSION] [--shm-path=DIR]
(--set-url=URL | --ctrl-url=URL --data-url=URL)
The argument of the --set-url=URL, --ctrl-url=URL, and --data-url=URL options is an URL.
There are two available URL formats.
Local format
file://TRACEDIR
The file:// protocol targets the local file system: you may only use such an URL with the --set-url option when you create the recording session in local or snapshot mode (see the “Recording session modes” section above).
TRACEDIR
Absolute path to the directory containing the trace data on the local file system.
Network format
NETPROTO://(HOST | IPADDR)[:CTRLPORT[:DATAPORT]][/TRACEDIR]
This format is only available when you create the recording session in network streaming, snapshot (--snapshot), or live (--live) mode (see the “Recording session modes” section above).
NETPROTO
Network protocol, amongst:
net
TCP over IPv4.
The default values of CTRLPORT and DATAPORT are respectively 5342 and 5343.
net6
TCP over IPv6.
The default values of CTRLPORT and DATAPORT are respectively 5342 and 5343.
tcp
Same as the net protocol.
You may only use this with the --ctrl-url and --data-url options together.
tcp6
Same as the net6 protocol.
You can only be use this with the --ctrl-url and --data-url options together.
(HOST
| IPADDR
)
Hostname or IP address.
IPv6 address must be enclosed in square brackets ([ and ]); see RFC 2732.
CTRLPORT
Control TCP port.
DATAPORT
Data TCP port.
TRACEDIR
Path of the directory containing the trace data on the remote file system.
This path is relative to the base output directory of the LTTng relay daemon (see the --output option of lttng-relayd(8)).
Example:Create a normal mode recording session with a generated name.
$
lttng create
Example:Create a normal mode recording session with a custom name.
$
lttng create my-session
Example:Create a normal mode recording session with a specific output directory.
See the --output option.
$
lttng create --output=/path/to/traces
Example:Create a network streaming mode recording session.
See the “Output directory” section of lttng-relayd(8) to understand where the relay daemon to connect to (10.0.0.242) writes the received traces.
See the --set-url option.
$
lttng create --set-url=net://10.0.0.242/inv4
Example:Create a snapshot mode recording session with a default snapshot output.
See the --snapshot option.
$
lttng create --snapshot
Example:Create a snapshot mode recording session with a custom snapshot output.
See the --snapshot and --set-url options.
$
lttng create --snapshot \
--set-url=tcp://192.168.1.102:1234:5678/my-snapshots
Example:Create a snapshot mode recording session with no snapshot output.
See the --snapshot and --no-output options.
$
lttng create --snapshot --no-output
Example:Create an LTTng live mode recording session with a default relay daemon URL.
See the --live option.
$
lttng create --live
Example:Create an LTTng live mode recording session with a custom live timer period and relay daemon URL.
See the --live and --set-url options.
$
lttng create --live=250000 \
--set-url=tcp://relayd34:4885:4886
Example:Create a normal mode recording session with a custom directory containing the ring buffer shared memory files.
See the --shm-path option.
$
lttng create my-session --shm-path=/mnt/nvram2/lttng
这里备注一下,如果没进行配置,这里的TRACEDIR实际上是相对于$LTTNG_HOME/lttng-traces内的地址。一般就是在/home/lttng-traces下面了。
The relay daemon uses different output path patterns depending on:
Its configuration.
See the “Daemon configuration” section above.
The recording session configuration of the connected peer.
The LTTng session daemon (see lttng-sessiond(8)) version of the connected peer.
Consider the following variables:
BASE
Base output directory: $LTTNG_HOME/lttng-traces ($LTTNG_HOME defaults to $HOME) or the argument of the --output option.
HOSTNAME
Hostname of the connected peer.
SESSION
Recording session name.
DATETIME
Unique recording session date/time.
TRACEDIR
Custom trace directory path (TRACEDIR part of the argument of the --set-url option of the lttng-create(1) command, if any).
SESSIONDV
The version of the LTTng session daemon of the connected peer.
The relay daemon output path patterns are:
With the --group-output-by-host
option (hostname grouping)
Without a custom trace directory
BASE/HOSTNAME/SESSION-DATETIME
With a custom trace directory
BASE/HOSTNAME/TRACEDIR
With the --group-output-by-session
option (recording session grouping)
Without a custom trace directory
SESSIONDV
is at least 2.4
BASE/SESSION/HOSTNAME-DATETIME
Otherwise
Defaults to the hostname grouping pattern:
BASE/HOSTNAME/SESSION-DATETIME
With a custom trace directory
SESSIONDV
is at least 2.4
BASE/SESSION/HOSTNAME-DATETIME/TRACEDIR
Otherwise
Defaults to the hostname grouping pattern:
BASE/HOSTNAME/TRACEDIR