How to write a Kernel

From BenchIT-Wiki

Jump to: navigation, search

Contents

kernel tree view

The prefered way to add new kernels to BenchIT is the GUI. In the kernel view you'll see a top-level folder called utilities.

Image:01-kernel-top-level.png


skeletons

In there is a folder named skeleton which in turn reveales folder for different programming languages like C, java, perl ruby and others. We will use the C-skeleton in here - the simple version is a cleaner version which does not use all of BenchIT's features but may be sufficient for most beginners. Nonetheless the normal version is used here.

Image:02-kernel-simple.png


duplicate

With the right mouse-click onto the name (the 0 in our case) you get a menu were you select duplicate to create a copy of the skeleton where you can incorporate your code.

Image:03-menu.png


kernelname

in the next window you can give your kernel a name which defines his place in the kernel tree. Each part of the name describes a certain property, so choose wisely.

Image:04-kernelname.png


new kernel

The name you selected in the previous window now determines which path you have to take through the folder structure to find your new kernel.

Image:05-path-to-ner-kernel.png


files of the kernel

On top of the right part of the GUI you see the full name of your kernel and beneath that is a tab for each file your kernel includes:

PARAMETERS

The PARAMETERS file holds all values which should be adjustable by a normal user while measuring. You may want to change this file later when you are sure how to call your variables in your source-code. At first it is a good choice to work with the variables provided by the skeleton as all the work needed to get those values from the environment into your c-code has already been done by the BenchIT team.

work.c

Lets switch over to the work.c file. In there you will find only 2 empty functions where you should place the code/function/programm you want to do the measurements for - in this case the function doing the copying as we are writing a copy-kernel.

Image:06-work-c.png


kernel_main.c

the kernel_main.c includes the functions provided by the benchit.c or interface.h which have to be filled with the apropriate data by you. Those data contain the name of your kernel, x-axis-labels and much much more. To ease filling out everything whats nessessary we added many comments in the code which i'd like to refer you to to keep this How to as short as possible.

Image:07-kernel-main-c.png


to be continued and extended

Personal tools