123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- #!/bin/bash
- # lmbench - run the lmbench benchmark suite.
- #
- # Hacked by Larry McVoy (lm@sun.com, lm@sgi.com, lm@bitmover.com).
- # Copyright (c) 1994 Larry McVoy. GPLed software.
- # $Id$
- # Make sure we can find: ./cmd, df, and netstat
- PATH=.:../../scripts:$PATH:/etc:/usr/etc:/sbin:/usr/sbin
- export PATH
- echo PATH = $PATH
- echo lat_syscall = `readlink -f lat_syscall`
- if [ -f $1 ]
- then . $1
- echo Using config in $1 >> ${OUTPUT}
- else echo Using defaults >> ${OUTPUT}
- ENOUGH=1000000
- TIMING_O=0
- LOOP_O=0
- fi
- export ENOUGH TIMING_O LOOP_O
- if [ X$FILE = X ]
- then FILE=/tmp/XXX
- touch $FILE || echo Can not create $FILE >> ${OUTPUT}
- fi
- if [ X$MB = X ]
- then MB=8
- fi
- AVAILKB=`expr $MB \* 1024`
- # Figure out how big we can go for stuff that wants to use
- # all and half of memory.
- HALF="512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m"
- ALL="$HALF 2m"
- i=4
- while [ $i -le $MB ]
- do
- ALL="$ALL ${i}m"
- h=`expr $i / 2`
- HALF="$HALF ${h}m"
- i=`expr $i \* 2`
- done
- if [ X$FSDIR = X ]
- then FSDIR=/tmp/lat_fs
- fi
- MP=N
- # Figure out as much stuff as we can about this system.
- # Sure would be nice if everyone had SGI's "hinv".
- echo \[lmbench2.0 results for `uname -a`] 1>&2
- echo \[ALL: ${ALL}] 1>&2
- echo \[DISKS: ${DISKS}] 1>&2
- echo \[DISK_DESC: ${DISK_DESC}] 1>&2
- echo \[ENOUGH: ${ENOUGH}] 1>&2
- echo \[FAST: ${FAST}] 1>&2
- echo \[FASTMEM: ${FASTMEM}] 1>&2
- echo \[FILE: ${FILE}] 1>&2
- echo \[FSDIR: ${FSDIR}] 1>&2
- echo \[HALF: ${HALF}] 1>&2
- echo \[INFO: ${INFO}] 1>&2
- echo \[LOOP_O: ${LOOP_O}] 1>&2
- echo \[MB: ${MB}] 1>&2
- echo \[MHZ: ${MHZ}] 1>&2
- echo \[MOTHERBOARD: ${MOTHERBOARD}] 1>&2
- echo \[NETWORKS: ${NETWORKS}] 1>&2
- echo \[PROCESSORS: ${PROCESSORS}] 1>&2
- echo \[REMOTE: ${REMOTE}] 1>&2
- echo \[SLOWFS: ${SLOWFS}] 1>&2
- echo \[OS: ${OS}] 1>&2
- echo \[TIMING_O: ${TIMING_O}] 1>&2
- echo \[LMBENCH VERSION: ${VERSION}] 1>&2
- echo \[USER: $USER] 1>&2
- echo \[HOSTNAME: `hostname`] 1>&2
- echo \[NODENAME: `uname -n`] 1>&2
- echo \[SYSNAME: `uname -s`] 1>&2
- echo \[PROCESSOR: `uname -p`] 1>&2
- echo \[MACHINE: `uname -m`] 1>&2
- echo \[RELEASE: `uname -r`] 1>&2
- echo \[VERSION: `uname -v`] 1>&2
- #if 0
- echo \[`date`] 1>&2
- echo \[`uptime`] 1>&2
- netstat -i | while read i
- do echo \[net: "$i"] 1>&2
- set `echo $i`
- case $1 in
- *ame) ;;
- *) ifconfig $1 | while read i
- do echo \[if: "$i"] 1>&2
- done
- ;;
- esac
- done
- mount | while read i
- do echo \[mount: "$i"] 1>&2
- done
- STAT=$FSDIR/lmbench
- mkdir $FSDIR 2>/dev/null
- touch $STAT 2>/dev/null
- if [ ! -f $STAT ]
- then echo "Can't make a file - $STAT - in $FSDIR" >> ${OUTPUT}
- touch $STAT
- exit 1
- fi
- function work {
- echo "$@"
- "$@" 3>&1 >&2 2>&3 3>&-
- }
- date >> ${OUTPUT}
- echo Latency measurements >> ${OUTPUT}
- work lat_syscall null
- work lat_syscall read
- work lat_syscall write
- work lat_syscall stat $STAT
- work lat_syscall fstat $STAT
- work lat_syscall open $STAT
- for i in 10 100 250 500; do work lat_select file $i; done
- for i in 10 100 250 500; do work lat_select tcp $i; done
- work lat_sig install
- work lat_sig catch
- work lat_sig prot lat_sig
- work lat_pipe
- work lat_unix
- #fi
- cp hello /tmp/hello
- for i in fork exec shell; do work lat_proc $i; done
- rm /tmp/hello
- rm -f $FILE
- work lmdd label="File $FILE write bandwidth:" of=$FILE move=${MB}m fsync=1 print=3
- work lat_pagefault $FILE
- echo "" 1>&2
- echo \"mappings 1>&2
- for i in $ALL; do work lat_mmap $i $FILE; done
- echo "" 1>&2
- if [ X$SLOWFS != XYES ]
- then date >> ${OUTPUT}
- echo Calculating file system latency >> ${OUTPUT}
- echo '"File system latency' 1>&2
- work lat_fs $FSDIR
- echo "" 1>&2
- fi
- if [ X"$DISKS" != X ]
- then for i in $DISKS
- do if [ -r $i ]
- then echo "Calculating disk zone bw & seek times" >> ${OUTPUT}
- work disk $i
- echo "" 1>&2
- fi
- done
- fi
- date >> ${OUTPUT}
- sleep 30
- echo "sleep for 30"
- echo Local networking >> ${OUTPUT}
- #if [ ! -d /tmp/webpage-lm ]
- #then TAR=${PWD}/../../src/webpage-lm.tar
- # (cd /tmp && tar xf ${TAR})
- # sync
- # sleep 5
- #fi
- #SERVERS="lat_udp lat_tcp lat_rpc lat_connect bw_tcp"
- SERVERS="lat_udp lat_tcp lat_connect bw_tcp"
- for server in $SERVERS; do work $server -s; done
- #work env DOCROOT=/tmp/webpage-lm lmhttp 8008 &
- #sleep 60
- echo "sleeep for 30"
- for i in 127.0.0.1
- do
- work lat_udp $i
- sleep 5
- work lat_udp -$i
- sleep 5
- work lat_tcp $i
- sleep 5
- work lat_tcp -$i
- sleep 5
- #work lat_rpc $i
- #work lat_rpc -$i
- work lat_connect $i
- sleep 5
- work lat_connect -$i
- work bw_tcp $i
- work bw_tcp -$i
- # I want a hot cache number
- #work lat_http $i 8008 < /tmp/webpage-lm/URLS > /dev/null 2>&1
- #work lat_http $i 8008 < /tmp/webpage-lm/URLS
- #work lat_http -$i 8008
- done
- for remote in $REMOTE
- do echo Networking to $remote >> ${OUTPUT}
- $RCP $SERVERS lmhttp /tmp/webpage-lm.tar ${remote}:/tmp/rcp/
- for server in $SERVERS
- do $RSH $remote -n /tmp/$server -s &
- done
- $RSH $remote -n 'cd /tmp; tar xf webpage-lm.tar; cd webpage-lm; ../lmhttp 8008' &
- sleep 10
- echo "[ Networking remote to $remote: `$RSH $remote uname -a` ]" 1>&2
- work lat_udp $remote; lat_udp -$remote;
- work lat_tcp $remote; lat_tcp -$remote;
- #work lat_rpc $remote udp; lat_rpc $remote tcp; lat_rpc -$remote;
- work lat_connect $remote; lat_connect -$remote;
- work bw_tcp $remote; bw_tcp -$remote
- # I want a hot cache number
- #work lat_http $remote 8008 < /tmp/webpage-lm/URLS > /dev/null 2>&1
- #work lat_http $remote 8008 < /tmp/webpage-lm/URLS
- #work lat_http -$remote 8008
- RM=
- for server in $SERVERS
- do RM="/tmp/$server $RM"
- done
- $RSH $remote rm $RM
- done
- exit #exit because we do not need these bandwith tests for the paper
- date >> ${OUTPUT}
- echo Bandwidth measurements >> ${OUTPUT}
- work bw_unix
- work bw_pipe
- echo "" 1>&2
- echo \"read bandwidth 1>&2
- for i in $ALL; do work bw_file_rd $i io_only $FILE; done
- echo "" 1>&2
- echo "" 1>&2
- echo \"read open2close bandwidth 1>&2
- for i in $ALL; do work bw_file_rd $i open2close $FILE; done
- echo "" 1>&2
- echo \"Mmap read bandwidth 1>&2
- for i in $ALL; do work bw_mmap_rd $i mmap_only $FILE; done
- echo "" 1>&2
- echo \"Mmap read open2close bandwidth 1>&2
- for i in $ALL; do work bw_mmap_rd $i open2close $FILE; done
- echo "" 1>&2
- rm -f $FILE
- echo \"libc bcopy unaligned 1>&2
- for i in $HALF; do work bw_mem $i bcopy; done; echo "" 1>&2
- echo \"libc bcopy aligned 1>&2
- for i in $HALF; do work bw_mem $i bcopy conflict; done; echo "" 1>&2
- echo \"unrolled bcopy unaligned 1>&2
- for i in $HALF; do work bw_mem $i fcp; done; echo "" 1>&2
- echo \"unrolled partial bcopy unaligned 1>&2
- for i in $HALF; do work bw_mem $i cp; done; echo "" 1>&2
- echo "Memory read bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i frd; done; echo "" 1>&2
- echo "Memory partial read bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i rd; done; echo "" 1>&2
- echo "Memory write bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i fwr; done; echo "" 1>&2
- echo "Memory partial write bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i wr; done; echo "" 1>&2
- echo "Memory partial read/write bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i rdwr; done; echo "" 1>&2
- echo "Memory bzero bandwidth" 1>&2
- for i in $ALL; do work bw_mem $i bzero; done; echo "" 1>&2
- date >> ${OUTPUT}
- msleep 250
- echo Calculating context switch overhead >> ${OUTPUT}
- if [ $MB -ge 8 ]
- then CTX="0 4 8 16 32 64"
- N="2 4 8 16 24 32 64 96"
- else
- CTX="0 4 8 16 32"
- N="2 4 8 16 24 32 64 96"
- fi
-
- for size in $CTX; do work lat_ctx -s $size $N; done
- date >> ${OUTPUT}
- echo Calculating memory load latency >> ${OUTPUT}
- msleep 250
- echo "" 1>&2
- echo "Memory load latency" 1>&2
- if [ X$FASTMEM = XYES ]
- then work lat_mem_rd $MB 128
- else work lat_mem_rd $MB 16 32 64 128 256 512 1024
- fi
- date >> ${OUTPUT}
- echo '' 1>&2
- echo \[`date`] 1>&2
- exit 0
|