lmbench.old 6.7 KB

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