Pythons matplotlib
is required.
sudo apt-get install python3-pip
sudo pip3 install matplotlib
-
Add following libraries to your application:
LIBS += profiler
-
Include
<util/profiler.h>
in your Application -
Create a Timer Session and initialize the profiler:
Timer::Connection timer; PROFILER_INIT(&timer);
-
Every function, which should be profiled requires the macro
PROFILE_FUNCTION(color)
at the beginning. The attributecolor
is a string likeblue
. -
In order to profile a code area, put this code in a seperate Scope and include
PROFILE_SCOPE(name, color)
in the beginning of the scope. The variable name is a string and represents the measurement in the plot. Example:{ PROFILE_SCOPE("simple-print", "yellow") Genode::log("Hello World") }
Take care, that the scope is closed again, before Genode is informed about the end of the virtualization. Otherwise, the VM is terminated, before the profile information are printed to stdout.
-
(Optional) If you want to use automatic logging, filtering and plotting of your profiling data whenever your application runs in Qemu, source
profiler.inc
.source ${genode_dir}/repos/genode-Profiler/run/profiler.inc
After running the run file, a GUI with the plot graph opens. You can disable this behaviour with
set show_plot false
. The plot is automatically exported as.svg
,.png
,.pdf
. All files are in your build directory undervar/run/.../
.
-
Clone this repository to to
genode/repos/
-
Add this repository to the variable REPOSITORIES in
build.conf
.REPOSITORIES += $(GENODE_DIR)/repos/genode-Profiler
- Log Serial Console of Genode Bootup
sudo screen -L -Logfile zybo.log /dev/ttyUSB1 115200
- Extract profiler data from log file
./profiler-filter zybo.log zybo.profile
- View plot of stat file
./profiler-plot --show --input zybo.profile
- Export plot to .svg, .png and .pdf
./profiler-plot -i zybo.profile -o zybo.svg -o zybo.png -o zybo.pdf
Further documentation is in directory doc
.