Skip to content

Function Profiler based on Serial Log Output for Genode

License

Notifications You must be signed in to change notification settings

fischejo/genode-Profiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Function Profiler based on Serial Log Output for Genode

Screenshot

OS Requirements

Pythons matplotlib is required.

sudo apt-get install python3-pip
sudo pip3 install matplotlib

Application Integration

  1. Add following libraries to your application:

    LIBS += profiler
  2. Include <util/profiler.h> in your Application

  3. Create a Timer Session and initialize the profiler:

    Timer::Connection timer;
    PROFILER_INIT(&timer);
    
  4. Every function, which should be profiled requires the macro PROFILE_FUNCTION(color) at the beginning. The attribute color is a string like blue.

  5. 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.

  6. (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 under var/run/.../.

Genode Integration

  1. Clone this repository to to genode/repos/

  2. Add this repository to the variable REPOSITORIES in build.conf.

    REPOSITORIES += $(GENODE_DIR)/repos/genode-Profiler
    

Usage with real Hardware

  1. Log Serial Console of Genode Bootup
sudo screen -L -Logfile zybo.log /dev/ttyUSB1 115200
  1. Extract profiler data from log file
./profiler-filter zybo.log zybo.profile
  1. View plot of stat file
./profiler-plot --show --input zybo.profile
  1. Export plot to .svg, .png and .pdf
./profiler-plot -i zybo.profile -o zybo.svg -o zybo.png -o zybo.pdf

Further documentation

Further documentation is in directory doc.

Further Links

About

Function Profiler based on Serial Log Output for Genode

Resources

License

Stars

Watchers

Forks

Packages

No packages published