I am trying to use TraceCompass in order to further investigate my system trace. For that purpose, you need CTF format and there are two possible ways to obtain it in Linux, afaik:
- Using LTTng for tracing and using CTF format from that
- Using 'perf data convert' in order to create CTF data from perf.data
I have been trying to use the second option as the first one requires installation of tracepoints and what I got from perf is simply enough for me. So assuming I have my perf.data available, Applying
perf data convert --to-ctf=./ctf
resulted in: No version support compiled in. Digging into the online resources from lwn, I have found out that this conversion is not available without babeltrace. In order to install babeltrace I have tried following methods:
1st one:
sudo apt-get install libbabeltrace-ctf-dev libbabeltrace-ctf1 libbabeltrace1 libbabeltrace-dev python3-babeltrace
which did not quite solve the problem of: No version support compiled in.
2nd one
I have tried building babeltrace from source. I dug and found all its dependencies beforehand:
sudo apt-get install dh-autoreconf bison libdw-dev libelf-dev flex uuid-dev libpopt-dev
git clone git://git.efficios.com/babeltrace.git
cd babeltrace
./bootstrap
sudo ./configure --prefix=/opt/libbabeltrace LDFLAGS=-L/usr/local/lib
sudo make -j4 prefix=/opt/libbabeltrace
sudo make install prefix=/opt/libbabeltrace
Then tried,
LD_LIBRARY_PATH=/opt/libbabeltrace/lib perf data convert --to-ctf=./ctf
Which also resulted in the error: No version support compiled in.
So, all in all, right now I think that the problem is linking babeltrace with perf. Though I do not know yet how to compile perf with babeltrace support. Should I build everything from kernel modules (given below) or is there a workaround to re-compile or adapt my current perf with babeltrace support?
Please note that perf/core_ctf_convert is implemented in this kernel module: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
Also note that I am using Raspbian Jessie on a Raspberry Pi 3.
Guidance is appreciated in advance.
Cheers,
References:
https://lwn.net/Articles/634333/
http://tracingsummit.org/w/images/9/98/TracingSummit2014-Perf-CTF.pdf
https://patchwork.kernel.org/patch/5883821/
https://patchwork.kernel.org/patch/5858601/
EDIT : RESOLVED Okay, this was tricky. First off, all credits go to jolsa from kernel.org who with his suggestions made me figure this out.
After the libbabeltrace is built from source, the following is done:
Some dependencies installed (some might not be needed, these are what I've installed to fulfil most of the tracing features available for Raspbian. Unfortunately bfd is not available, afaik)
sudo apt-get install libnewt-dev binutils-arm-none-eabi libcrypto++-dev libunwind-dev systemtap-sdt-dev libssl-dev libperl-dev libiberty-dev
Then,
sudo git clone git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
cd linux/tools/perf
sudo git checkout perf/core
sudo LIBBABELTRACE=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ make
sudo LIBBABELTRACE=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/ make install
After the installation is complete, the perf is executed with the LD_LIBRARY_PATH env. i.e.
From the directory where perf.data is located, call the following assuming the newly built perf is located at /home/user/linux/tools/perf:
sudo LD_LIBRARY_PATH=/opt/libbabeltrace/lib ./home/user/linux/tools/perf/perf data convert --to-ctf=./ctf
And then, the CTF could be imported to TraceCompass :)