Better_Software_Header_MobileBetter_Software_Header_Web

Find what you need - explore our website and developer resources

Full Stack Tracing Part 2

Environment setup

CONFIG_MODULES
CONFIG_KALLSYMS
CONFIG_HIGH_RES_TIMERS
CONFIG_TRACEPOINTS
CONFIG_HAVE_SYSCALL_TRACEPOINTS
CONFIG_EVENT_TRACING
CONFIG_KALLSYMS_ALL
$ make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-
$ apt-get install lttng-tools
$ apt-get install lttng-modules-dkms
$ apt-get install liblttng-ust-dev
EXTRA_IMAGE_FEATURES += "tools-profile"
$ ./configure -trace lttng
$ make
$ make install
#!/bin/sh
if [ ! -d "/tmp/lttng" ]; then
    mkdir "/tmp/lttng"
fi
lttng create -o "/tmp/lttng/$(date -Iseconds)"

# enable only the most important kernel tracepoints
lttng enable-channel kernel -k
kernel_events=(
    "sched_switch,sched_process_*" "lttng_statedump_*"
    "irq_*" "signal_*" "workqueue_*" "power_cpu_frequency"
    "kmem_"{mm_page,cache}_{alloc,free} "block_rq_"{issue,complete,requeue}
    # page fault tracing is sadly not yet available on embedded systems:
    # "x86_exceptions_page_fault_"{user,kernel}
)
for event in "${kernel_events[@]}"; do
    lttng enable-event -c kernel -k "$event"
done
lttng enable-event -c kernel -k --syscall -a

# enable all user space tracepoints
lttng enable-channel ust -u
lttng enable-event -c ust -u -a

# actually start tracing
lttng start
mount -t tmpfs -o size=128m tmpfs /tmp/lttng
lttng create -o "/tmp/lttng/$(date -Iseconds)"
#!/bin/sh
if [ ! -z "$1" ]; then
    # delay stopping
    sleep "$1"
fi
lttng stop
lttng destroy
[Unit]
Description=start lttng tracing
After=sysinit.target
Before=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/bin/lttng_start.sh
RemainAfterExit=true

[Install]
WantedBy=sysinit.target
[Unit]
Description=stop lttng tracing
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/bin/lttng_stop.sh 20

[Install]
WantedBy=multi-user.target
$ systemctl enable lttng_start.service
$ systemctl enable lttng_stop.service

About KDAB


MilianWolff

Milian Wolff

Senior Software Engineer

Learn Modern C++

Learn more