lmbench.old 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. if [ -f $1 ]
  13. then . $1
  14. echo Using config in $1 >> ${OUTPUT}
  15. else echo Using defaults >> ${OUTPUT}
  16. ENOUGH=1000000
  17. TIMING_O=0
  18. LOOP_O=0
  19. fi
  20. export ENOUGH TIMING_O LOOP_O
  21. if [ X$FILE = X ]
  22. then FILE=/tmp/XXX
  23. touch $FILE || echo Can not create $FILE >> ${OUTPUT}
  24. fi
  25. if [ X$MB = X ]
  26. then MB=8
  27. fi
  28. AVAILKB=`expr $MB \* 1024`
  29. # Figure out how big we can go for stuff that wants to use
  30. # all and half of memory.
  31. HALF="512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m"
  32. ALL="$HALF 2m"
  33. i=4
  34. while [ $i -le $MB ]
  35. do
  36. ALL="$ALL ${i}m"
  37. h=`expr $i / 2`
  38. HALF="$HALF ${h}m"
  39. i=`expr $i \* 2`
  40. done
  41. if [ X$FSDIR = X ]
  42. then FSDIR=/tmp/lat_fs
  43. fi
  44. MP=N
  45. # Figure out as much stuff as we can about this system.
  46. # Sure would be nice if everyone had SGI's "hinv".
  47. echo \[lmbench2.0 results for `uname -a`] 1>&2
  48. echo \[ALL: ${ALL}] 1>&2
  49. echo \[DISKS: ${DISKS}] 1>&2
  50. echo \[DISK_DESC: ${DISK_DESC}] 1>&2
  51. echo \[ENOUGH: ${ENOUGH}] 1>&2
  52. echo \[FAST: ${FAST}] 1>&2
  53. echo \[FASTMEM: ${FASTMEM}] 1>&2
  54. echo \[FILE: ${FILE}] 1>&2
  55. echo \[FSDIR: ${FSDIR}] 1>&2
  56. echo \[HALF: ${HALF}] 1>&2
  57. echo \[INFO: ${INFO}] 1>&2
  58. echo \[LOOP_O: ${LOOP_O}] 1>&2
  59. echo \[MB: ${MB}] 1>&2
  60. echo \[MHZ: ${MHZ}] 1>&2
  61. echo \[MOTHERBOARD: ${MOTHERBOARD}] 1>&2
  62. echo \[NETWORKS: ${NETWORKS}] 1>&2
  63. echo \[PROCESSORS: ${PROCESSORS}] 1>&2
  64. echo \[REMOTE: ${REMOTE}] 1>&2
  65. echo \[SLOWFS: ${SLOWFS}] 1>&2
  66. echo \[OS: ${OS}] 1>&2
  67. echo \[TIMING_O: ${TIMING_O}] 1>&2
  68. echo \[LMBENCH VERSION: ${VERSION}] 1>&2
  69. echo \[USER: $USER] 1>&2
  70. echo \[HOSTNAME: `hostname`] 1>&2
  71. echo \[NODENAME: `uname -n`] 1>&2
  72. echo \[SYSNAME: `uname -s`] 1>&2
  73. echo \[PROCESSOR: `uname -p`] 1>&2
  74. echo \[MACHINE: `uname -m`] 1>&2
  75. echo \[RELEASE: `uname -r`] 1>&2
  76. echo \[VERSION: `uname -v`] 1>&2
  77. #if 0
  78. echo \[`date`] 1>&2
  79. echo \[`uptime`] 1>&2
  80. netstat -i | while read i
  81. do echo \[net: "$i"] 1>&2
  82. set `echo $i`
  83. case $1 in
  84. *ame) ;;
  85. *) ifconfig $1 | while read i
  86. do echo \[if: "$i"] 1>&2
  87. done
  88. ;;
  89. esac
  90. done
  91. mount | while read i
  92. do echo \[mount: "$i"] 1>&2
  93. done
  94. STAT=$FSDIR/lmbench
  95. mkdir $FSDIR 2>/dev/null
  96. touch $STAT 2>/dev/null
  97. if [ ! -f $STAT ]
  98. then echo "Can't make a file - $STAT - in $FSDIR" >> ${OUTPUT}
  99. touch $STAT
  100. exit 1
  101. fi
  102. function work {
  103. echo "$@"
  104. "$@" 3>&1 >&2 2>&3 3>&-
  105. }
  106. date >> ${OUTPUT}
  107. echo Latency measurements >> ${OUTPUT}
  108. work lat_syscall null
  109. work lat_syscall read
  110. work lat_syscall write
  111. work lat_syscall stat $STAT
  112. work lat_syscall fstat $STAT
  113. work lat_syscall open $STAT
  114. for i in 10 100 250 500; do work lat_select file $i; done
  115. for i in 10 100 250 500; do work lat_select tcp $i; done
  116. work lat_sig install
  117. work lat_sig catch
  118. work lat_sig prot lat_sig
  119. work lat_pipe
  120. work lat_unix
  121. #fi
  122. cp hello /tmp/hello
  123. for i in fork exec shell; do work lat_proc $i; done
  124. rm /tmp/hello
  125. rm -f $FILE
  126. work lmdd label="File $FILE write bandwidth:" of=$FILE move=${MB}m fsync=1 print=3
  127. work lat_pagefault $FILE
  128. echo "" 1>&2
  129. echo \"mappings 1>&2
  130. for i in $ALL; do work lat_mmap $i $FILE; done
  131. echo "" 1>&2
  132. if [ X$SLOWFS != XYES ]
  133. then date >> ${OUTPUT}
  134. echo Calculating file system latency >> ${OUTPUT}
  135. echo '"File system latency' 1>&2
  136. work lat_fs $FSDIR
  137. echo "" 1>&2
  138. fi
  139. if [ X"$DISKS" != X ]
  140. then for i in $DISKS
  141. do if [ -r $i ]
  142. then echo "Calculating disk zone bw & seek times" >> ${OUTPUT}
  143. work disk $i
  144. echo "" 1>&2
  145. fi
  146. done
  147. fi
  148. date >> ${OUTPUT}
  149. sleep 30
  150. echo "sleep for 30"
  151. echo Local networking >> ${OUTPUT}
  152. #if [ ! -d /tmp/webpage-lm ]
  153. #then TAR=${PWD}/../../src/webpage-lm.tar
  154. # (cd /tmp && tar xf ${TAR})
  155. # sync
  156. # sleep 5
  157. #fi
  158. #SERVERS="lat_udp lat_tcp lat_rpc lat_connect bw_tcp"
  159. SERVERS="lat_udp lat_tcp lat_connect bw_tcp"
  160. for server in $SERVERS; do work $server -s; done
  161. #work env DOCROOT=/tmp/webpage-lm lmhttp 8008 &
  162. #sleep 60
  163. echo "sleeep for 30"
  164. for i in 127.0.0.1
  165. do
  166. work lat_udp $i
  167. sleep 5
  168. work lat_udp -$i
  169. sleep 5
  170. work lat_tcp $i
  171. sleep 5
  172. work lat_tcp -$i
  173. sleep 5
  174. #work lat_rpc $i
  175. #work lat_rpc -$i
  176. work lat_connect $i
  177. sleep 5
  178. work lat_connect -$i
  179. work bw_tcp $i
  180. work bw_tcp -$i
  181. # I want a hot cache number
  182. #work lat_http $i 8008 < /tmp/webpage-lm/URLS > /dev/null 2>&1
  183. #work lat_http $i 8008 < /tmp/webpage-lm/URLS
  184. #work lat_http -$i 8008
  185. done
  186. for remote in $REMOTE
  187. do echo Networking to $remote >> ${OUTPUT}
  188. $RCP $SERVERS lmhttp /tmp/webpage-lm.tar ${remote}:/tmp/rcp/
  189. for server in $SERVERS
  190. do $RSH $remote -n /tmp/$server -s &
  191. done
  192. $RSH $remote -n 'cd /tmp; tar xf webpage-lm.tar; cd webpage-lm; ../lmhttp 8008' &
  193. sleep 10
  194. echo "[ Networking remote to $remote: `$RSH $remote uname -a` ]" 1>&2
  195. work lat_udp $remote; lat_udp -$remote;
  196. work lat_tcp $remote; lat_tcp -$remote;
  197. #work lat_rpc $remote udp; lat_rpc $remote tcp; lat_rpc -$remote;
  198. work lat_connect $remote; lat_connect -$remote;
  199. work bw_tcp $remote; bw_tcp -$remote
  200. # I want a hot cache number
  201. #work lat_http $remote 8008 < /tmp/webpage-lm/URLS > /dev/null 2>&1
  202. #work lat_http $remote 8008 < /tmp/webpage-lm/URLS
  203. #work lat_http -$remote 8008
  204. RM=
  205. for server in $SERVERS
  206. do RM="/tmp/$server $RM"
  207. done
  208. $RSH $remote rm $RM
  209. done
  210. exit #exit because we do not need these bandwith tests for the paper
  211. date >> ${OUTPUT}
  212. echo Bandwidth measurements >> ${OUTPUT}
  213. work bw_unix
  214. work bw_pipe
  215. echo "" 1>&2
  216. echo \"read bandwidth 1>&2
  217. for i in $ALL; do work bw_file_rd $i io_only $FILE; done
  218. echo "" 1>&2
  219. echo "" 1>&2
  220. echo \"read open2close bandwidth 1>&2
  221. for i in $ALL; do work bw_file_rd $i open2close $FILE; done
  222. echo "" 1>&2
  223. echo \"Mmap read bandwidth 1>&2
  224. for i in $ALL; do work bw_mmap_rd $i mmap_only $FILE; done
  225. echo "" 1>&2
  226. echo \"Mmap read open2close bandwidth 1>&2
  227. for i in $ALL; do work bw_mmap_rd $i open2close $FILE; done
  228. echo "" 1>&2
  229. rm -f $FILE
  230. echo \"libc bcopy unaligned 1>&2
  231. for i in $HALF; do work bw_mem $i bcopy; done; echo "" 1>&2
  232. echo \"libc bcopy aligned 1>&2
  233. for i in $HALF; do work bw_mem $i bcopy conflict; done; echo "" 1>&2
  234. echo \"unrolled bcopy unaligned 1>&2
  235. for i in $HALF; do work bw_mem $i fcp; done; echo "" 1>&2
  236. echo \"unrolled partial bcopy unaligned 1>&2
  237. for i in $HALF; do work bw_mem $i cp; done; echo "" 1>&2
  238. echo "Memory read bandwidth" 1>&2
  239. for i in $ALL; do work bw_mem $i frd; done; echo "" 1>&2
  240. echo "Memory partial read bandwidth" 1>&2
  241. for i in $ALL; do work bw_mem $i rd; done; echo "" 1>&2
  242. echo "Memory write bandwidth" 1>&2
  243. for i in $ALL; do work bw_mem $i fwr; done; echo "" 1>&2
  244. echo "Memory partial write bandwidth" 1>&2
  245. for i in $ALL; do work bw_mem $i wr; done; echo "" 1>&2
  246. echo "Memory partial read/write bandwidth" 1>&2
  247. for i in $ALL; do work bw_mem $i rdwr; done; echo "" 1>&2
  248. echo "Memory bzero bandwidth" 1>&2
  249. for i in $ALL; do work bw_mem $i bzero; done; echo "" 1>&2
  250. date >> ${OUTPUT}
  251. msleep 250
  252. echo Calculating context switch overhead >> ${OUTPUT}
  253. if [ $MB -ge 8 ]
  254. then CTX="0 4 8 16 32 64"
  255. N="2 4 8 16 24 32 64 96"
  256. else
  257. CTX="0 4 8 16 32"
  258. N="2 4 8 16 24 32 64 96"
  259. fi
  260. for size in $CTX; do work lat_ctx -s $size $N; done
  261. date >> ${OUTPUT}
  262. echo Calculating memory load latency >> ${OUTPUT}
  263. msleep 250
  264. echo "" 1>&2
  265. echo "Memory load latency" 1>&2
  266. if [ X$FASTMEM = XYES ]
  267. then work lat_mem_rd $MB 128
  268. else work lat_mem_rd $MB 16 32 64 128 256 512 1024
  269. fi
  270. date >> ${OUTPUT}
  271. echo '' 1>&2
  272. echo \[`date`] 1>&2
  273. exit 0