Linux Kernel Benchmark

# install apps
apt-get update -qq
apt-get install -y gcc make libc6-dev bzip2 bc --no-install-recommends
 
# download kernel
cd /dev/shm
#wget -q ftp://ftp.hosteurope.de/mirror/ftp.kernel.org/pub/linux/kernel/v3.0/linux-3.4.tar.bz2
wget ftp://ftp.hosteurope.de/mirror/ftp.kernel.org/pub/linux/kernel/v3.0/linux-3.9.tar.bz2
 
# view cpu name
echo CPU: $(cat /proc/cpuinfo  | grep "model name" | head -1 | cut -d":" -f2)
echo Cores: $(cat /proc/cpuinfo | grep processor | wc -l)
 
# extract
time tar -xjf linux-3.*.tar.bz2
 
# optional
mount -o remount,size=2G /run/shm/
mount -o remount,exec /dev/shm
 
# configure kernel
cd linux-3.*
make defconfig
 
# compile on 1 cpu
time make
 
cd ..
rm -r ./linux-3.*/
tar -xjf linux-3.*.tar.bz2
cd linux-3.*
make defconfig
 
# compile on all cups
time make -j$(cat /proc/cpuinfo | grep processor | wc -l)
 
# Links
http://linux.die.net/man/1/kcbench