### dbt5 is an OLTP workload simulating a brokerage firm. It is a fair usage
### implementation of TPC's TPC-E Benchmark. More information on TPC-E can be
### found on http://www.tpc.org/tpce/default.asp . As noted on that page,
### the benchmark is scalable but this is not scaled to the size of the
### machine. Instead the number of customers, trade days and scale factors
### are fixed as 5000, 50 and 500 respectively. In this benchmark, the number
### of users is varied so measure how well it handles load for increasing
### numbers of clients. Further information on the benchmark itself can be
### read from the paper "DBT-5: A Fair Usage Open-Source TPC-E Implementation
### for Performance Evaluation of Computer Systems".
###
### Note that the benchmark is patched relative to upstream to support a recent
### version of postgres but it should be functionally equivalent.
DIRNAME=`dirname $0`
SCRIPTDIR=`cd "$DIRNAME" && pwd`

# MM Test Parameters
export MMTESTS="dbt5-install dbt5-bench"
export RUN_WARMUP=

# Profiling parameters
export RUN_NOPROFILE=yes
export RUN_FINEPROFILE=no
export RUN_COARSEPROFILE=no
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 RUN_TUNINGS="$RUN_TUNINGS sysctl"
#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_DEVICES=
#export TESTDISK_RAID_MD_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 iotop"
export MONITORS_WITH_LATENCY="vmstat iostat"
export MONITOR_PERF_EVENTS=cpu-migrations,context-switches
export MONITOR_UPDATE_FREQUENCY=10

# dbt5
export OLTP_CACHESIZE=$(($MEMTOTAL_BYTES/2))
export OLTP_SHAREDBUFFERS=$((MEMTOTAL_BYTES/5))
export DBT5_DRIVER=postgres
export DBT5_NR_CUSTOMERS=5000
export DBT5_NR_TRADE_DAYS=300
export DBT5_SCALE_FACTOR=500
export DBT5_DURATION=1200
export DBT5_MIN_USERS=1
export DBT5_MAX_USERS=$((NUMCPUS))
export DBT5_USER_SCALE=1
export DBT5_PACING_DELAY=0
