OLDLOGDIR=/autobench/logs/ RUNFILE=/autobench/var/run/running AB_EXIT_DAT_EXIT_NORMAL=89 idle_loop_counter=14 RUN_UNSTABLE_AUTOBENCH=1 oprofile_opts=CALLGRAPH=5 new_parm=resultsdir WORK_QUEUE_PATH=/projects/l/ltcperformance/tools/autobench/workqueues AUTOBENCH_ID=ltcperf HOSTNAME=btrfs1.austin.ibm.com scriptmode=0 AB_EXIT_DATFILE=88 DATS_IMAGEDRIVE_FORCE_REBOOT=no DATS_FREE_DISKS=/dev/vg1/lv1 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi DATFILE=/autobench/run//autobench.dat host=btrfs1 my_hostname=btrfs1 loop_count=2 SHELL=/bin/bash TERM=screen cmdstr_nospc=runlarge_file_creates__threads_0001ffsb$profiles/large_file_creates.ffsbnum_threads=1 ONLY_CMD= HISTSIZE=1000 mnt_point=/mnt/ffsb1 HIST_DIR=2009-09-17-17.02.29 INOTIFY_RC=0 TMPDIR=/autobench/var/tmp/ DEFAULT_PROFILERS=sar 5|iostat 5|mpstat 5 KDE_NO_IPV6=1 MYIP=9.3.233.83 DATS_CONFIG_DEDICATED=yes DATS_SCREEN_ENABLED=1 STATUSFILE=/autobench/var/run/status COGITO_REPO=http://hks.austin.ibm.com/scm/xenperf/xenperf-autobench.git QTDIR=/usr/lib64/qt-3.3 QTINC=/usr/lib64/qt-3.3/include profiler_field= TIME_CMD=/usr/bin/time new_value=benchmarks/results/btrfs/ffsb/btrfs1/2009-09-17_1716/btrfsexp-9-16-async oldstr=run large_file_creates__threads_0001 ffsb $profiles/large_file_creates.ffsb num_threads=1 SSH_OPTIONS=-o IdentityFile=/autobench/ssh/autobench-id -o StrictHostKeyChecking=no AUTO_CONFIG_BOOTABLE=yes DATS_MAINT_PARTITION= USER=root ip_list=9.3.233.83 127.0.0.1 NONTESTLOGDIR=/autobench/logs LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: new_export=export resultsdir="benchmarks/results/btrfs/ffsb/btrfs1/2009-09-17_1716/btrfsexp-9-16-async" tmp=resultsdir $results_basedir/$host/$today/$fs$desc MACHINE_OWNER_MAIL= LOGDIR_SCRIPT=/autobench/var/logdir TMP_AUTODIR=/autobench/scripts RC=0 count=1 DATS_IMAGEHOME=http://hks.austin.ibm.com/images profiles=http://hks.austin.ibm.com/users/corry/btrfs/ffsb/profiles/btrfs1 STATUS=running AB_NOEXIT_ERROR=85 TERMCAP=SC|screen|VT 100/ANSI X3.64 virtual terminal:\ :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\ :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\ :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\ :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\ :li#24:co#80:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\ :cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\ :im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\ :ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\ :ti=\E[?1049h:te=\E[?1049l:k0=\E[10~:k1=\EOP:k2=\EOQ:\ :k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ :k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ :kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:kN=\E[6~:kP=\E[5~:\ :kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD: resultsdir=benchmarks/results/btrfs/ffsb/btrfs1/2009-09-17_1716/btrfsexp-9-16-async results_basedir=benchmarks/results/btrfs/ffsb TIME_SYNC_SERVER=ausgsa.ibm.com KDEDIR=/usr RUN_SUFFIX=.001 mnt_opts= DATS_CONFIG_LOAN=yes WORK_QUEUE_HOST=ausgsa.austin.ibm.com cmdstr=run large_file_creates__threads_0001 ffsb $profiles/large_file_creates.ffsb num_threads=1 PATH=/autobench/run/:/autobench/scripts/user:/autobench/scripts:/autobench/scripts/benchmarks:/autobench/scripts/benchmarks/tools:/autobench/scripts/benchmarks/install:/autobench/scripts/profilers:/autobench/scripts/profilers/tools:/autobench/utilities:/usr/linux/bin:/autobench/run/:/autobench/scripts/user:/autobench/scripts:/autobench/scripts/benchmarks:/autobench/scripts/benchmarks/tools:/autobench/scripts/benchmarks/install:/autobench/scripts/profilers:/autobench/scripts/profilers/tools:/autobench/utilities:/usr/linux/bin:/autobench/run/:/autobench/scripts/user:/autobench/scripts:/autobench/scripts/benchmarks:/autobench/scripts/benchmarks/tools:/autobench/scripts/benchmarks/install:/autobench/scripts/profilers:/autobench/scripts/profilers/tools:/autobench/utilities:/usr/linux/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/sbin:/usr/sbin:/sbin MAIL=/var/spool/mail/root USE_WORK_QUEUES=0 STY=8857.autobench SYNC_TIME=1 cmdstr_expand=run large_file_creates__threads_0001 ffsb $profiles/large_file_creates.ffsb num_threads=1 fs=btrfs AUTOBENCH_INSTANCE_NAME=autobench PWD=/autobench/scripts INPUTRC=/etc/inputrc AUTODIR=/autobench WORLD_IFACE=eth0 DATS_FREE_PARTITIONS= KDE_IS_PRELINKED=1 LANG=en_US.UTF-8 DATS_MAINT_LABEL= SOURCES_REPO=http://hks.austin.ibm.com/autobench/sources datfile=btrfs-raid-btrfs-only.dat AB_EXIT_ERROR=86 i=127.0.0.1 RUN_NUMBER=001 SC=/proc/sys/kernel/sched_domain/cpu9 mkfs_opts= desc=exp-9-16-async MSG=Running command ffsb SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass RUNLOG_SCRIPT=/autobench/var/runlog counter=4 MYIP_LIST=9.3.233.83 127.0.0.1 LOGFILE=/autobench/logs/logfile RUNDIR=/autobench/run/ SD=/proc/sys/kernel/sched_domain/cpu9/domain1 HOME=/root SHLVL=4 device=/dev/ffsbdev1 localqueue=/autobench/var/localqueue ANON_ID=anonymous nopass SF=/proc/sys/kernel/sched_domain/cpu9/domain1/wake_idx DATS_SCRATCH_PARTITION= LOGDIR=/autobench/logs/ffsb.large_file_creates__threads_0001.09-09-17_19.35.05 LOGNAME=root CVS_RSH=ssh QTLIB=/usr/lib64/qt-3.3/lib WINDOW=0 MANAGEDFILE=/autobench/var/run/managed AIX= UPDATE_ON_STARTUP=0 LESSOPEN=|/usr/bin/lesspipe.sh %s cmd=run INOTIFY_BIN=/autobench/sources/inotify-tools/dist/bin/inotifywait x=8875 SERVER_REPO=http://hks.austin.ibm.com/autobench/current AUTORUN_NAME=autorun AB_EXIT_NORMAL=87 DATS_SCRATCH_LABEL= today=2009-09-17_1716 ONLY_ARCH_CMD= STAMP=20090917-19:35:05.251886717 current_repo_level=6f3ad733e287d501d7ba31efff0d37cc12f92edc cmdstr_log=run large_file_creates__threads_0001 ffsb $profiles/large_file_creates.ffsb num_threads=1 G_BROKEN_FILENAMES=1 AUTOBENCH_INSTANCE_ID=0 get_instance_name=() { instance=$1; echo "`echo $instance | sed -e 's/.*::\(.*\)/\1/'`" } init_useprofiler=() { if [ -f $AUTODIR/scripts/profilers/$1 ]; then log "init_useprofiler : Adding default profiler [$1]"; useprofiler $@; else log "init_useprofiler : Invalid default profiler [$1] specified"; fi } get_kernel=() { local DESTDIR=$1; local LOCAL_CACHE="$AUTODIR/var/cache/kernels"; case $2 in stock) local SERVER_CACHE="$SERVER_REPO/var/cache/kernels"; local SOURCES=""; SOURCES="$SOURCES $KERNEL_ORG_MIRROR"; SOURCES="$SOURCES ftp://kernel.org/pub/linux/kernel"; local VER=$3; local KERN_FILE=`kernelexpand -r $VER | cut -f1 -d' '`; echo "Base kernel is: $KERN_FILE"; local KERN_BASE=`basename $KERN_FILE`; local PATCH_FILE=`kernelexpand -p -r $VER`; get_with_cache $KERN_FILE; KERN_FILE="$LOCAL_CACHE/$KERN_BASE"; if [ "$PATCH_FILE" != "" ]; then get_with_cache $PATCH_FILE; PATCH_FILE="$LOCAL_CACHE/`basename $PATCH_FILE`"; fi ;; cvs) CVS_URL=$3; mkdir -p $DESTDIR; pushd $DESTDIR > /dev/null; echo fetching kernel source from cvs; echo only displaying Makefile updates...; cvs -z9 -q -d $CVS_URL checkout ${@:5} $4 | grep Makefile; check_status "Get kernel from $3 $4 ${@:5}"; mv $4/* $DESTDIR/; rmdir $4; popd > /dev/null ;; bk) bk clone $3 ${@:4} $DESTDIR; check_status "Get kernel from $3 ${@:4}"; pushd $DESTDIR 2> /dev/null; bk -r get; popd 2> /dev/null ;; git) shift; shift; GITREPO=$1; shift; while [ $# -gt 0 ]; do case "$1" in '-t') GITTAG=$2; shift ;; '-b') GITBRANCH=$2; shift ;; esac; shift; done; REPODIR=$(basename $GITREPO); REPODIR=${REPODIR%.git}; if [ ! -e "$LOCAL_CACHE/$REPODIR" ]; then mkdir -p $LOCAL_CACHE; pushd $LOCAL_CACHE > /dev/null; log "Cloning kernel tree from $GITREPO"; git clone $GITREPO; popd > /dev/null; else pushd $LOCAL_CACHE/$REPODIR > /dev/null; if [ "$GITREPO" == $( git remote show origin | grep URL | awk '{ print $2 }' ) ]; then log "Found kernel GIT tree in cache, updating $GITREPO"; git pull; else popd > /dev/null; pushd $LOCAL_CACHE > /dev/null; log "GIT repo found in cache, but does not match branch we are after, refreshing $GITREPO"; rm -rf $REPODIR; git clone $GITREPO; popd > /dev/null; fi; popd > /dev/null; fi; log "Creating working copy for kernel build"; cp -a $LOCAL_CACHE/$REPODIR $DESTDIR; pushd $DESTDIR > /dev/null; if [ -n "$GITBRANCH" ]; then log "Setting branch to $GITBRANCH"; git checkout -b $GITBRANCH origin/${GITBRANCH}; fi; if [ -n "$GITTAG" ]; then log "Setting tag to $GITTAG"; git checkout $GITTAG; fi; git branch -a; git remote show origin; git status; popd > /dev/null ;; url) pushd $TMPDIR > /dev/null; log "getting kernel from $3"; wget --quiet "$3"; check_status "Get kernel from $3"; popd > /dev/null; local KERN_FILE="$TMPDIR/`basename $3`"; local REMOVE_KERN_FILE="yes" ;; file) local KERN_FILE="$3" ;; dir) cp -r $3 $DESTDIR ;; *) echo unknown argument: $2; false; check_status "Second arg must be one of: stock, cvs, bk, url, file, or dir" ;; esac; if [ -n "$KERN_FILE" ]; then case $KERN_FILE in *.tar) echo 'uncompressed tar'; local zipflag="" ;; *.tgz | *.gz) echo 'gzipped kernel image'; local zipflag="z" ;; *.bz2) echo 'bzipped kernel image'; local zipflag="j" ;; *.rpm) echo 'rpm kernel image'; local zipflag="r" ;; *) false; check_status "Unknown kernel format! ($KERN_FILE) Aborting !!"; exit 1 ;; esac; pushd $TMPDIR > /dev/null; if [ "$zipflag" == "r" ]; then rpm -i $KERN_FILE --nodeps --force > /dev/null 2>&1; if [ -d /usr/src/redhat ]; then buildpath=/usr/src/redhat; else buildpath=/usr/src/packages; fi; pushd $buildpath > /dev/null; if [ -d BUILD ]; then pushd BUILD > /dev/null; rm -rf kernel-*; popd > /dev/null; else mkdir -p BUILD; fi; if [ -d SPECS ]; then pushd SPECS > /dev/null; echo Prepping kernel source using rpmbuild; rpmbuild -bp ./kernel-2.6.spec > /dev/null 2>&1; popd > /dev/null; pushd BUILD > /dev/null; pushd kernel-* > /dev/null; pushd linux-* > /dev/null; local KERNDIR=`pwd`; popd > /dev/null; popd > /dev/null; popd > /dev/null; else log "Could not find SPECS directory in $buildpath"; exit 1; fi; popd > /dev/null; else local KERNDIR=`tar -t${zipflag}f $KERN_FILE | grep "/" | head -n1`; rm -rf $KERNDIR; tar -x${zipflag}f $KERN_FILE; fi; check_status "Unpacking kernel."; if [ "$PATCH_FILE" != "" ]; then pushd $KERNDIR > /dev/null; case $PATCH_FILE in *bz2) bzip2 -cd $PATCH_FILE | patch -p1 -l -f > /dev/null ;; *gz) gzip -cd $PATCH_FILE | patch -p1 -l -f > /dev/null ;; *) patch -f -p1 -l -i $PATCH_FILE > /dev/null ;; esac; check_status "Applying maintainer patch."; popd > /dev/null; fi; rm -rf $DESTDIR; mv $KERNDIR $DESTDIR; popd > /dev/null; if [ -n "$REMOVE_KERN_FILE" ]; then rm -rf $KERN_FILE; fi; fi } fs_type=() { local WORK_DIR=$1; local LOG_FILE=$2; local DEVICE_LOG_FILE=$3; local FS_TYPE ROOT_TYPE; WORK_DIR=`echo $WORK_DIR | sed -r -e "s:(.+)/$:\1:"`; FS_TYPE=`mount | grep "[[:space:]]$WORK_DIR[[:space:]]" | cut -f5 -d" "`; if [ ${WORK_DIR:0:1} == '/' ]; then if [ -z "$FS_TYPE" ]; then if [ -d $WORK_DIR ]; then log "WARNING: $WORK_DIR is not an isolated partition"; fi; ROOT_TYPE=`mount | grep "[[:space:]]/[[:space:]]" | cut -f5 -d" "`; while [ -n "$WORK_DIR" ]; do FS_TYPE=`mount | grep "[[:space:]]$WORK_DIR[[:space:]]" | cut -f5 -d" "`; if [ -n "$FS_TYPE" ]; then break; fi; FS_TYPE=$ROOT_TYPE; WORK_DIR=`echo $WORK_DIR | sed -e "s:/[^/]*$::"`; done; fi; if [ -z "$WORK_DIR" ]; then WORK_DIR="/"; fi; WORK_DEV=`mount | grep "[[:space:]]$WORK_DIR[[:space:]]" | cut -f1 -d" "`; else log "WARNING: $WORKDIR is not an absolute path, can not determine fs type"; FS_TYPE=UNKNOWN; fi; echo Filesystem type for $1 is $FS_TYPE; if [ -n "$LOG_FILE" ]; then echo $FS_TYPE > $LOG_FILE; fi; if [ -n "$DEVICE_LOG_FILE" ]; then echo "Device for $1 is $WORK_DEV"; if [ "$DEVICE_LOG_FILE" == "$LOG_FILE" ]; then echo $WORK_DEV >> $DEVICE_LOG_FILE; else echo $WORK_DEV > $DEVICE_LOG_FILE; fi; fi } get_numa_meminfo=() { out_dir=$1; if [ ! -d "$out_dir" ]; then log "get_numa_meminfo : directory argument required"; exit 1; else pushd $out_dir > /dev/null; out_dir=`pwd`; popd > /dev/null; fi; if [ ! -d "/sys/devices/system/node" ]; then log "get_numa_meminfo : numa not supported"; exit 1; else pushd /sys/devices/system/node > /dev/null; for node in `ls -1d node*`; do cp $node/meminfo $out_dir/$node; done; popd > /dev/null; fi } hostpath=() { echo ${1%%/*} } normal_exit=() { log "Normal exit from autorun, probably reboot"; echo "exit" > $STATUSFILE; exit $AB_EXIT_NORMAL } get_instance_autodir=() { instance=$1; echo "`echo $instance | sed -e 's/.*://'`" } export_cfg=() { if [ -e $RUNDIR/autobench.cfg ]; then . $RUNDIR/autobench.cfg; fi } scriptmode_setup=() { local cmdstr=$1; if [ "${cmdstr:0:10}" == "scriptmode" ]; then scriptmode=$((${scriptmode:=0}^1)); if [ $scriptmode -eq 1 ]; then if [ "${cmdstr#*[^ ] [^ ]}" != "$cmdstr" ]; then scriptname=${cmdstr##* }; scriptname=`eval echo $scriptname`; if [ -e $scriptname ]; then rm $scriptname; fi; touch $scriptname; chmod 775 $scriptname; tmpfiles="$tmpfiles $scriptname"; fi; fi; log "processing command: $cmdstr"; return 1; fi; if [ ${scriptmode:=0} -eq 1 ]; then echo $cmdstr >> $scriptname; echo "--> $cmdstr"; return 1; fi; return 0 } ftp_mkdir=() { do_sftp $1 "mkdir $2 \n chmod 2777 $2" } is_file_size=() { local filename=$1; local compare_op=$2; local compare_size=$3; local multiple; local file_size; if [ -z "$compare_size" ]; then return 2; fi; case "$compare_op" in "-eq" | "-ne" | "-gt" | "-ge" | "-lt" | "-le") ;; *) return 3 ;; esac; compare_size=$(echo $compare_size | sed -n -r -e 's/^([[:digit:]]+)[[:space:]]*([YyZzEePpTtGgMmKk]?)[bB]*$/\1 \2/p'); if [ -z "$compare_size" ]; then return 4; fi; compare_suffix=$(echo $compare_size | awk '{ print $2 }'); compare_size=$(echo $compare_size | awk '{ print $1 }'); case "$compare_suffix" in "Y" | "y") multiple=$(( 1 << 80 )) ;; "Z" | "z") multiple=$(( 1 << 70 )) ;; "E" | "e") multiple=$(( 1 << 60 )) ;; "P" | "p") multiple=$(( 1 << 50 )) ;; "T" | "t") multiple=$(( 1 << 40 )) ;; "G" | "g") multiple=$(( 1 << 30 )) ;; "M" | "m") multiple=$(( 1 << 20 )) ;; "K" | "k") multiple=$(( 1 << 10 )) ;; *) multiple=$(( 1 << 0 )) ;; esac; compare_size=$((compare_size * multiple)); file_size=$(stat -c %s $filename); test $file_size $compare_op $compare_size } ftp_mkdir_recurse=() { if [ $# -lt 3 ]; then return 1; fi; cmd="cd upload_root \n pwd"; parentdir=$2; for subdir in ${@:3}; do cmd="$cmd \n cd $parentdir \n pwd \n mkdir $subdir \n chmod 2777 $subdir"; parentdir=$subdir; done; do_sftp $1 "$cmd" 2>&1 | grep -v "sftp>" } do_sftp=() { host=$1; shift; echo -e "$@" | sftp $SSH_OPTIONS ${AUTOBENCH_ID}@${host} } screen_msg=() { if [ "$DATS_SCREEN_ENABLED" -eq 1 -a $AUTOBENCH_INSTANCE_ID -eq 0 ]; then MSG=$(string_parser "$1"); screen -X hardstatus alwayslastline "$MSG"; fi } check_status=() { let rc=$?; STAMP=`date +%x-%T`; if [ $rc != 0 ]; then echo $STAMP $1 "Failed rc = $rc" | tee -a $LOGFILE; exit $AB_EXIT_NORMAL; else echo $STAMP $1 "Succeeded" | tee -a $LOGFILE; fi } get_file_retry=() { if [ $# -lt 2 ]; then echo "You must specify two arguments to get_file_as"; exit 1; fi; if [ -e "$1" ]; then log "get_file_as():" target $1 already exists, removing; rm -f $1; fi; OUTFILE=$1; for loopcount in 1 2 3 4 5 6; do if [ "$loopcount" == 6 ]; then return 86; fi; case $2 in http://* | https://* | ftp://*) wget --quiet -O $OUTFILE $2; if [ $? != "0" ]; then log "Getting file $2 failed, retrying"; sleep 2; continue; else break; fi ;; *) cp $2 $1; if [ $? != "0" ]; then log "Copy of local file: $2 failed, trying remote"; wget --quiet -O $OUTFILE $2; if [ $? != "0" ]; then log "Getting file $2 failed, retrying"; sleep 2; continue; else break; fi; else log "Copy file $2 Succeeded"; fi ;; esac; done } log=() { STAMP=`date +%Y%m%d-%H:%M:%S.%N`; MSG=$(string_parser "$1"); echo "$MSG"; echo "[$STAMP] $MSG" >> $LOGFILE } is_instance_remote=() { local list_entry; instance=$1; instance=$(get_machine_name "$instance"); for list_entry in $MYIP_LIST; do if [ "$instance" = "$list_entry" ]; then return 1; fi; done; case "$instance" in "`hostname -s`" | "`hostname`" | "localhost" | "127.0.0.1" | "$MYIP") return 1 ;; *) return 0 ;; esac } find_system_map=() { local ARG; for ARG in `cat /proc/cmdline`; do if [ `echo $ARG | tr -t A-Z a-z | cut -f1 -d=` = "sysmap" ]; then SYSTEM_MAP=`echo $ARG | cut -f2 -d=`; if [ -e "$SYSTEM_MAP" ]; then return 0; else if [ -e "/boot/$SYSTEM_MAP" ]; then SYSTEM_MAP="/boot/$SYSTEM_MAP"; return 0; fi; fi; fi; done; if grep -q "autobench_args:" /proc/cmdline; then SYSTEM_MAP=/boot/System.map-autobench; return 0; fi; if [ -e "/boot/System.map-`uname -r`" ]; then SYSTEM_MAP=/boot/System.map-`uname -r`; return 0; fi; return 1 } force_exit_hup=() { log "autorun got SIGINT, terminating"; force_exit } exit_dat=() { log " Non fatal exit from current datfile"; if [ -n "$MACHINE_OWNER_MAIL" ]; then FROM=$(hostname -s); TEXT=$(tail -n50 $AUTODIR/logs/console_log); TEXT2=$(cat $RUNDIR/autobench.dat); echo "$TEXT $TEXT2" | mail -s "Autobench datfile exit on $FROM, continuing" $MACHINE_OWNER_MAIL; fi } profilers_init=() { log "profilers_init : Initializing profilers"; rm -f $TMPDIR/parallel.profiler.groups 2> /dev/null; rm -f $TMPDIR/profilers 2> /dev/null; rm -f $TMPDIR/remoteprofilers* 2> /dev/null; rm -f $TMPDIR/profilers.* 2> /dev/null; rm -f $AUTODIR/run/startprofilers.* 2> /dev/null; cp $AUTODIR/scripts/startprofilers_base $AUTODIR/run/startprofilers; cp $AUTODIR/scripts/stopprofilers_base $AUTODIR/run/stopprofilers; if `echo $DEFAULT_PROFILERS | grep -v '|' > /dev/null 2>&1`; then if [ -n "$DEFAULT_PROFILERS" ]; then init_useprofiler $DEFAULT_PROFILERS; fi; else counter=1; while true; do profiler_field=`echo $DEFAULT_PROFILERS | cut -d "|" -f $counter -s`; if [ -n "$profiler_field" ]; then init_useprofiler $profiler_field; (( counter += 1 )); else break; fi; done; fi } get_machine_name=() { instance=$1; echo "`echo $instance | sed -e 's/:.*//'`" } get_with_cache=() { local FILE=$1; local BASEFILE=`basename $FILE`; if [ ! -e "$LOCAL_CACHE/$BASEFILE" ]; then mkdir -p $LOCAL_CACHE; pushd $LOCAL_CACHE > /dev/null; wget --quiet -q $SERVER_CACHE/$BASEFILE; if [ $? -ne 0 ]; then echo kernel source locations:; for SOURCE in $SOURCES; do log "getting stock $VER kernel from $SOURCE"; wget --quiet $SOURCE/$FILE && break; done; check_status "Get kernel"; fi; popd > /dev/null; fi } get_remote_master_autodir=() { machine_name=$1; remote_autodir="$(ssh $SSH_OPTIONS $machine_name grep MASTER_AUTODIR= /etc/autobench_instances | sed s/MASTER_AUTODIR=//)"; echo $remote_autodir } get_instance_number=() { instance=$1; echo "`echo $instance | sed -e 's/.*::autobench\([0-9]\+\)/\1/' -e 's/^0//'`" } get_clones_state=() { . /etc/autobench_instances; if [ "$MULTI_AUTOBENCH_INSTANCES" == "" ]; then echo 3; return 3; fi; if ! ps -ax 2> /dev/null | grep -q -e 'autorun[0-9]\+'; then echo 2; return 2; fi; state=0; for i in `seq 1 $MULTI_AUTOBENCH_INSTANCES`; do state_file="${MULTI_AUTOBENCH_INSTANCE_AUTODIR[$i]}/var/run/status"; if [ -f $state_file ]; then read status < $state_file; case "$status" in "idle") ;; "running" | *) state=1 ;; esac; fi; done; echo $state; return $state } get_file_as=() { if [ $# -lt 2 ]; then echo "You must specify two arguments to get_file_as"; exit 1; fi; if [ -e "$1" ]; then log "GET_FILE_AS : " target $1 already exists, removing; rm $1; fi; case $2 in *gz) OUTFILE=$1.gz ;; *bz2) OUTFILE=$1.bz2 ;; *) OUTFILE=$1 ;; esac; case $2 in http://* | https://* | ftp://*) wget --quiet -O $OUTFILE -q $2; check_status "Getting file: $2" ;; *) cp $2 $OUTFILE; if [ $? != "0" ]; then log "GET_FILE_AS : Copy of local file: $2 failed, trying remote"; wget --quiet -O $OUTFILE -q $2; check_status "Getting file: $2"; else log "GET_FILE_AS : Copy file $2 Succeeded"; fi ;; esac; case $2 in *gz) gunzip $OUTFILE ;; *bz2) bunzip2 $OUTFILE ;; esac } get_remote_screen_status=() { machine_name=$1; remote_screen=`ssh $SSH_OPTIONS $machine_name '. /etc/autobench_instances; grep DATS_SCREEN_ENABLED $MASTER_AUTODIR/etc/autobench.conf | sed s/DATS_SCREEN_ENABLED=//'`; echo $remote_screen } do_autobench_update=() { PUSHD_DIR=$AUTODIR; if [ $# -eq 1 ]; then PUSHD_DIR=$1; fi; pushd $PUSHD_DIR > /dev/null; eval `ssh-agent`; chmod 600 $AUTODIR/ssh/autobench-id; ssh-add $AUTODIR/ssh/autobench-id; git tag -d stable; if [ "$RUN_UNSTABLE_AUTOBENCH" == "1" ]; then log "$0: upgrading to latest repo commit [unstable]"; git checkout -m master; git pull; else log "$0: upgrading to latest \"stable\" tag repo commit"; git fetch; git checkout -m stable; fi; kill $SSH_AGENT_PID; popd > /dev/null } apply_config=() { if [ -e "$2" ]; then cat $1 | grep ^CONFIG_ | sed -e "s/^[# ]*\([^ =]*\).*$/\1/" > $1.opts; echo config opts are:; cat $1.opts; grep -v -F -f $1.opts $2 > $2.new; grep -F -f $1.opts $2 > $1.removed-opts; echo opts removed from orignal .config:; cat $1.removed-opts; cat $1 >> $2.new && /bin/mv -f $2 $2.orig 2> /dev/null && /bin/mv -f $2.new $2; echo diff between original config and new config:; diff -Naurp $2.orig $2; else echo not applying, just copying; /bin/cp -f $1 $2; fi } is_instance_local=() { is_instance_remote "$1"; if [ $? -eq 0 ]; then return 1; else return 0; fi } get_file=() { if [ $# -lt 2 ]; then echo "You must specify two arguments to get_file_as"; exit 1; fi; if [ -e "$1" ]; then log "get_file_as():" target $1 already exists, removing; rm $1; fi; OUTFILE=$1; case $2 in http://* | https://* | ftp://*) wget --quiet -O $OUTFILE -q $2; check_status "Getting file: $2" ;; *) cp $2 $1; if [ $? != "0" ]; then log "Copy of local file: $2 failed, trying remote"; wget --quiet -O $OUTFILE -q $2; check_status "Getting file: $2"; else log "Copy file $2 Succeeded"; fi ;; esac } query_profiler_activation=() { local LOG_DISABLE=1; . $AUTODIR/scripts/helpers/parse_args; local profiler=${profiler:-''}; local group=${group:-''}; local profiler_extension=${profiler_extension:-'ng'}; local file=; local file_list=; local tmp_profiler=; local tmp_rest=; local tmp_file=; if [ -z "$profiler" ]; then return 1; fi; if [ -n "$group" ]; then file_list="$TMPDIR/profilers.$group"; if [ ! -f "$file_list" ]; then return 1; fi; else for tmp_file in `ls $TMPDIR/profilers*`; do file_list+=$tmp_file; done; fi; for file in $file_list; do while read tmp_profiler tmp_rest; do tmp_profiler=`echo "$tmp_profiler" | sed -e "s/\.${profiler_extension}//"`; if [ "$tmp_profiler" == "$profiler" ]; then return 0; fi; done < $file; done; return 1 } scrub_string=() { local tmp=; tmp=${1//(/{}; tmp=${tmp//)/\}}; tmp=${tmp// /_}; echo "$tmp" } quick_ftp=() { do_sftp $1 "$2" } exit_dat_exit_autorun=() { log "Exiting dat file and exiting Autorun, explicit call"; echo "exit_dat_exit_autorun" > $STATUSFILE } query_profiler_arguments=() { local LOG_DISABLE=1; . $AUTODIR/scripts/helpers/parse_args; local profiler=${profiler:-''}; local group=${group:-''}; local id=${id:-0}; local profiler_extension=${profiler_extension:-'ng'}; if [ -z "$profiler" ]; then return 1; fi; if [ -n "$group" ]; then id="${group}_${id}"; group=".${group}"; fi; local file="$TMPDIR/profilers${group}"; if [ ! -f "$file" ]; then return 1; else if grep -q -E "^${profiler}.${profiler_extension}.*id=['\"]{0,1}${id}['\"]{0,1}.*" $file; then local arguments=`grep -E "^${profiler}.${profiler_extension}.*id=['\"]{0,1}${id}['\"]{0,1}.*" $file | sed -e "s/^${profiler}.${profiler_extension}\s//"`; echo $arguments; return 0; else return 1; fi; fi } only_expand=() { if [ "$1" == "only" -o "$1" == "only_arch" ]; then only_mode=$1; shift; entry_list=""; if echo $1 | grep -E "^\"" 2>&1 > /dev/null; then until echo $1 | grep -E "\"$" 2>&1 > /dev/null; do entry_list="${entry_list} ${1}"; shift; done; entry_list="${entry_list} ${1}"; shift; else entry_list="$1"; shift; fi; arg2=`eval echo ${entry_list}`; echo "$only_mode \"$arg2\" ${@:1}"; else echo $@; fi } get_remote_instance_autodir=() { machine_name=$1; instance_id=$2; instance_var='${MULTI_AUTOBENCH_INSTANCE_AUTODIR['"$instance_id"']}'; remote_autodir=`ssh $SSH_OPTIONS $machine_name '. /etc/autobench_instances; echo '"$instance_var"';'`; echo $remote_autodir } install_utilities=() { if [ ! -d $AUTODIR/sources/pbzip2 -o ! -e $AUTODIR/sources/pbzip2/dist/bin/pbzip2 ]; then log "INSTALL_UTILITIES : pbzip2 missing, calling installer"; $AUTODIR/utilities/install/pbzip2; fi; if [ ! -d $AUTODIR/sources/perl-curses -o ! -e $AUTODIR/sources/perl-curses/lib/Curses.pm ]; then log "INSTALL_UTILITIES : perl-curses missing, calling installer"; $AUTODIR/utilities/install/perl-curses; fi; if [ ! -d $AUTODIR/sources/inotify-tools -o ! -e $AUTODIR/sources/inotify-tools/dist/bin/inotifywait ]; then log "INSTALL UTILITIES : inotify-tools missing, calling installer"; $AUTODIR/utilities/install/inotify-tools; fi; if [ `uname -i` == "x86_64" -a ! -e $AUTODIR/sources/asu/asu64 ]; then log "INSTALL UTILITIES : asu missing, calling installer"; $AUTODIR/utilities/install/asu; fi } add_parm=() { new_parm=$1; shift; new_value="$*"; if echo $new_value | grep -E "^%import% " > /dev/null; then new_value=`echo $new_value | sed "s/^%import% *//"`; new_value=`eval $new_value`; new_value=`echo $new_value | sed -e :a -e '$!N;s/\n/***/;ta' -e 'P;D'`; else new_value=`eval echo $new_value`; fi; new_export="export $new_parm=\"$new_value\""; echo $new_export >> $RUNDIR/autobench.cfg; echo "+\$$new_parm $new_value" >> $RUNDIR/autobench.cfg.replicate; echo "export -n $new_parm" >> $RUNDIR/autobench.cfg.remove; eval $new_export } cleanup=() { echo "Running cleanup"; rm $AUTODIR/run/autobench.cfg 2> /dev/null; rm $AUTODIR/run/autobench.cfg.replicate 2> /dev/null; if [ -e $RUNDIR/autobench.cfg.remove ]; then . $RUNDIR/autobench.cfg.remove; rm $AUTODIR/run/autobench.cfg.remove; fi; profilers_init; rm $AUTODIR/var/run/jobid 2> /dev/null; rm $AUTODIR/var/run/runonce 2> /dev/null; rm $RUNFILE 2> /dev/null; if [ -e $MANAGEDFILE ]; then rm -r $AUTODIR/user 2> /dev/null; mkdir -p $AUTODIR/user/install; fi; rm $LOGFILE 2> /dev/null; rm $AUTODIR/logs/console_log 2> /dev/null; rm -rf $AUTODIR/logs/default/* 2> /dev/null; rm -Rf $AUTODIR/var/tmp/barrier/* 2> /dev/null; rm -f $AUTODIR/logs/autobench.dat } ftp_del=() { do_sftp $1 "rm $2" } ftp_get=() { do_sftp $1 "get $2 $3" } string_parser=() { MY_MSG=`echo "$1" | sed -e 's/\+\\$/\+\\\\$/'`; MY_MSG=`eval echo \"$MY_MSG\"`; echo "$MY_MSG" } ftp_put=() { do_sftp $1 "put $2 $3" } in_list=() { if [ $# -lt 2 ]; then echo "You must specify two arguments to in_list"; exit 1; fi; for i in $1; do log "is [$i] in [$2]?" 1>&2; if [ "$i" = "$2" ]; then return 0; fi; done; return 1 } get_my_ip=() { if [ -z "$AIX" ]; then if [ -z "$MYIP" ]; then WORLD_IFACE=`route -n | tr -s " " | cut -f2,8 -d" " | grep [0-9] | grep -v "0.0.0.0" | cut -f2 -d" " | head -n1 `; if [ -z "$WORLD_IFACE" ]; then WORLD_IFACE="eth0"; fi; export MYIP=`ifconfig $WORLD_IFACE | grep "inet addr" | tr -s " " | cut -f3 -d" " | cut -f2 -d:`; ip_list=""; for i in `ifconfig|grep 'inet addr'|sed -e 's/inet addr:\([0-9\.]*\).*/\1/' -e 's/\s\+//m'`; do ip_list="$ip_list $i"; done; ip_list=`echo $ip_list | sed -e 's/^\s\+//' -e 's/\s\+$//'`; export MYIP_LIST="$ip_list"; fi; else export MYIP=$(host $HOSTNAME | cut -d' ' -f3); export MYIP_LIST="$MYIP"; export CC=xlc; fi } force_exit=() { log " Fatal error, aborting autorun"; echo "died" > $STATUSFILE; if [ -n "$MACHINE_OWNER_MAIL" ]; then FROM=$(hostname -s); TEXT=$(tail -n50 $AUTODIR/logs/console_log); echo "$TEXT" | mail -s "Autobench error on $FROM, aborting" $MACHINE_OWNER_MAIL; fi; exit $AB_EXIT_ERROR } get_datfile=() { my_hostname=$1; idle_loop_counter=$2; localqueue="$AUTODIR/var/localqueue"; mkdir -p $localqueue; rm -f $localqueue/processing* 2> /dev/null; datfile=`ls -1 --sort=time --reverse $localqueue | grep -v "\.$" | head -n 1`; if [ "$datfile" ]; then if [ $idle_loop_counter -gt 0 ]; then echo; fi; log "Found datfile \"$datfile\" in localqueue after $idle_loop_counter idle minutes. Processing..."; if which dos2unix >&/dev/null; then dos2unix -o $RUNDIR/autobench.dat >&/dev/null; fi; cp $localqueue/$datfile $RUNDIR/autobench.dat; if [ -e $RUNDIR/autobench.dat ]; then mv $localqueue/$datfile $localqueue/processing:$datfile; return 0; fi; fi; if [ "$USE_WORK_QUEUES" == "0" ]; then return 1; fi; if [ -n "$WORK_QUEUE_HOST" ]; then ftp_host=$WORK_QUEUE_HOST; ftp_path=$WORK_QUEUE_PATH/$my_hostname; else ftp_host="ausgsa.austin.ibm.com"; ftp_path="/projects/l/ltcperformance/tools/autobench/workqueues/$my_hostname"; fi; r=`quick_ftp $ftp_host "cd upload_root/$ftp_path \n rm processing* \n ls -l" 2> /dev/null`; r=${r##*"not understood."}; r=${r##*"not understood"}; r=${r##*"mode off."}; r=${r##*"oops"}; r=${r##*"sftp> "}; r=${r##*"ls -l"}; if [ -z "$AIX" ]; then datfile=`echo $r | awk '{print $9}'`; else if [ "$r" ]; then datfile=$(echo $r | awk '{print $1}'); fi; fi; if [ "$datfile" ]; then ftp_get $ftp_host "upload_root/$ftp_path/$datfile" $RUNDIR/autobench.dat > /dev/null 2>&1; if [ -s $RUNDIR/autobench.dat ]; then if [ $idle_loop_counter -gt 0 ]; then echo; fi; log "Found datfile \"$datfile\" in remote queue [sftp://$ftp_host/upload_root/$ftp_path] after $idle_loop_counter minutes. Processing..."; if which dos2unix >&/dev/null; then dos2unix -o $RUNDIR/autobench.dat >&/dev/null; fi; quick_ftp $ftp_host "cd upload_root/$ftp_path \n rename $datfile processing:$datfile" 2>&1 > /dev/null; cp $RUNDIR/autobench.dat $AUTODIR/logs; return 0; fi; fi; return 1 } profiler_log=() { STAMP=`date +'%x-%T [%s]'`; if [ -d $LOGDIR/analysis ]; then MSG=$(string_parser "$1"); echo "$STAMP $MSG" >> $LOGDIR/analysis/profile-log.${RUN_NUMBER}${SUFFIX}; fi } _=/bin/env