config-run 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. #!/bin/sh
  2. # Configure parameters for lmbench.
  3. # %I% %E% %@%
  4. OS=`../scripts/os`
  5. L='====================================================================='
  6. echo $L;
  7. cat<<EOF;
  8. L M B E N C H C ON F I G U R A T I O N
  9. ----------------------------------------
  10. You need to configure some parameters to lmbench. Once you have configured
  11. these parameters, you may do multiple runs by saying
  12. "make rerun"
  13. in the src subdirectory.
  14. NOTICE: please do not have any other activity on the system if you can
  15. help it. Things like the second hand on your xclock or X perfmeters
  16. are not so good when benchmarking. In fact, X is not so good when
  17. benchmarking.
  18. EOF
  19. # Figure out echo.
  20. if [ `echo -n "foo" | wc -l` -eq 0 ]
  21. then ECHON="-n"; ECHOC=
  22. else ECHON= ; ECHOC='\c'
  23. fi
  24. ############################################################################
  25. # Timing granulairty, loop overhead, etc.
  26. ############################################################################
  27. echo $L; echo "";
  28. echo "Hang on, we are calculating your timing granularity."
  29. ../bin/$OS/msleep 250
  30. ENOUGH=`../bin/$OS/enough`
  31. export ENOUGH
  32. echo "OK, it looks like you can time stuff down to $ENOUGH usec resolution."
  33. echo ""
  34. echo "Hang on, we are calculating your timing overhead."
  35. ../bin/$OS/msleep 250
  36. TIMING_O=`../bin/$OS/timing_o`
  37. export TIMING_O
  38. echo "OK, it looks like your gettimeofday() costs $TIMING_O usecs."
  39. echo ""
  40. echo "Hang on, we are calculating your loop overhead."
  41. ../bin/$OS/msleep 250
  42. LOOP_O=`../bin/$OS/loop_o`
  43. export LOOP_O
  44. echo "OK, it looks like your benchmark loop costs $LOOP_O usecs."
  45. echo ""
  46. ############################################################################
  47. # Figure out memory size.
  48. ############################################################################
  49. if [ -r /proc/meminfo ]
  50. then
  51. TMP=`grep 'MemTotal:' /proc/meminfo | awk '{print $2}'`
  52. if [ X$TMP != X ]
  53. then MB=`echo \(\( $TMP / 1024 \) \* 7 \) / 10 | bc 2>/dev/null`
  54. if [ X$MB = X ]
  55. then MB=`expr $TMP / 1024 2>/dev/null`
  56. MB=`expr $MB \* 7`
  57. MB=`expr $MB / 10`
  58. fi
  59. fi
  60. TMP=`grep 'Mem\(Free\)\?:' /proc/meminfo | awk '{print $2}'`
  61. if [ X$MB = X -a X$TMP != X ]
  62. then MB=`echo \(\( $TMP / 1048576 \) \* 7 \) / 10 | bc 2>/dev/null`
  63. if [ X$MB = X ]
  64. then MB=`expr $TMP / 1048576 2>/dev/null`
  65. MB=`expr $MB \* 7`
  66. MB=`expr $MB / 10`
  67. fi
  68. fi
  69. fi
  70. if [ X$MB != X -a 0$MB -gt 1024 ]
  71. then MB=1024
  72. fi
  73. if [ X$MB = X ]
  74. then $ECHON "Probing system for available memory: $ECHOC"
  75. MB=`../bin/$OS/memsize 1024`
  76. fi
  77. echo $L
  78. cat<<EOF;
  79. Several benchmarks operate on a range of memory. This memory should be
  80. sized such that it is at least 4 times as big as the external cache[s]
  81. on your system. It should be no more than 80% of your physical memory.
  82. The bigger the range, the more accurate the results, but larger sizes
  83. take somewhat longer to run the benchmark.
  84. EOF
  85. echo $ECHON "MB [default $MB] $ECHOC"
  86. read TMP
  87. if [ X$TMP != X ]
  88. then MB=$TMP
  89. fi
  90. # Certain machines tend to barf when you try and bcopy 8MB.
  91. # Figure out how much we can use.
  92. echo "Checking to see if you have $MB MB; please wait for a moment..."
  93. AVAILMEM=`../bin/$OS/memsize $MB`
  94. AVAILMEM=`../bin/$OS/memsize $AVAILMEM`
  95. AVAILMEM=`../bin/$OS/memsize $AVAILMEM`
  96. if [ $AVAILMEM -lt 8 ]
  97. then echo $0 aborted: Not enough memory, only ${AVAILMEM}MB available.
  98. exit 1
  99. fi
  100. if [ $AVAILMEM -lt 16 ]
  101. then echo Warning: you have only ${AVAILMEM}MB available memory.
  102. echo Some benchmark results will be less meaningful.
  103. fi
  104. MB=`expr $AVAILMEM / 2`
  105. ############################################################################
  106. # Memory strides for lat_mem
  107. ############################################################################
  108. echo $L
  109. cat<<EOF;
  110. This benchmark measures, by default, memory latency for a number of
  111. different strides. That can take a long time and is most useful if you
  112. are trying to figure out your cache line size or if your cache line size
  113. is greater than 128 bytes.
  114. If you are planning on sending in these results, please don't do a fast
  115. run.
  116. If you are measuring software only, you probably want to do a fast run,
  117. so answer yes below. Answering yes means that we measure memory latency
  118. with a 128 byte stride.
  119. EOF
  120. echo $ECHON "FASTMEM [default no] $ECHOC"
  121. read fast
  122. case "$fast" in
  123. [yY]*) FASTMEM=YES;;
  124. *) FASTMEM=NO;;
  125. esac
  126. ############################################################################
  127. # File system latency
  128. ############################################################################
  129. echo $L
  130. cat<<EOF;
  131. This benchmark measures, by default, file system latency. That can
  132. take a long time on systems with old style file systems (i.e., UFS,
  133. FFS, etc.). Linux' ext2fs and Sun's tmpfs are fast enough that this
  134. test is not painful.
  135. If you are planning on sending in these results, please don't do a fast
  136. run.
  137. If you want to skip the file system latency tests, answer "yes" below.
  138. EOF
  139. echo $ECHON "SLOWFS [default no] $ECHOC"
  140. read slow
  141. case "$slow" in
  142. [yY]*) SLOWFS=YES;;
  143. *) SLOWFS=NO;;
  144. esac
  145. ############################################################################
  146. # Disk bandwidth/seek times
  147. ############################################################################
  148. echo $L
  149. cat<<EOF;
  150. This benchmark can measure disk zone bandwidths and seek times. These can
  151. be turned into whizzy graphs that pretty much tell you everything you might
  152. need to know about the performance of your disk.
  153. This takes a while and requires read access to a disk drive.
  154. Write is not measured, see disk.c to see how if you want to do so.
  155. If you want to skip the disk tests, hit return below.
  156. If you want to include disk tests, then specify the path to the disk
  157. device, such as /dev/sda. For each disk that is readable, you'll be
  158. prompted for a one line description of the drive, i.e.,
  159. Iomega IDE ZIP
  160. or
  161. HP C3725S 2GB on 10MB/sec NCR SCSI bus
  162. EOF
  163. echo $ECHON "DISKS [default none] $ECHOC"
  164. read disks
  165. if [ X"$disks" != X ]
  166. then
  167. for i in $disks
  168. do if [ -r $i ]
  169. then ../bin/$OS/flushdisk $i
  170. if [ $? -eq 1 ]
  171. then echo "Must be root to run disk benchmarks."
  172. echo "Root is needed to flush the buffer cache"
  173. exit 1
  174. fi
  175. echo $ECHON "$i is a $ECHOC"
  176. read x
  177. DISK_DESC="$DISK_DESC[${i}:${x}] "
  178. DISKS="$DISKS${i} "
  179. else echo "Can't read $i, skipping it."
  180. fi
  181. done
  182. fi
  183. ############################################################################
  184. # Processor speed
  185. ############################################################################
  186. echo $L
  187. echo ""
  188. echo "Calculating mhz, please wait for a moment..."
  189. MHZ=`../bin/$OS/mhz`
  190. cat<<EOF
  191. I think your CPU mhz is
  192. $MHZ
  193. but I am frequently wrong. If that is the wrong Mhz, type in your
  194. best guess as to your processor speed. It doesn't have to be exact,
  195. but if you know it is around 800, say 800.
  196. Type in just the Mhz part, like 3060 or 2800 for 3.06GHz or 2.8GHz P4s.
  197. EOF
  198. echo $ECHON "Processor mhz [default $MHZ] $ECHOC"
  199. read mhz
  200. if [ -n "$mhz" ]
  201. then MHZ=$mhz
  202. fi
  203. ############################################################################
  204. # /usr/tmp?
  205. ############################################################################
  206. echo $L
  207. AGAIN=Y
  208. while [ $AGAIN = Y ]
  209. do
  210. cat<<EOF;
  211. We need a place to store a $MB Mbyte file as well as create and delete a
  212. large number of small files. We default to /usr/tmp. If /usr/tmp is a
  213. memory resident file system (i.e., tmpfs), pick a different place.
  214. Please specify a directory that has enough space and is a local file
  215. system.
  216. EOF
  217. DEFAULTFSDIR=/usr/tmp
  218. for t in /usr/tmp /var/tmp /tmp; do
  219. if [ -d $t -a -w $t ]
  220. then DEFAULTFSDIR=$t
  221. break
  222. fi
  223. done
  224. echo $ECHON "FSDIR [default $DEFAULTFSDIR] $ECHOC"
  225. read FSDIR
  226. if [ X$FSDIR = X ]
  227. then FSDIR=$DEFAULTFSDIR
  228. fi
  229. if [ ! -d $FSDIR ]
  230. then mkdir -p $FSDIR 2>/dev/null
  231. fi
  232. if [ -d $FSDIR -a -w $FSDIR ]
  233. then AGAIN=N
  234. FILE=$FSDIR/XXX
  235. else echo $FSDIR is not a directory or is not writable
  236. fi
  237. done
  238. ############################################################################
  239. # Remote networking
  240. ############################################################################
  241. echo $L
  242. RSH=rsh
  243. for p in `echo $PATH | sed 's/:/ /g'`
  244. do if [ -f $p/remsh ]
  245. then RSH=remsh
  246. fi
  247. done
  248. RCP=rcp
  249. cat<<EOF;
  250. If you are running on an idle network and there are other, identically
  251. configured systems, on the same wire (no gateway between you and them),
  252. and you have rsh access to them, then you should run the network part
  253. of the benchmarks to them. Please specify any such systems as a space
  254. separated list such as: ether-host fddi-host hippi-host.
  255. EOF
  256. echo $ECHON "REMOTE [default none] $ECHOC"
  257. read REMOTE
  258. if [ "X$REMOTE" != X ]
  259. then cat<<EOF;
  260. Thanks for doing remote testing, that is a hard thing to get. In
  261. order to run a server on the remote system, we need a remote shell
  262. to be enabled (ideally without a password) from this host to $REMOTE.
  263. The original remote shell is rsh, but the use of a secure remote shell
  264. like ssh is increasingly common. We need the name of BOTH the shell
  265. itself and the associated copy tool (e.g. rcp vs scp) to be entered.
  266. EOF
  267. echo $ECHON "RSH [default $RSH] $ECHOC"
  268. read rsh
  269. if [ -n "$rsh" ]
  270. then RSH=$rsh
  271. fi
  272. echo $ECHON "RCP [default $RCP] $ECHOC"
  273. read rcp
  274. if [ -n "$rsh" ]
  275. then RCP=$rcp
  276. fi
  277. cat<<EOF;
  278. Could you do me one more favor and tell me the networking you think
  279. will be used to get to each of the remote hosts. By networking I
  280. mean one of the following (or whatever you use if you use something
  281. else):
  282. ethernet aka 10baseT, thinnet, thicknet, etc
  283. ethernet-100 aka 100baseT, 100VG
  284. fddi aka cddi
  285. hippi
  286. others?
  287. Please type it just like the above if you can, it makes parsing easier.
  288. EOF
  289. RSH=rsh
  290. case `uname -s` in
  291. *HP-UX*) RSH=remsh;;
  292. esac
  293. for r in $REMOTE
  294. do echo $ECHON "Network type for $r: $ECHOC"
  295. read n
  296. X=`$RSH $r echo foo`
  297. if [ X$X = Xfoo ]
  298. then echo Remote access to $r worked, thanks.
  299. else echo Remote access to $r did not work, please check and retry,
  300. exit 1
  301. fi
  302. NETWORKS="${NETWORKS}[ $r:$n ]"
  303. done
  304. fi
  305. ############################################################################
  306. # status output?
  307. ############################################################################
  308. echo $L
  309. cat<<EOF;
  310. lmbench outputs status information as it runs various benchmarks.
  311. By default this output is sent to /dev/tty, but you may redirect
  312. it to any file you wish (such as /dev/null...).
  313. EOF
  314. echo $ECHON "Status output file [default /dev/tty] $ECHOC"
  315. read OUTPUT
  316. if [ "X$OUTPUT" = X ]
  317. then OUTPUT=/dev/tty;
  318. fi
  319. ############################################################################
  320. # Submit results?
  321. ############################################################################
  322. echo $L
  323. cat<<EOF;
  324. There is a database of benchmark results that is shipped with new
  325. releases of lmbench. Your results can be included in the database
  326. if you wish. The more results the better, especially if they include
  327. remote networking. If your results are interesting, i.e., for a new
  328. fast box, they may be made available on the lmbench web page, which is
  329. http://www.bitmover.com/lmbench
  330. EOF
  331. echo $ECHON "Mail results [default yes] $ECHOC"
  332. read MAIL
  333. case $MAIL in
  334. [Nn]*) MAIL=no
  335. echo OK, no results mailed.
  336. ;;
  337. *) MAIL=yes
  338. ;;
  339. esac
  340. INFO=`../scripts/info`
  341. if [ $MAIL = yes ]
  342. then if [ ! -f ../bin/$OS/$INFO ]
  343. then cp ../scripts/info-template ../bin/$OS/$INFO
  344. chmod +w ../bin/$OS/$INFO
  345. REUSE=no
  346. else
  347. REUSE=view
  348. while [ $REUSE = view ]
  349. do echo ""
  350. echo $ECHON \
  351. "Reuse previous description [default yes, other options: no|view] $ECHOC"
  352. read REUSE
  353. case $REUSE in
  354. [Nn]*) REUSE=no
  355. ;;
  356. [Vv]*) REUSE=view
  357. echo $L
  358. more ../bin/$OS/$INFO
  359. echo $L
  360. ;;
  361. *) REUSE=yes
  362. ;;
  363. esac
  364. done
  365. fi
  366. if [ $REUSE = no ]
  367. then EDITOR=vi
  368. echo $L
  369. cat<<EOF;
  370. Please tell us about your machine. There is a form we would like you
  371. to fill out that we will make available with the results. If you would
  372. prefer to use a different editor, tell us the editor at the prompt.
  373. If you want to skip filling out this form (please don't) then answer
  374. "none" at the prompt.
  375. EOF
  376. echo $ECHON "Editor [default $EDITOR] $ECHOC"
  377. read TMP
  378. if [ X$TMP != X ]
  379. then EDITOR=$TMP
  380. fi
  381. if [ X$EDITOR != "none" ]
  382. then $EDITOR ../bin/$OS/`../scripts/info`
  383. fi
  384. fi
  385. fi
  386. echo $L
  387. echo ""
  388. echo "Configuration done, thanks."
  389. cat <<EOF
  390. There is a mailing list for discussing lmbench hosted at BitMover.
  391. Send mail to majordomo@bitmover.com to join the list.
  392. EOF
  393. VERSION=`../scripts/version`
  394. C=../bin/$OS/`../scripts/config`
  395. echo DISKS=\"$DISKS\"\; export DISKS > $C
  396. echo DISK_DESC=\"$DISK_DESC\"\; export DISK_DESC >> $C
  397. echo OUTPUT=$OUTPUT\; export OUTPUT >> $C
  398. echo ENOUGH=$ENOUGH\; export ENOUGH >> $C
  399. echo FASTMEM=\"$FASTMEM\"\; export FASTMEM >> $C
  400. echo FILE=$FILE\; export FILE >> $C
  401. echo FSDIR=$FSDIR\; export FSDIR >> $C
  402. echo INFO=$INFO\; export INFO >> $C
  403. echo LOOP_O=$LOOP_O\; export LOOP_O >> $C
  404. echo MAIL=$MAIL\; export MAIL >> $C
  405. echo MB=$MB\; export MB >> $C
  406. echo MHZ=\"$MHZ\"\; export MHZ >> $C
  407. echo MOTHERBOARD=\"$MOTHERBOARD\"\; export MOTHERBOARD >> $C
  408. echo NETWORKS=\"$NETWORKS\"\; export NETWORKS >> $C
  409. echo OS=\"$OS\"\; export OS >> $C
  410. echo PROCESSORS=\"$PROCESSORS\"\; export PROCESSORS >> $C
  411. echo REMOTE=\"$REMOTE\"\; export REMOTE >> $C
  412. echo SLOWFS=\"$SLOWFS\"\; export SLOWFS >> $C
  413. echo TIMING_O=$TIMING_O\; export TIMING_O >> $C
  414. echo RSH=$RSH\; export RSH >> $C
  415. echo RCP=$RCP\; export RCP >> $C
  416. echo VERSION=$VERSION\; export VERSION >> $C
  417. exit 0