I found a way to pick those prompts and put them in a separate,
non-selectable <pre> element on the website version so that you can see
the prompts, but you can also select all the command lines and copy them
without copying the prompts.
It's more instinctive for the typical reader to immediately recognize
command lines when they start with the classic prompts.
Also update CONTRIBUTING.adoc to indicate to use the prompts in
terminal boxes.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
-lttng add-context --jul --type='$app.retriever:cur_msg_id'
+$ lttng add-context --jul --type='$app.retriever:cur_msg_id'
-lttng enable-event --log4j my_logger \
+$ lttng enable-event --log4j my_logger \
--filter='$app.retriever:cur_msg_id == 23'
----
--
--filter='$app.retriever:cur_msg_id == 23'
----
--
+$ man lttng-enable-event
-sudo apt-get install lttng-tools
-sudo apt-get install lttng-modules-dkms
-sudo apt-get install liblttng-ust-dev
+# apt-get install lttng-tools
+# apt-get install lttng-modules-dkms
+# apt-get install liblttng-ust-dev
-sudo apt-get install liblttng-ust-agent-java
+# apt-get install liblttng-ust-agent-java
-sudo apt-get install python3-lttngust
+# apt-get install python3-lttngust
-sudo apt-add-repository ppa:lttng/stable-2.8
-sudo apt-get update
+# apt-add-repository ppa:lttng/stable-2.8
+# apt-get update
-sudo apt-get install lttng-tools
-sudo apt-get install lttng-modules-dkms
-sudo apt-get install liblttng-ust-dev
+# apt-get install lttng-tools
+# apt-get install lttng-modules-dkms
+# apt-get install liblttng-ust-dev
-sudo apt-get install liblttng-ust-agent-java
+# apt-get install liblttng-ust-agent-java
-sudo apt-get install python3-lttngust
+# apt-get install python3-lttngust
-sudo yum install lttng-tools
-sudo yum install lttng-ust
+# yum install lttng-tools
+# yum install lttng-ust
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
-sudo apt-get install lttng-modules-dkms
-sudo apt-get install liblttng-ust-dev
-sudo apt-get install lttng-tools
+# apt-get install lttng-modules-dkms
+# apt-get install liblttng-ust-dev
+# apt-get install lttng-tools
-sudo apt-get install liblttng-ust-agent-java
+# apt-get install liblttng-ust-agent-java
-sudo apt-get install python3-lttngust
+# apt-get install python3-lttngust
-sudo apk add lttng-tools
-sudo apk add lttng-ust-dev
+# apk add lttng-tools
+# apk add lttng-ust-dev
-apk add linux-vanilla linux-vanilla-dev
+# apk add linux-vanilla linux-vanilla-dev
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.8.tar.bz2 &&
tar -xf lttng-ust-latest-2.8.tar.bz2 &&
cd lttng-ust-2.8.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.8.tar.bz2 &&
tar -xf lttng-ust-latest-2.8.tar.bz2 &&
cd lttng-ust-2.8.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
[[tracing-the-linux-kernel]]
=== Trace the Linux kernel
[[tracing-the-linux-kernel]]
=== Trace the Linux kernel
-The following command lines start with cmd:sudo because you need root
-privileges to trace the Linux kernel. You can avoid using cmd:sudo if
-your Unix user is a member of the <<tracing-group,tracing group>>.
+The following command lines start with the `#` prompt because you need
+root privileges to trace the Linux kernel. You can also trace the kernel
+as a regular user if your Unix user is a member of the
+<<tracing-group,tracing group>>.
. Create a <<tracing-session,tracing session>> which writes its traces
to dir:{/tmp/my-kernel-trace}:
. Create a <<tracing-session,tracing session>> which writes its traces
to dir:{/tmp/my-kernel-trace}:
-sudo lttng create my-kernel-session --output=/tmp/my-kernel-trace
+# lttng create my-kernel-session --output=/tmp/my-kernel-trace
-sudo lttng list --kernel
-sudo lttng list --kernel --syscall
+# lttng list --kernel
+# lttng list --kernel --syscall
-sudo lttng enable-event --kernel sched_switch,sched_process_fork
-sudo lttng enable-event --kernel --syscall open,close
+# lttng enable-event --kernel sched_switch,sched_process_fork
+# lttng enable-event --kernel --syscall open,close
-sudo lttng enable-event --kernel --all
+# lttng enable-event --kernel --all
-gcc -o hello hello.o hello-tp.o -llttng-ust -ldl
+$ gcc -o hello hello.o hello-tp.o -llttng-ust -ldl
-./hello world and beyond
+$ ./hello world and beyond
-lttng-sessiond --daemonize
+$ lttng-sessiond --daemonize
+$ lttng list --userspace
-lttng create my-user-space-session
+$ lttng create my-user-space-session
-lttng enable-event --userspace hello_world:my_first_tracepoint
+$ lttng enable-event --userspace hello_world:my_first_tracepoint
-sudo lttng stop
-sudo lttng destroy
+$ lttng stop
+$ lttng destroy
-babeltrace ~/lttng-traces/my-user-space-session*
+$ babeltrace ~/lttng-traces/my-user-space-session*
----
cmd:babeltrace finds all traces recursively within the given path and
----
cmd:babeltrace finds all traces recursively within the given path and
-babeltrace /tmp/my-kernel-trace | grep _switch
+$ babeltrace /tmp/my-kernel-trace | grep _switch
----
You can pipe the output of cmd:babeltrace into a tool like man:wc(1) to
----
You can pipe the output of cmd:babeltrace into a tool like man:wc(1) to
-babeltrace /tmp/my-kernel-trace | grep _open | wc --lines
+$ babeltrace /tmp/my-kernel-trace | grep _open | wc --lines
-python3 top5proc.py /tmp/my-kernel-trace/kernel
+$ python3 top5proc.py /tmp/my-kernel-trace/kernel
-lttng <general options> <command> <command options>
+$ lttng <GENERAL OPTIONS> <COMMAND> <COMMAND OPTIONS>
----
The <<controlling-tracing,Tracing control>> section explores the
----
The <<controlling-tracing,Tracing control>> section explores the
-gcc -o app app.o tpp.o -llttng-ust -ldl
+$ gcc -o app app.o tpp.o -llttng-ust -ldl
-gcc -o app app.o tpp.a -llttng-ust -ldl
+$ gcc -o app app.o tpp.a -llttng-ust -ldl
-gcc -o app app.o -ldl -L. -ltpp
+$ gcc -o app app.o -ldl -L. -ltpp
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o tpp.o -llttng-ust -ldl
+$ gcc -shared -o libemon.so emon.o tpp.o -llttng-ust -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
+$ gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
+$ gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
-gcc -o app app.o -ldl -L. -lemon
+$ gcc -o app app.o -ldl -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -ldl -L. -lemon
+$ gcc -o app app.o -ldl -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o
+$ gcc -shared -o libemon.so emon.o
-gcc -o app app.o tpp.o -llttng-ust -ldl -L. -lemon
+$ gcc -o app app.o tpp.o -llttng-ust -ldl -L. -lemon
-gcc -Wl,--export-dynamic -o app app.o tpp.o \
+$ gcc -Wl,--export-dynamic -o app app.o tpp.o \
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o
+$ gcc -shared -o libemon.so emon.o
-LD_PRELOAD=liblttng-ust-fork.so ./my-app
+$ LD_PRELOAD=liblttng-ust-fork.so ./my-app
----
If your tracepoint provider package is
----
If your tracepoint provider package is
-LD_PRELOAD=liblttng-ust-fork.so:/path/to/tp.so ./my-app
+$ LD_PRELOAD=liblttng-ust-fork.so:/path/to/tp.so ./my-app
-gcc -o my-app my-app.o tp.o $(pkg-config --cflags --libs lttng-ust)
+$ gcc -o my-app my-app.o tp.o $(pkg-config --cflags --libs lttng-ust)
wget http://lttng.org/files/urcu/userspace-rcu-latest-0.9.tar.bz2 &&
tar -xf userspace-rcu-latest-0.9.tar.bz2 &&
cd userspace-rcu-0.9.* &&
wget http://lttng.org/files/urcu/userspace-rcu-latest-0.9.tar.bz2 &&
tar -xf userspace-rcu-latest-0.9.tar.bz2 &&
cd userspace-rcu-0.9.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.8.tar.bz2 &&
tar -xf lttng-ust-latest-2.8.tar.bz2 &&
cd lttng-ust-2.8.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.8.tar.bz2 &&
tar -xf lttng-ust-latest-2.8.tar.bz2 &&
cd lttng-ust-2.8.* &&
-LDFLAGS='-L/usr/lib/i386-linux-gnu -L/usr/lib32'
+$ LDFLAGS='-L/usr/lib/i386-linux-gnu -L/usr/lib32'
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.8.tar.bz2 &&
tar -xf lttng-tools-latest-2.8.tar.bz2 &&
cd lttng-tools-2.8.* &&
-gcc -m32 -c -I. hello-tp.c
-gcc -m32 -c hello.c
-gcc -m32 -o hello hello.o hello-tp.o \
+$ gcc -m32 -c -I. hello-tp.c
+$ gcc -m32 -c hello.c
+$ gcc -m32 -o hello hello.o hello-tp.o \
-L/usr/lib32 -L/usr/local/lib32 \
-Wl,-rpath,/usr/lib32,-rpath,/usr/local/lib32 \
-llttng-ust -ldl
-L/usr/lib32 -L/usr/local/lib32 \
-Wl,-rpath,/usr/lib32,-rpath,/usr/local/lib32 \
-llttng-ust -ldl
-gcc -o app app.c -llttng-ust
+$ gcc -o app app.c -llttng-ust
-lttng enable-event --userspace 'lttng_ust_tracef:*'
+$ lttng enable-event --userspace 'lttng_ust_tracef:*'
-gcc -o app app.c -llttng-ust
+$ gcc -o app app.c -llttng-ust
-lttng enable-event --userspace 'lttng_ust_tracelog:*'
+$ lttng enable-event --userspace 'lttng_ust_tracelog:*'
--loglevel=TRACE_WARNING
----
--
--loglevel=TRACE_WARNING
----
--
-lttng enable-event --userspace 'lttng_ust_tracelog:*'
+$ lttng enable-event --userspace 'lttng_ust_tracelog:*'
--loglevel-only=TRACE_INFO
----
--
--loglevel-only=TRACE_INFO
----
--
-LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
+$ LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
-LD_PRELOAD=liblttng-ust-libc-wrapper.so:liblttng-ust-dl.so my-app
+$ LD_PRELOAD=liblttng-ust-libc-wrapper.so:liblttng-ust-dl.so my-app
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
-lttng create
-lttng enable-event --jul jello
-lttng start
+$ lttng create
+$ lttng enable-event --jul jello
+$ lttng start
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
-lttng create
-lttng enable-event --log4j jello
-lttng start
+$ lttng create
+$ lttng enable-event --log4j jello
+$ lttng start
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>
----
<<creating-destroying-tracing-sessions,Create a tracing session>>
-lttng create
-lttng enable-event --jul jello
+$ lttng create
+$ lttng enable-event --jul jello
----
<<adding-context,Add the application-specific context fields>> to the
----
<<adding-context,Add the application-specific context fields>> to the
-lttng add-context --jul --type='$app.myRetriever:intCtx'
-lttng add-context --jul --type='$app.myRetriever:strContext'
+$ lttng add-context --jul --type='$app.myRetriever:intCtx'
+$ lttng add-context --jul --type='$app.myRetriever:strContext'
----
<<basic-tracing-session-control,Start tracing>>:
[role="term"]
----
----
<<basic-tracing-session-control,Start tracing>>:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-lttng create
-lttng enable-event --python my-logger
-lttng start
+$ lttng create
+$ lttng enable-event --python my-logger
+$ lttng start
----
Run the Python script:
[role="term"]
----
----
Run the Python script:
[role="term"]
----
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
+$ lttng stop
+$ lttng view
-echo "Some message, some $variable" > /proc/lttng-logger
+$ echo "Some message, some $variable" > /proc/lttng-logger
----
Any event that the LTTng logger emits is named `lttng_logger` and
----
Any event that the LTTng logger emits is named `lttng_logger` and
-lttng create
-lttng enable-event --kernel lttng_logger
-lttng start
+$ lttng create
+$ lttng enable-event --kernel lttng_logger
+$ lttng start
----
Run the Bash script:
[role="term"]
----
----
Run the Bash script:
[role="term"]
----
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
+$ lttng stop
+$ lttng view
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.*
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.8.tar.bz2 &&
tar -xf lttng-modules-latest-2.8.tar.bz2 &&
cd lttng-modules-2.8.*
-make KERNELDIR=/path/to/linux
-sudo make modules_install
+$ make KERNELDIR=/path/to/linux
+# make modules_install && depmod -a
-sudo lttng-sessiond --extra-kmod-probes=my_subsys,usb
+# lttng-sessiond --extra-kmod-probes=my_subsys,usb
-sudo lttng-sessiond --kmod-probes=my_subsys,usb
+# lttng-sessiond --kmod-probes=my_subsys,usb
-lsmod | grep lttng_probe_usb
+$ lsmod | grep lttng_probe_usb
-sudo pkill lttng-sessiond
-lttng-sessiond --daemonize
+$ lttng-sessiond --daemonize
-sudo lttng-sessiond --daemonize
+# lttng-sessiond --daemonize
+$ lttng create my-session
-lttng create my-session --output=/tmp/some-directory
+$ lttng create my-session --output=/tmp/some-directory
-lttng set-session new-session
+$ lttng set-session new-session
+$ lttng list --userspace
-lttng list --kernel --syscall
+$ lttng list --kernel --syscall
-lttng enable-event --kernel sched_switch
+$ lttng enable-event --kernel sched_switch
-lttng enable-event --kernel --syscall open,write,read,close
+$ lttng enable-event --kernel --syscall open,write,read,close
-lttng enable-event --kernel sched_switch --filter='prev_comm == "bash"'
+$ lttng enable-event --kernel sched_switch --filter='prev_comm == "bash"'
-lttng enable-event --kernel --all \
+$ lttng enable-event --kernel --all \
--filter='$ctx.tid == 1988 || $ctx.tid == 1534'
----
[role="term"]
----
--filter='$ctx.tid == 1988 || $ctx.tid == 1534'
----
[role="term"]
----
-lttng enable-event --jul my_logger \
+$ lttng enable-event --jul my_logger \
--filter='$app.retriever:cur_msg_id > 3'
----
--filter='$app.retriever:cur_msg_id > 3'
----
-lttng enable-event --userspace my_app:'*' --loglevel=TRACE_INFO
+$ lttng enable-event --userspace my_app:'*' --loglevel=TRACE_INFO
----
IMPORTANT: Make sure to always quote the wildcard character when you
----
IMPORTANT: Make sure to always quote the wildcard character when you
-lttng enable-event --python my-app.'*' \
+$ lttng enable-event --python my-app.'*' \
--exclude='my-app.module,my-app.hello'
----
====
--exclude='my-app.module,my-app.hello'
----
====
-lttng enable-event --log4j --all --loglevel-only=LOG4J_WARN
+$ lttng enable-event --log4j --all --loglevel-only=LOG4J_WARN
-lttng enable-event --userspace my_app:my_tracepoint --channel=my-channel
+$ lttng enable-event --userspace my_app:my_tracepoint --channel=my-channel
-lttng enable-event --userspace my_app:my_tracepoint
-lttng enable-event --userspace my_app:my_tracepoint \
+$ lttng enable-event --userspace my_app:my_tracepoint
+$ lttng enable-event --userspace my_app:my_tracepoint \
--loglevel=TRACE_INFO
----
--loglevel=TRACE_INFO
----
-lttng disable-event --python my-logger
+$ lttng disable-event --python my-logger
-lttng disable-event --jul '*'
+$ lttng disable-event --jul '*'
-lttng disable-event --jul --all-events
+$ lttng disable-event --jul --all-events
-lttng enable-channel --kernel my-channel
+$ lttng enable-channel --kernel my-channel
-lttng enable-channel --userspace --num-subbuf=4 --subbuf-size=1M \
+$ lttng enable-channel --userspace --num-subbuf=4 --subbuf-size=1M \
--buffers-pid my-channel
----
====
--buffers-pid my-channel
----
====
-lttng enable-channel --kernel --tracefile-count=8 \
+$ lttng enable-channel --kernel --tracefile-count=8 \
--tracefile-size=4194304 my-channel
----
====
--tracefile-size=4194304 my-channel
----
====
-lttng enable-channel --userspace --overwrite my-channel
+$ lttng enable-channel --userspace --overwrite my-channel
-lttng enable-event --userspace --channel=my-channel app:tp
-lttng enable-event --userspace --channel=other-channel app:tp
+$ lttng enable-event --userspace --channel=my-channel app:tp
+$ lttng enable-event --userspace --channel=other-channel app:tp
----
If both channels are enabled, when a tracepoint named `app:tp` is
----
If both channels are enabled, when a tracepoint named `app:tp` is
-lttng disable-channel --kernel my-channel
+$ lttng disable-channel --kernel my-channel
-lttng add-context --userspace --type=vpid --type=perf:thread:cpu-cycles
+$ lttng add-context --userspace --type=vpid --type=perf:thread:cpu-cycles
-lttng add-context --kernel --channel=my-channel --type=tid
+$ lttng add-context --kernel --channel=my-channel --type=tid
-lttng add-context --kernel --channel=my-channel \
+$ lttng add-context --kernel --channel=my-channel \
--type='$app:retriever:cur_msg_id'
----
--type='$app:retriever:cur_msg_id'
----
-lttng track --pid=3,4,7,10,13
+$ lttng track --pid=3,4,7,10,13
-lttng track --pid=1,15,16
+$ lttng track --pid=1,15,16
-lttng untrack --pid=3,7,10,13
+$ lttng untrack --pid=3,7,10,13
----
leads to this whitelist:
----
leads to this whitelist:
+$ lttng track --pid --all
----
The result is, again:
----
The result is, again:
-lttng untrack --pid --all
+$ lttng untrack --pid --all
+$ lttng track --pid=6,11
-lttng create my-session --set-url=net://remote-system
+$ lttng create my-session --set-url=net://remote-system
-lttng create my-session --live
+$ lttng create my-session --live
-babeltrace --input-format=lttng-live net://localhost/host/hostname/my-session
+$ babeltrace --input-format=lttng-live
+ net://localhost/host/hostname/my-session
-babeltrace --input-format=lttng-live net://localhost
+$ babeltrace --input-format=lttng-live net://localhost
----
You can start the relay daemon on another system. In this case, you need
----
You can start the relay daemon on another system. In this case, you need
-lttng create my-session --snapshot
+$ lttng create my-session --snapshot
-lttng snapshot record --name=my-first-snapshot
+$ lttng snapshot record --name=my-first-snapshot
-lttng --mi=xml enable-event --kernel --syscall open
+$ lttng --mi=xml enable-event --kernel --syscall open
----
A schema definition (XSD) is
----
A schema definition (XSD) is
-lttng metadata regenerate
+$ lttng metadata regenerate
-lttng create my-session --shm-path=/path/to/shm
+$ lttng create my-session --shm-path=/path/to/shm
-lttng-crash /path/to/shm
+$ lttng-crash /path/to/shm
-lttng-crash --extract=/path/to/trace /path/to/shm
+$ lttng-crash --extract=/path/to/trace /path/to/shm
-lttng add-context --kernel --type=perf:cpu:raw:r0013c:x86unhalted
+$ lttng add-context --kernel --type=perf:cpu:raw:r0013c:x86unhalted
-sudo apt-add-repository ppa:lttng/stable-2.9
-sudo apt-get update
+# apt-add-repository ppa:lttng/stable-2.9
+# apt-get update
-sudo apt-get install lttng-tools
-sudo apt-get install lttng-modules-dkms
-sudo apt-get install liblttng-ust-dev
+# apt-get install lttng-tools
+# apt-get install lttng-modules-dkms
+# apt-get install liblttng-ust-dev
-sudo apt-get install liblttng-ust-agent-java
+# apt-get install liblttng-ust-agent-java
-sudo apt-get install python3-lttngust
+# apt-get install python3-lttngust
-yaourt -S lttng-tools
-yaourt -S lttng-ust
-yaourt -S lttng-modules
+$ yaourt -S lttng-tools
+$ yaourt -S lttng-ust
+$ yaourt -S lttng-modules
-yaourt -S python-lttngust
-yaourt -S python2-lttngust
+$ yaourt -S python-lttngust
+$ yaourt -S python2-lttngust
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.9.tar.bz2 &&
tar -xf lttng-modules-latest-2.9.tar.bz2 &&
cd lttng-modules-2.9.* &&
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.9.tar.bz2 &&
tar -xf lttng-modules-latest-2.9.tar.bz2 &&
cd lttng-modules-2.9.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.9.tar.bz2 &&
tar -xf lttng-ust-latest-2.9.tar.bz2 &&
cd lttng-ust-2.9.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.9.tar.bz2 &&
tar -xf lttng-ust-latest-2.9.tar.bz2 &&
cd lttng-ust-2.9.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
[[tracing-the-linux-kernel]]
=== Trace the Linux kernel
[[tracing-the-linux-kernel]]
=== Trace the Linux kernel
-The following command lines start with cmd:sudo because you need root
-privileges to trace the Linux kernel. You can avoid using cmd:sudo if
-your Unix user is a member of the <<tracing-group,tracing group>>.
+The following command lines start with the `#` prompt because you need
+root privileges to trace the Linux kernel. You can also trace the kernel
+as a regular user if your Unix user is a member of the
+<<tracing-group,tracing group>>.
. Create a <<tracing-session,tracing session>> which writes its traces
to dir:{/tmp/my-kernel-trace}:
. Create a <<tracing-session,tracing session>> which writes its traces
to dir:{/tmp/my-kernel-trace}:
-sudo lttng create my-kernel-session --output=/tmp/my-kernel-trace
+# lttng create my-kernel-session --output=/tmp/my-kernel-trace
-sudo lttng list --kernel
-sudo lttng list --kernel --syscall
+# lttng list --kernel
+# lttng list --kernel --syscall
-sudo lttng enable-event --kernel sched_switch,sched_process_fork
-sudo lttng enable-event --kernel --syscall open,close
+# lttng enable-event --kernel sched_switch,sched_process_fork
+# lttng enable-event --kernel --syscall open,close
-sudo lttng enable-event --kernel --all
+# lttng enable-event --kernel --all
-sudo lttng stop
-sudo lttng destroy
+# lttng stop
+# lttng destroy
-sudo chown -R $(whoami) /tmp/my-kernel-trace
+# chown -R $(whoami) /tmp/my-kernel-trace
-gcc -o hello hello.o hello-tp.o -llttng-ust -ldl
+$ gcc -o hello hello.o hello-tp.o -llttng-ust -ldl
-./hello world and beyond
+$ ./hello world and beyond
-lttng-sessiond --daemonize
+$ lttng-sessiond --daemonize
+$ lttng list --userspace
-lttng create my-user-space-session
+$ lttng create my-user-space-session
-lttng enable-event --userspace hello_world:my_first_tracepoint
+$ lttng enable-event --userspace hello_world:my_first_tracepoint
-sudo lttng stop
-sudo lttng destroy
+$ lttng stop
+$ lttng destroy
-babeltrace ~/lttng-traces/my-user-space-session*
+$ babeltrace ~/lttng-traces/my-user-space-session*
----
cmd:babeltrace finds all traces recursively within the given path and
----
cmd:babeltrace finds all traces recursively within the given path and
-babeltrace /tmp/my-kernel-trace | grep _switch
+$ babeltrace /tmp/my-kernel-trace | grep _switch
----
You can pipe the output of cmd:babeltrace into a tool like man:wc(1) to
----
You can pipe the output of cmd:babeltrace into a tool like man:wc(1) to
-babeltrace /tmp/my-kernel-trace | grep _open | wc --lines
+$ babeltrace /tmp/my-kernel-trace | grep _open | wc --lines
-python3 top5proc.py /tmp/my-kernel-trace/kernel
+$ python3 top5proc.py /tmp/my-kernel-trace/kernel
-lttng <general options> <command> <command options>
+$ lttng <GENERAL OPTIONS> <COMMAND> <COMMAND OPTIONS>
----
The <<controlling-tracing,Tracing control>> section explores the
----
The <<controlling-tracing,Tracing control>> section explores the
-gcc -o app app.o tpp.o -llttng-ust -ldl
+$ gcc -o app app.o tpp.o -llttng-ust -ldl
-gcc -o app app.o tpp.a -llttng-ust -ldl
+$ gcc -o app app.o tpp.a -llttng-ust -ldl
-gcc -o app app.o -ldl -L. -ltpp
+$ gcc -o app app.o -ldl -L. -ltpp
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o tpp.o -llttng-ust -ldl
+$ gcc -shared -o libemon.so emon.o tpp.o -llttng-ust -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
+$ gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
+$ gcc -shared -o libemon.so emon.o -ldl -L. -ltpp
-gcc -o app app.o -ldl -L. -lemon
+$ gcc -o app app.o -ldl -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -ldl -L. -lemon
+$ gcc -o app app.o -ldl -L. -lemon
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o -ldl
+$ gcc -shared -o libemon.so emon.o -ldl
-gcc -o app app.o -L. -lemon
+$ gcc -o app app.o -L. -lemon
-LD_PRELOAD=./libtpp.so ./app
+$ LD_PRELOAD=./libtpp.so ./app
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o
+$ gcc -shared -o libemon.so emon.o
-gcc -o app app.o tpp.o -llttng-ust -ldl -L. -lemon
+$ gcc -o app app.o tpp.o -llttng-ust -ldl -L. -lemon
-gcc -Wl,--export-dynamic -o app app.o tpp.o \
+$ gcc -Wl,--export-dynamic -o app app.o tpp.o \
+$ gcc -I. -fpic -c emon.c
-gcc -shared -o libemon.so emon.o
+$ gcc -shared -o libemon.so emon.o
-LD_PRELOAD=liblttng-ust-fork.so ./my-app
+$ LD_PRELOAD=liblttng-ust-fork.so ./my-app
----
If your tracepoint provider package is
----
If your tracepoint provider package is
-LD_PRELOAD=liblttng-ust-fork.so:/path/to/tp.so ./my-app
+$ LD_PRELOAD=liblttng-ust-fork.so:/path/to/tp.so ./my-app
-LD_PRELOAD=liblttng-ust-fd.so ./my-app
+$ LD_PRELOAD=liblttng-ust-fd.so ./my-app
----
Typical use cases include closing all the file descriptors after
----
Typical use cases include closing all the file descriptors after
-gcc -o my-app my-app.o tp.o $(pkg-config --cflags --libs lttng-ust)
+$ gcc -o my-app my-app.o tp.o $(pkg-config --cflags --libs lttng-ust)
wget http://lttng.org/files/urcu/userspace-rcu-latest-0.9.tar.bz2 &&
tar -xf userspace-rcu-latest-0.9.tar.bz2 &&
cd userspace-rcu-0.9.* &&
wget http://lttng.org/files/urcu/userspace-rcu-latest-0.9.tar.bz2 &&
tar -xf userspace-rcu-latest-0.9.tar.bz2 &&
cd userspace-rcu-0.9.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.9.tar.bz2 &&
tar -xf lttng-ust-latest-2.9.tar.bz2 &&
cd lttng-ust-2.9.* &&
wget http://lttng.org/files/lttng-ust/lttng-ust-latest-2.9.tar.bz2 &&
tar -xf lttng-ust-latest-2.9.tar.bz2 &&
cd lttng-ust-2.9.* &&
-LDFLAGS='-L/usr/lib/i386-linux-gnu -L/usr/lib32'
+$ LDFLAGS='-L/usr/lib/i386-linux-gnu -L/usr/lib32'
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
wget http://lttng.org/files/lttng-tools/lttng-tools-latest-2.9.tar.bz2 &&
tar -xf lttng-tools-latest-2.9.tar.bz2 &&
cd lttng-tools-2.9.* &&
-gcc -m32 -c -I. hello-tp.c
-gcc -m32 -c hello.c
-gcc -m32 -o hello hello.o hello-tp.o \
+$ gcc -m32 -c -I. hello-tp.c
+$ gcc -m32 -c hello.c
+$ gcc -m32 -o hello hello.o hello-tp.o \
-L/usr/lib32 -L/usr/local/lib32 \
-Wl,-rpath,/usr/lib32,-rpath,/usr/local/lib32 \
-llttng-ust -ldl
-L/usr/lib32 -L/usr/local/lib32 \
-Wl,-rpath,/usr/lib32,-rpath,/usr/local/lib32 \
-llttng-ust -ldl
-gcc -o app app.c -llttng-ust
+$ gcc -o app app.c -llttng-ust
-lttng enable-event --userspace 'lttng_ust_tracef:*'
+$ lttng enable-event --userspace 'lttng_ust_tracef:*'
-gcc -o app app.c -llttng-ust
+$ gcc -o app app.c -llttng-ust
-lttng enable-event --userspace 'lttng_ust_tracelog:*'
+$ lttng enable-event --userspace 'lttng_ust_tracelog:*'
--loglevel=TRACE_WARNING
----
--
--loglevel=TRACE_WARNING
----
--
-lttng enable-event --userspace 'lttng_ust_tracelog:*'
+$ lttng enable-event --userspace 'lttng_ust_tracelog:*'
--loglevel-only=TRACE_INFO
----
--
--loglevel-only=TRACE_INFO
----
--
-LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
+$ LD_PRELOAD=liblttng-ust-libc-wrapper.so my-app
-LD_PRELOAD=liblttng-ust-libc-wrapper.so:liblttng-ust-dl.so my-app
+$ LD_PRELOAD=liblttng-ust-libc-wrapper.so:liblttng-ust-dl.so my-app
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
-lttng create
-lttng enable-event --jul jello
-lttng start
+$ lttng create
+$ lttng enable-event --jul jello
+$ lttng start
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
----
<<creating-destroying-tracing-sessions,Create a tracing session>>,
-lttng create
-lttng enable-event --log4j jello
-lttng start
+$ lttng create
+$ lttng enable-event --log4j jello
+$ lttng start
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-log4j.jar:$LOG4JPATH:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
+$ javac -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar Test.java
----
<<creating-destroying-tracing-sessions,Create a tracing session>>
----
<<creating-destroying-tracing-sessions,Create a tracing session>>
-lttng create
-lttng enable-event --jul jello
+$ lttng create
+$ lttng enable-event --jul jello
----
<<adding-context,Add the application-specific context fields>> to the
----
<<adding-context,Add the application-specific context fields>> to the
-lttng add-context --jul --type='$app.myRetriever:intCtx'
-lttng add-context --jul --type='$app.myRetriever:strContext'
+$ lttng add-context --jul --type='$app.myRetriever:intCtx'
+$ lttng add-context --jul --type='$app.myRetriever:strContext'
----
<<basic-tracing-session-control,Start tracing>>:
[role="term"]
----
----
<<basic-tracing-session-control,Start tracing>>:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
----
Run the compiled class:
[role="term"]
----
-java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
+$ java -cp /usr/share/java/jarpath/lttng-ust-agent-common.jar:/usr/share/java/jarpath/lttng-ust-agent-jul.jar:. Test
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
----
<<basic-tracing-session-control,Stop tracing>> and inspect the
+$ lttng stop
+$ lttng view
-lttng create
-lttng enable-event --python my-logger
-lttng start
+$ lttng create
+$ lttng enable-event --python my-logger
+$ lttng start
----
Run the Python script:
[role="term"]
----
----
Run the Python script:
[role="term"]
----
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
+$ lttng stop
+$ lttng view
-echo "Some message, some $variable" > /proc/lttng-logger
+$ echo "Some message, some $variable" > /proc/lttng-logger
----
Any event that the LTTng logger emits is named `lttng_logger` and
----
Any event that the LTTng logger emits is named `lttng_logger` and
-lttng create
-lttng enable-event --kernel lttng_logger
-lttng start
+$ lttng create
+$ lttng enable-event --kernel lttng_logger
+$ lttng start
----
Run the Bash script:
[role="term"]
----
----
Run the Bash script:
[role="term"]
----
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
----
<<basic-tracing-session-control,Stop tracing>> and inspect the recorded
+$ lttng stop
+$ lttng view
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.9.tar.bz2 &&
tar -xf lttng-modules-latest-2.9.tar.bz2 &&
cd lttng-modules-2.9.*
wget http://lttng.org/files/lttng-modules/lttng-modules-latest-2.9.tar.bz2 &&
tar -xf lttng-modules-latest-2.9.tar.bz2 &&
cd lttng-modules-2.9.*
-make KERNELDIR=/path/to/linux
-sudo make modules_install
+$ make KERNELDIR=/path/to/linux
+# make modules_install && depmod -a
-sudo lttng-sessiond --extra-kmod-probes=my_subsys,usb
+# lttng-sessiond --extra-kmod-probes=my_subsys,usb
-sudo lttng-sessiond --kmod-probes=my_subsys,usb
+# lttng-sessiond --kmod-probes=my_subsys,usb
-lsmod | grep lttng_probe_usb
+$ lsmod | grep lttng_probe_usb
-sudo pkill lttng-sessiond
-lttng-sessiond --daemonize
+$ lttng-sessiond --daemonize
-sudo lttng-sessiond --daemonize
+# lttng-sessiond --daemonize
+$ lttng create my-session
-lttng create my-session --output=/tmp/some-directory
+$ lttng create my-session --output=/tmp/some-directory
-lttng set-session new-session
+$ lttng set-session new-session
+$ lttng list --userspace
-lttng list --kernel --syscall
+$ lttng list --kernel --syscall
-lttng enable-event --kernel sched_switch
+$ lttng enable-event --kernel sched_switch
-lttng enable-event --kernel --syscall open,write,read,close
+$ lttng enable-event --kernel --syscall open,write,read,close
-lttng enable-event --kernel sched_switch --filter='prev_comm == "bash"'
+$ lttng enable-event --kernel sched_switch --filter='prev_comm == "bash"'
-lttng enable-event --kernel --all \
+$ lttng enable-event --kernel --all \
--filter='$ctx.tid == 1988 || $ctx.tid == 1534'
----
[role="term"]
----
--filter='$ctx.tid == 1988 || $ctx.tid == 1534'
----
[role="term"]
----
-lttng enable-event --jul my_logger \
+$ lttng enable-event --jul my_logger \
--filter='$app.retriever:cur_msg_id > 3'
----
--filter='$app.retriever:cur_msg_id > 3'
----
-lttng enable-event --userspace my_app:'*' --loglevel=TRACE_INFO
+$ lttng enable-event --userspace my_app:'*' --loglevel=TRACE_INFO
----
IMPORTANT: Make sure to always quote the wildcard character when you
----
IMPORTANT: Make sure to always quote the wildcard character when you
-lttng enable-event --python my-app.'*' \
+$ lttng enable-event --python my-app.'*' \
--exclude='my-app.module,my-app.hello'
----
====
--exclude='my-app.module,my-app.hello'
----
====
-lttng enable-event --log4j --all --loglevel-only=LOG4J_WARN
+$ lttng enable-event --log4j --all --loglevel-only=LOG4J_WARN
-lttng enable-event --userspace my_app:my_tracepoint --channel=my-channel
+$ lttng enable-event --userspace my_app:my_tracepoint --channel=my-channel
-lttng enable-event --userspace my_app:my_tracepoint
-lttng enable-event --userspace my_app:my_tracepoint \
+$ lttng enable-event --userspace my_app:my_tracepoint
+$ lttng enable-event --userspace my_app:my_tracepoint \
--loglevel=TRACE_INFO
----
--loglevel=TRACE_INFO
----
-lttng disable-event --python my-logger
+$ lttng disable-event --python my-logger
-lttng disable-event --jul '*'
+$ lttng disable-event --jul '*'
-lttng disable-event --jul --all-events
+$ lttng disable-event --jul --all-events
-lttng enable-channel --kernel my-channel
+$ lttng enable-channel --kernel my-channel
-lttng enable-channel --userspace --num-subbuf=4 --subbuf-size=1M \
+$ lttng enable-channel --userspace --num-subbuf=4 --subbuf-size=1M \
--buffers-pid my-channel
----
====
--buffers-pid my-channel
----
====
-lttng enable-channel --kernel --tracefile-count=8 \
+$ lttng enable-channel --kernel --tracefile-count=8 \
--tracefile-size=4194304 my-channel
----
====
--tracefile-size=4194304 my-channel
----
====
-lttng enable-channel --userspace --overwrite my-channel
+$ lttng enable-channel --userspace --overwrite my-channel
-lttng enable-event --userspace --channel=my-channel app:tp
-lttng enable-event --userspace --channel=other-channel app:tp
+$ lttng enable-event --userspace --channel=my-channel app:tp
+$ lttng enable-event --userspace --channel=other-channel app:tp
----
If both channels are enabled, when a tracepoint named `app:tp` is
----
If both channels are enabled, when a tracepoint named `app:tp` is
-lttng disable-channel --kernel my-channel
+$ lttng disable-channel --kernel my-channel
-lttng add-context --userspace --type=vpid --type=perf:thread:cpu-cycles
+$ lttng add-context --userspace --type=vpid --type=perf:thread:cpu-cycles
-lttng add-context --userspace --type=perf:thread:raw:r0110:test
-lttng add-context --kernel --type=perf:cpu:raw:r0013c:x86unhalted
+$ lttng add-context --userspace --type=perf:thread:raw:r0110:test
+$ lttng add-context --kernel --type=perf:cpu:raw:r0013c:x86unhalted
-lttng add-context --kernel --channel=my-channel --type=tid
+$ lttng add-context --kernel --channel=my-channel --type=tid
-lttng add-context --kernel --channel=my-channel \
+$ lttng add-context --kernel --channel=my-channel \
--type='$app:retriever:cur_msg_id'
----
--type='$app:retriever:cur_msg_id'
----
-lttng track --pid=3,4,7,10,13
+$ lttng track --pid=3,4,7,10,13
-lttng track --pid=1,15,16
+$ lttng track --pid=1,15,16
-lttng untrack --pid=3,7,10,13
+$ lttng untrack --pid=3,7,10,13
----
leads to this whitelist:
----
leads to this whitelist:
+$ lttng track --pid --all
----
The result is, again:
----
The result is, again:
-lttng untrack --pid --all
+$ lttng untrack --pid --all
+$ lttng track --pid=6,11
-lttng create my-session --set-url=net://remote-system
+$ lttng create my-session --set-url=net://remote-system
-lttng create my-session --live
+$ lttng create my-session --live
-babeltrace --input-format=lttng-live net://localhost/host/hostname/my-session
+$ babeltrace --input-format=lttng-live \
+ net://localhost/host/hostname/my-session
-babeltrace --input-format=lttng-live net://localhost
+$ babeltrace --input-format=lttng-live net://localhost
----
You can start the relay daemon on another system. In this case, you need
----
You can start the relay daemon on another system. In this case, you need
-lttng create my-session --snapshot
+$ lttng create my-session --snapshot
-lttng snapshot record --name=my-first-snapshot
+$ lttng snapshot record --name=my-first-snapshot
-lttng --mi=xml enable-event --kernel --syscall open
+$ lttng --mi=xml enable-event --kernel --syscall open
----
A schema definition (XSD) is
----
A schema definition (XSD) is
-lttng regenerate metadata
+$ lttng regenerate metadata
-lttng regenerate statedump
+$ lttng regenerate statedump
-lttng snapshot record --name=my-snapshot
+$ lttng snapshot record --name=my-snapshot
-lttng create my-session --shm-path=/path/to/shm
+$ lttng create my-session --shm-path=/path/to/shm
-lttng-crash /path/to/shm
+$ lttng-crash /path/to/shm
-lttng-crash --extract=/path/to/trace /path/to/shm
+$ lttng-crash --extract=/path/to/trace /path/to/shm
written in terminal boxes. A terminal box is an AsciiDoc literal
block with the `term` role.
+
written in terminal boxes. A terminal box is an AsciiDoc literal
block with the `term` role.
+
+Start a command line with "+${nbsp}+" to indicate that a regular Unix user
+should run it. Start a command line with "+#{nbsp}+" to indicate that a
+priviledged Unix user should run it.
++
.Using a terminal box.
====
[listing]
....
[role="term"]
----
.Using a terminal box.
====
[listing]
....
[role="term"]
----
-lttng create my-session
-lttng enable-event --kernel --all
+$ lttng create my-session
+$ lttng enable-event --kernel --all
-echo This is a terminal box
+$ echo Command line as a regular user
+# echo Command line as a priviledged user
-Typical command prompts, like `$` and `#`, are not shown in terminal
-boxes to make copy operations easier, especially for multiline commands
-which you can copy and paste as is to your terminal. Command lines
-which you need to execute as a root user start with cmd:sudo.
+Command lines which you need to execute as a priviledged user start with
+the `#` prompt or with `sudo`. Other command lines start with the `$`
+prompt.
+$ gcc -I. -fpic -c tpp.c
+$ gcc -I. -fpic -c tpp.c
-gcc -shared -o libtpp.so tpp.o -llttng-ust -ldl
+$ gcc -shared -o libtpp.so tpp.o -llttng-ust -ldl