Sep
2
Sometimes there is need for the software analyzers to benchmark the software operation on different hardware platforms. Software benchmarking is especially useful when analysis of software execution on grid platforms is performed. The level of diversity of the grid resources can be considerably influential on the execution time and overall efficiency of the grid application.
By default, the Linux kernels do not perform counting on many events associated with application execution (L2 cache misses, FLOPS counting etc.). Therefore, in order to be able to do application benchmarking, a special patch must be implemented in a fresh kernel source. Additionally, after the kernel source is patched, it must be recompiled and activated.
I will explain the process of installing kernel patch (perfctr) on a OpenSuse 10.0 OS with kernel version 2.6.16.21-0.8.
Patching the kernel
There are several performance measurement tools available on the Internet. One of the most popular is a tool called perfctr. It is available for downloading at: http://user.it.uu.se/~mikpe/linux/perfctr/.
Different versions of the perfctr tool support different kernel versions. To obtain your kernel version, you need to type:
$ uname –a
The output is information about your operating system as well as the kernel version.
Additionally, you will need the kernel source installed. Usually, it resides in /usr/src directory of your Linux distribution. If not, then you need it to install as a package with the appropriate package manager.
A good approach to see which perfctr version supports your kernel is by first looking at the ANNOUNCE files published by the perfctr team. After you find the version which is useful to you, you should unpack the downloaded file:
$ tar –xvf perfctr-2.6.26.tar.gz
Please take note that this version is suitable for the already mentioned kernel version.
The first thing is to look at the patches subdirectory and the alias file (in the patches directory) for your kernel version. If you can find a file with the appropriate version, you can continue installing it:
You must first change your current directory to the kernel source directory:
$ cd /usr/src/kernel-dir/
First, the source directory must be cleared from any old compilations:
$make mrproper
Then, you activate the update-kernel script from the unpacked perfctr directory:
$ /home/user/perfctr/update-kernel
If your kernel is supported everything should go smoothly. However, please take note that your kernel version can be unsupported, but other patch can work effectively. Interestingly enough, I never found appropriate patch for my 2.6.16.21-0.8 kernel, so I decided to use 2.6.16.21_SLES10_GA_BRANCH_SUSE patch available. Therefore, forcing of unsupported patch must be made:
$/home/user/perfctrl/update-kernel –patch=kernel 2.6.16.21_SLES10_GA_BRANCH_SUSE
After the patch is made, it is useful to modify the official kernel version string with something more identifying for the newly patched version. Open the Makefile located in the kernel source and modify the EXTRAVERSION parameter. Adding –perfctr or -perfctrPatched is a good idea. However, be careful that you do NOT insert spaces between the official version string and your addition. If you do, the installation of the modules will fail.
Afterwards, installation of the modules follows:
$make dep vmlinux modules
Installation of the newly created modules into the system:
$make modules_install
Creating the kernel image and initrd:
$make
And finally, placing the image and initrd in the /boot directory:
$make install
Take note that the last step reconfigures your system loader. However, reconsider checking the configuration file of the system loader. Since I have GRUB installed, I open the menu.lst file located in /boot/grub directory and check the latest added entry by the kernel installer. If everything is OK, restart the machine.
After the modified kernel is patched, you need to create a special device used by perfctr:
$mknod /dev/perfctr c 10 182
chmod 644 /dev/perfctr
Installation of the perfctr library is also performed by going to the perfctr directory and typing:
$make
$make PREFIX=/usr/local BINDIR=/bin install
Take note that prefix and bindir are required by the installer. They might change for different distributions (the presented ones are for OpenSuse).
You can check the installation and obtain some info with the perfex tool:
$perfex -i
by Aleksandar Milenkoski