lmbench-regression 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #!/bin/bash
  2. # lmbench - run the lmbench benchmark suite.
  3. #
  4. # Hacked by Larry McVoy (lm@sun.com, lm@sgi.com, lm@bitmover.com).
  5. # Copyright (c) 1994 Larry McVoy. GPLed software.
  6. # $Id$
  7. # Make sure we can find: ./cmd, df, and netstat
  8. PATH=.:../../scripts:$PATH:/etc:/usr/etc:/sbin:/usr/sbin
  9. export PATH
  10. echo PATH = $PATH
  11. echo lat_syscall = `readlink -f lat_syscall`
  12. # lat_unix, lat_udp, lat_tcp only do one run!!!
  13. # we loop to repeat the tests
  14. N_RUNS=6
  15. if [ -f $1 ]
  16. then . $1
  17. echo Using config in $1
  18. else echo Using defaults
  19. ENOUGH=1000000
  20. TIMING_O=0
  21. LOOP_O=0
  22. fi
  23. export ENOUGH TIMING_O LOOP_O
  24. if [ X$FILE = X ]
  25. then FILE=/tmp/XXX
  26. touch $FILE || echo Can not create $FILE
  27. fi
  28. if [ X$MB = X ]
  29. then MB=8
  30. fi
  31. AVAILKB=`expr $MB \* 1024`
  32. # Figure out how big we can go for stuff that wants to use
  33. # all and half of memory.
  34. HALF="512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m"
  35. ALL="$HALF 2m"
  36. i=4
  37. while [ $i -le $MB ]
  38. do
  39. ALL="$ALL ${i}m"
  40. h=`expr $i / 2`
  41. HALF="$HALF ${h}m"
  42. i=`expr $i \* 2`
  43. done
  44. if [ X$FSDIR = X ]
  45. then FSDIR=/tmp/lat_fs
  46. fi
  47. MP=N
  48. # Figure out as much stuff as we can about this system.
  49. # Sure would be nice if everyone had SGI's "hinv".
  50. echo \[lmbench2.0 results for `uname -a`] 1>&2
  51. echo \[ALL: ${ALL}] 1>&2
  52. echo \[DISKS: ${DISKS}] 1>&2
  53. echo \[DISK_DESC: ${DISK_DESC}] 1>&2
  54. echo \[ENOUGH: ${ENOUGH}] 1>&2
  55. echo \[FAST: ${FAST}] 1>&2
  56. echo \[FASTMEM: ${FASTMEM}] 1>&2
  57. echo \[FILE: ${FILE}] 1>&2
  58. echo \[FSDIR: ${FSDIR}] 1>&2
  59. echo \[HALF: ${HALF}] 1>&2
  60. echo \[INFO: ${INFO}] 1>&2
  61. echo \[LOOP_O: ${LOOP_O}] 1>&2
  62. echo \[MB: ${MB}] 1>&2
  63. echo \[MHZ: ${MHZ}] 1>&2
  64. echo \[MOTHERBOARD: ${MOTHERBOARD}] 1>&2
  65. echo \[NETrunS: ${NETrunS}] 1>&2
  66. echo \[PROCESSORS: ${PROCESSORS}] 1>&2
  67. echo \[REMOTE: ${REMOTE}] 1>&2
  68. echo \[SLOWFS: ${SLOWFS}] 1>&2
  69. echo \[OS: ${OS}] 1>&2
  70. echo \[TIMING_O: ${TIMING_O}] 1>&2
  71. echo \[LMBENCH VERSION: ${VERSION}] 1>&2
  72. echo \[USER: $USER] 1>&2
  73. echo \[HOSTNAME: `hostname`] 1>&2
  74. echo \[NODENAME: `uname -n`] 1>&2
  75. echo \[SYSNAME: `uname -s`] 1>&2
  76. echo \[PROCESSOR: `uname -p`] 1>&2
  77. echo \[MACHINE: `uname -m`] 1>&2
  78. echo \[RELEASE: `uname -r`] 1>&2
  79. echo \[VERSION: `uname -v`] 1>&2
  80. #if 0
  81. echo \[`date`] 1>&2
  82. echo \[`uptime`] 1>&2
  83. netstat -i | while read i
  84. do echo \[net: "$i"] 1>&2
  85. set `echo $i`
  86. case $1 in
  87. *ame) ;;
  88. *) ifconfig $1 | while read i
  89. do echo \[if: "$i"] 1>&2
  90. done
  91. ;;
  92. esac
  93. done
  94. mount | while read i
  95. do echo \[mount: "$i"] 1>&2
  96. done
  97. STAT=$FSDIR/lmbench
  98. mkdir $FSDIR 2>/dev/null
  99. touch $STAT 2>/dev/null
  100. if [ ! -f $STAT ]
  101. then echo "Can't make a file - $STAT - in $FSDIR"
  102. touch $STAT
  103. exit 1
  104. fi
  105. function run {
  106. echo "$@"
  107. TMPOUT=/tmp/OUT
  108. rm -rf $TMPOUT
  109. $LOADER "$@" 2>>$TMPOUT | tee -a $TMPOUT
  110. echo $?
  111. echo "Done"
  112. if [ $? -ne 0 ]
  113. then
  114. cat $TMPOUT 1>&2
  115. exit 1
  116. else
  117. cat $TMPOUT 1>&2
  118. fi
  119. }
  120. date
  121. echo Latency measurements
  122. msleep 250
  123. run lat_syscall null
  124. run lat_syscall read
  125. run lat_syscall write
  126. run lat_syscall stat $STAT
  127. run lat_syscall fstat $STAT
  128. run lat_syscall open $STAT
  129. #select file (500), select tcp (500)
  130. run lat_select file 500
  131. run lat_select tcp 500
  132. #sig install, sig_overhead, prot. Fault
  133. run lat_sig install
  134. run lat_sig catch
  135. run lat_sig prot lat_sig
  136. #AF_UNIX
  137. echo AF_UNIX socket latency
  138. for i in $(eval echo "{1..$N_RUNS}")
  139. do run lat_unix
  140. done
  141. #forks
  142. cp hello /tmp/hello
  143. for i in fork dfork vfork exec dforkexec shell
  144. do run lat_proc $i
  145. done
  146. rm -f /tmp/hello
  147. for i in $(eval echo "{1..$N_RUNS}")
  148. do rm -f $FILE
  149. run lmdd label="File $FILE write bandwidth:" of=$FILE move=${MB}m fsync=1 print=3
  150. done
  151. #0,4,10KB create/delete
  152. date
  153. echo Calculating file system latency
  154. echo '"File system latency' 1>&2
  155. run lat_fs $FSDIR
  156. echo "" 1>&2
  157. date
  158. echo Local netruning
  159. echo UDP socket latency
  160. run lat_udp -s &
  161. sleep 3
  162. for i in $(eval echo "{1..$N_RUNS}")
  163. do run lat_udp 127.0.0.1
  164. sleep 1
  165. done
  166. run lat_udp -127.0.0.1
  167. sleep 3
  168. echo TCP socket latency
  169. run lat_tcp -s &
  170. sleep 3
  171. for i in $(eval echo "{1..$N_RUNS}")
  172. do run lat_tcp 127.0.0.1
  173. sleep 1
  174. done
  175. run lat_tcp -127.0.0.1
  176. sleep 3
  177. echo TCP connect latency
  178. run lat_connect -s &
  179. sleep 3
  180. run lat_connect 127.0.0.1
  181. sleep 1
  182. run lat_connect -127.0.0.1
  183. sleep 3
  184. echo TCP socket bandwidth
  185. run bw_tcp -s &
  186. sleep 3
  187. for i in $(eval echo "{1..$N_RUNS}")
  188. do run bw_tcp 127.0.0.1
  189. sleep 1
  190. done
  191. run bw_tcp -127.0.0.1
  192. sleep 3
  193. date
  194. echo Bandwidth measurements
  195. for i in $(eval echo "{1..$N_RUNS}")
  196. do run bw_unix
  197. done
  198. for i in $(eval echo "{1..$N_RUNS}")
  199. do run bw_pipe
  200. done
  201. exit 0