### kernbench is a simple average of five kernel compiles of the vmlinux binary
### image.
### 
### aim9 is a number of micro-benchmarks. The results of this are very sensitive
### to a number of factors but it can be useful early warning system. Results
### tend to be difficult if not impossible to bisect but can sometimes be
### correlated with degradations in other benchmarks.
### 
### vmr-stream is the STREAM memory benchmark and variations in it can be
### indicative of problems with cache coloring and usage.
### 
### pagealloc is a page allocator microbenchmark run via SystemTap. The page
### allocator is rarely a major component of a workloads time but it can
### be a source of slow degrataion of overall performance.
### 
### pft is a microbenchmark for page fault rates.
### 
### hackbench is usually used for scheduler comparisons but it can sometimes
### highlight problems in the page allocator as well.
###
### ebizzy is intended to simulate the backend of a database backend but it
### is not IO intensive. Instead it is both scheduler and allocator intensive.
### Regressions here can indicate a regression in either area.

DIRNAME=`dirname $0`
SCRIPTDIR=`cd "$DIRNAME" && pwd`
MEMTOTAL_BYTES=`free -b | grep Mem: | awk '{print $2}'`
NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)

# MM Test Parameters
export MMTESTS="kernbench aim9 vmr-stream pagealloc pft ebizzy"
export SKIP_WARMUP=yes

# Profiling parameters
export SKIP_NOPROFILE=no
export SKIP_FINEPROFILE=yes
export SKIP_COARSEPROFILE=yes
export OPROFILE_REPORT_ANNOTATE=no

# Fixups
if [ "`which check-confidence.pl 2> /dev/null`" = "" ]; then
	export PATH=$SCRIPTDIR/bin:$PATH
fi
if [ "`which record-extfrag 2> /dev/null`" = "" ]; then
	export PATH=$SCRIPTDIR/fraganalysis:$PATH
fi
if [ "`which oprofile_report.sh 2> /dev/null`" = "" ]; then
	export PATH=$SCRIPTDIR/vmr/bin:$PATH
fi

# Machine configuration
# Swap configuration can be one of default, partitions, swapfile, NFS
#export VM_DIRTY_RATIO=20
export VM_TRANSPARENT_HUGEPAGES_DEFAULT=default
export SWAP_CONFIGURATION=default
export SWAP_PARTITIONS=
export SWAP_SWAPFILE_SIZEMB=$((MEMTOTAL_BYTES/1048576))
export SWAP_NFS_MOUNT=192.168.10.7:/exports/`hostname`-swapfile
export SWAP_NBD_DEVICE=/dev/nbd0
export SWAP_NBD_HOST=mcp
export SWAP_NBD_PORT=10001
#export MEMCG_SIZE=$((MEMTOTAL_BYTES/2))

# Test disk to setup (optional)
#export TESTDISK_RAID_PARTITIONS="/dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1"
#export TESTDISK_RAID_DEVICE=/dev/md0
#export TESTDISK_RAID_OFFSET=63
#export TESTDISK_RAID_SIZE=250019532
#export TESTDISK_RAID_TYPE=raid0
#export TESTDISK_PARTITION=/dev/sda6
#export TESTDISK_FILESYSTEM=ext3
#export TESTDISK_MKFS_PARAM="-f -d agcount=8"
#export TESTDISK_MOUNT_ARGS=""
#
# Test NFS disk to setup (optional)
#export TESTDISK_NFS_MOUNT=192.168.10.7:/exports/`hostname`
#
# Test NBD disk to setup (optional)
#export TESTDISK_NBD_DEVICE=/dev/nbd0
#export TESTDISK_NBD_HOST=mcp
#export TESTDISK_NBD_PORT=100`ifconfig eth0 | sed -n 2p | cut -d ":" -f2 | cut -d " " -f1 | cut -d "." -f4`

# List of monitors
export RUN_MONITOR=yes
export MONITORS_ALWAYS=
export MONITORS_PLAIN=
export MONITORS_GZIP="proc-vmstat top slabinfo"
export MONITORS_WITH_LATENCY="vmstat iostat"
export MONITOR_UPDATE_FREQUENCY=10

# EBizzy
export EBIZZY_MAX_THREADS=$((NUM_CPU*4))
export EBIZZY_DURATION=30
export EBIZZY_ITERATIONS=5

# Page allocator microbench
export PAGEALLOC_GFPFLAGS=GFP_KERNEL
export PAGEALLOC_ORDER_MIN=0
export PAGEALLOC_ORDER_MAX=4

# Page Fault Test (PFT)
export PFT_ITERATIONS=20
export PFT_MAPPING_SIZE=$((MEMTOTAL_BYTES/5))
export PFT_MAX_CLIENTS=$NUM_CPU
export PFT_USE_PROCESSES=yes
export PFT_PAGESIZES=base

# STREAM
export STREAM_BACKING_TYPE=static
export STREAM_PAGESIZES="default"
#export STREAM_PAGESIZES="base huge dynhuge"
