├── ACKNOWLEDGEMENTS ├── CHANGES ├── COPYING ├── COPYING-2 ├── ChangeSet ├── Makefile ├── README ├── doc ├── Makefile ├── bargraph.1 ├── benchmarks ├── bw_allmem.tbl ├── bw_file_rd.8 ├── bw_ipc.tbl ├── bw_mem.8 ├── bw_mem_rd.8 ├── bw_mmap_rd.8 ├── bw_pipe.8 ├── bw_reread2.tbl ├── bw_tcp.8 ├── bw_tcp.tbl ├── bw_unix.8 ├── cache.8 ├── ctx.pic ├── ctx.tbl ├── description.ms ├── graph.1 ├── lat_allmem.tbl ├── lat_allproc.tbl ├── lat_connect.8 ├── lat_connect.tbl ├── lat_ctx.8 ├── lat_disk.tbl ├── lat_fcntl.8 ├── lat_fifo.8 ├── lat_fs.8 ├── lat_fs.tbl ├── lat_http.8 ├── lat_ipc.tbl ├── lat_mem_rd.8 ├── lat_mmap.8 ├── lat_nullsys.tbl ├── lat_ops.8 ├── lat_pagefault.8 ├── lat_pipe.8 ├── lat_pipe.tbl ├── lat_proc.8 ├── lat_rpc.8 ├── lat_select.8 ├── lat_sig.8 ├── lat_signal.tbl ├── lat_syscall.8 ├── lat_tcp.8 ├── lat_tcp.tbl ├── lat_udp.8 ├── lat_udp.tbl ├── lat_unix.8 ├── lat_unix_connect.8 ├── line.8 ├── lmbench.3 ├── lmbench.8 ├── lmbench3.ms ├── lmbench3_arch.fig ├── lmbench3_signals.fig ├── lmdd.8 ├── mem.pic ├── memhier-color.d ├── memhier-line.d ├── memhier-tlb.d ├── memhier.ms ├── mhz.8 ├── par_mem.8 ├── par_ops.8 ├── parallel.ms ├── pgraph.1 ├── rccs.1 ├── refdbms.keys ├── references ├── references- ├── references-lmbench3 ├── references-memhier ├── references-parallel ├── references-userguide ├── references.private ├── reporting.3 ├── results.3 ├── stream.8 ├── timing.3 ├── tlb.8 ├── tmac.usenix ├── usenix.ol ├── usenix96.ms └── userguide.ms ├── hbench-REBUTTAL ├── results └── Makefile ├── scripts ├── Makefile ├── README ├── SHIT ├── TODO ├── allctx ├── allmem ├── bargraph ├── bghtml ├── build ├── compiler ├── config ├── config-run ├── config-run-arc ├── config-scaling ├── depend ├── do_ctx ├── getbg ├── getbw ├── getctx ├── getdisk ├── getlist ├── getmax ├── getmem ├── getpercent ├── getresults ├── getsummary ├── gifs ├── gnu-os ├── graph ├── html-list ├── html-man ├── info ├── info-template ├── lmbench ├── make ├── man2html ├── mkrelease ├── new2oldctx ├── opercent ├── os ├── output ├── percent ├── rccs ├── results ├── results2excel.awk ├── save ├── stats ├── statsummary ├── synchronize ├── target ├── version └── xroff └── src ├── Makefile ├── TODO ├── bench.h ├── busy.c ├── bw_file_rd.c ├── bw_mem.c ├── bw_mmap_rd.c ├── bw_pipe.c ├── bw_tcp.c ├── bw_udp.c ├── bw_unix.c ├── cache.c ├── clock.c ├── disk.c ├── enough.c ├── flushdisk.c ├── getopt.c ├── hello.c ├── lat_cmd.c ├── lat_connect.c ├── lat_ctx.c ├── lat_dram_page.c ├── lat_fcntl.c ├── lat_fifo.c ├── lat_fs.c ├── lat_http.c ├── lat_mem_rd.c ├── lat_mmap.c ├── lat_ops.c ├── lat_pagefault.c ├── lat_pipe.c ├── lat_pmake.c ├── lat_proc.c ├── lat_rand.c ├── lat_rpc.c ├── lat_select.c ├── lat_sem.c ├── lat_sig.c ├── lat_syscall.c ├── lat_tcp.c ├── lat_udp.c ├── lat_unix.c ├── lat_unix_connect.c ├── lat_usleep.c ├── lib_debug.c ├── lib_debug.h ├── lib_mem.c ├── lib_mem.h ├── lib_sched.c ├── lib_stats.c ├── lib_tcp.c ├── lib_tcp.h ├── lib_timing.c ├── lib_udp.c ├── lib_udp.h ├── lib_unix.c ├── lib_unix.h ├── line.c ├── lmdd.1 ├── lmdd.c ├── lmhttp.c ├── loop_o.c ├── memsize.c ├── mhz.c ├── msleep.c ├── names.h ├── par_mem.c ├── par_ops.c ├── rhttp.c ├── seek.c ├── stats.h ├── stream.c ├── timing.h ├── timing_o.c ├── tlb.c ├── version.h └── webpage-lm.tar /ACKNOWLEDGEMENTS: -------------------------------------------------------------------------------- 1 | LMbench was originally developed by Larry McVoy while he worked 2 | at Sun Microsystems. Larry continued development while working 3 | at Silicon Graphics, and was joined by Carl Staelin, who works 4 | for Hewlett-Packard Laboratories. 5 | 6 | LMbench would not be the successful cross-platform benchmark 7 | that it is today without the efforts and assistance of a wide 8 | range of people. From volunteers who run it on various hardware 9 | and report bugs, to managers who provide financial and other 10 | support, to peers and colleagues who request features or 11 | provide feedback on design elements. All such help has been 12 | critical to making LMbench a success. 13 | 14 | Below is a partial list of all those people who helped support 15 | the development of LMbench in one form or other, such as 16 | benchmark suggestions, bug reports, and so forth. All omissions 17 | are accidental, and if your name was not included, please accept 18 | our humble apologies. 19 | 20 | The people who have helped LMbench include, in alphabetic 21 | order: 22 | 23 | Ralf Baechle, 24 | Christian Bau, 25 | Nelson H. F. Beebe, 26 | Anton Blanchard, 27 | Joel Berman, 28 | Paul Borrill, 29 | Ed Bradford, 30 | Len Brown, 31 | Robert G. Brown, 32 | Bruce Chapman, 33 | Tim Chen, 34 | Mark Culotta, 35 | Fred Douglis, 36 | Lars-Eke Eriksson, 37 | Josh Fisher, 38 | Marc Fleischmann, 39 | John Fort, 40 | Andy Glew, 41 | Achim Gratz, 42 | Richard Henderson, 43 | Rick Jones, 44 | Lev Iserovich, 45 | Michael A. Julier, 46 | Frans Kaashoek, 47 | Brad Knowles, 48 | Richard Littin, 49 | Bil Long, 50 | Udi Manber, 51 | John Mashey, 52 | David Miller, 53 | Dejan Milojicic, 54 | Ingo Molnar, 55 | David Mosberger, 56 | Will Newton, 57 | Satya Nishtala, 58 | Kevin Normoyle, 59 | Neal Nuckolls, 60 | Steve Piatz, 61 | Tim Prince, 62 | James Riden, 63 | Sam Roberts, 64 | Philip Roth, 65 | Chris Ruemmler, 66 | Olli Savia, 67 | Scott Schwartz, 68 | Wayne Scott, 69 | David Singleton, 70 | Mike Slifcak, 71 | Stephan Somogyi, 72 | Ratnakar Tiwari, 73 | Linus Torvalds, 74 | Dan Truong, 75 | Dirk Twiehaus, 76 | Duc Vianney, 77 | Ramya Vijay, 78 | Hai Vo-Ba, 79 | David T. Wang, 80 | Brian Whitney, 81 | David Wilson, 82 | Mitch Wright. 83 | 84 | -------------------------------------------------------------------------------- /CHANGES: -------------------------------------------------------------------------------- 1 | lmbench3-alpha1 2 | Added new benchmark line, which determines the cache line size 3 | 4 | Added new benchmark tlb, which determines the effective TLB size. 5 | Note that this may differ from the hardware TLB size due to OS 6 | TLB entries and super-pages. 7 | 8 | Added new benchmark par_mem, which determines the possible 9 | speedup due to multiple memory reads progressing in parallel. 10 | This number usually depends highly on the portion of the 11 | memory hierarchy being probed, with higher caches generally 12 | having greater parallelism. 13 | 14 | Added new benchmark cache, which determines the number of caches, 15 | their sizes, latency, and available parallelism. It also 16 | reports the latency and available parallelism for main memory. 17 | 18 | Added new benchmark lat_ops, which attempts to determine the 19 | latency of basic operations, such as add, multiply and divide, 20 | for a variety of data types, such as int, int64, float and 21 | double. 22 | 23 | Added new benchmark par_ops, which attempts to determine the 24 | available scaling of the various basic operations for various 25 | data types. 26 | 27 | Added new benchmark stream, which reports memory bandwidth 28 | numbers using benchmark kernels from John McCalpin's STREAM 29 | and STREAM version 2 benchmarks. 30 | 31 | Added new benchmark lat_sem, which reports SysV semaphore latency. 32 | 33 | Added getopt() command line parsing to most benchmarks. 34 | 35 | Added a new benchmark timing harness, benchmp(), which makes 36 | it relatively easy to design and build benchmarks which 37 | measure system performance under a fixed load. It takes 38 | a few parameters: 39 | - initialize: a function pointer. If this is non-NULL 40 | the function is called in the child processes after 41 | the fork but before any benchmark-related work is 42 | done. The function is passed a cookie from the 43 | benchmp() call. This can be a pointer to a 44 | data structure which lets the function know what 45 | it needs to do. 46 | - benchmark: a function pointer. This function 47 | takes two parameters, an iteration count "iters", 48 | and a cookie. The benchmarked activity must be 49 | run "iters" times (or some integer multiple of 50 | "iters". This function must be idempotent; ie., 51 | the benchmark harness must be able to call it 52 | as many times as necessary. 53 | - cleanup: a function pointer. If this is non-NULL 54 | the function is called after all benchmarking is 55 | completed to cleanup any resources that may have 56 | been allocated. 57 | - enough: If this is non-zero then it is the minimum 58 | amount of time, in micro-seconds, that the benchmark 59 | must be run to provide reliable results. In most 60 | cases this is left to zero to allow the harness to 61 | autoscale the timing intervals to the system clock's 62 | resolution/accuracy. 63 | - parallel: this is the number of child processes 64 | running the benchmark that should be run in parallel. 65 | This is really the load factor. 66 | - warmup: a time period in micro-seconds that each 67 | child process must run the benchmarked process 68 | before any timing intervals can begin. This is 69 | to allow the system scheduler time to settle in 70 | a parallel/distributed system before we begin 71 | measurements. (If so desired) 72 | - repetitions: If non-zero this is the number of 73 | times we need to repeat each measurement. The 74 | default is 11. 75 | - cookie: An opaque value which can be used to 76 | pass information to the initialize(), benchmark(), 77 | and cleanup() routines. 78 | This new harness is now used by: bw_file_rd, bw_mem, bw_mmap_rd, 79 | bw_pipe, bw_tcp, bw_unix, lat_connect, lat_ctx, lat_fcntl, 80 | lat_fifo, lat_mem_rd, lat_mmap, lat_ops, lat_pagefault, lat_pipe, 81 | lat_proc, lat_rpc, lat_select, lat_sem, lat_sig, lat_syscall, 82 | lat_tcp, lat_udp, lat_unix, lat_unix_connect, and stream. 83 | -------------------------------------------------------------------------------- /ChangeSet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foss-for-synopsys-dwc-arc-processors/lmbench/670e2013157340ebcb20a04c174765b666f3bc13/ChangeSet -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for top level of lmbench 2 | # $Id$ 3 | 4 | # Possible things to $(MAKE): 5 | # 6 | # build (default) go to the source directory and build the benchmark 7 | # results go to the source directory and build and run the benchmark 8 | # rerun run the benchmark again 9 | # see see the results that came with this release 10 | # Go to the results directory and read the Makefile. 11 | # doc.lpr print the documentation 12 | # doc.x preview the documentation (needs X, groff, pic, etc) 13 | # clean go to the subdirs and $(MAKE) clean 14 | # get $(MAKE) sure all files are checked out 15 | # shar build a shippable shar archive 16 | 17 | SHELL=/bin/sh 18 | 19 | build: 20 | cd src && $(MAKE) 21 | 22 | results: FRC 23 | cd src && $(MAKE) results 24 | 25 | rerun: 26 | cd src && $(MAKE) rerun 27 | 28 | see: 29 | cd results && $(MAKE) summary >summary.out 2>summary.errs 30 | cd results && $(MAKE) percent >percent.out 2>percent.errs 31 | 32 | doc.lpr: 33 | cd doc && $(MAKE) PS && lpr *.PS 34 | 35 | doc.x: 36 | cd doc && $(MAKE) x 37 | 38 | clobber clean: 39 | for i in doc src results scripts; do \ 40 | echo ===== $$i =====; \ 41 | (cd $$i && $(MAKE) clean); \ 42 | done 43 | /bin/rm -rf bin/* 44 | -bk clean 45 | 46 | get: 47 | for i in doc src results scripts; do \ 48 | echo ===== $$i =====; \ 49 | (cd $$i && bk get -q); \ 50 | done 51 | @co -q 52 | 53 | info: 54 | for i in doc src results scripts; do \ 55 | echo ===== $$i =====; \ 56 | (cd $$i && info); \ 57 | done 58 | 59 | release: scripts/mkrelease 60 | scripts/mkrelease 61 | 62 | scripts/mkrelease: 63 | cd scripts && co mkrelease 64 | 65 | # XXX - . must be named lmbench for this to work 66 | shar: 67 | $(MAKE) clean 68 | co -q Makefile 69 | $(MAKE) get 70 | cd .. && \ 71 | find lmbench -type f -print | egrep -v 'noship|RCS' > /tmp/FILES 72 | cd .. && shar -S -a -n lmbench1.0 -L 50K < /tmp/FILES 73 | 74 | FRC: 75 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README for lmbench 2alpha8 net release. 2 | 3 | To run the benchmark, you should be able to say: 4 | 5 | cd src 6 | make results 7 | 8 | If you want to see how you did compared to the other system results 9 | included here, say 10 | 11 | make see 12 | 13 | Be warned that many of these benchmarks are sensitive to other things 14 | being run on the system, mainly from CPU cache and CPU cycle effects. 15 | So make sure your screen saver is not running, etc. 16 | 17 | It's a good idea to do several runs and compare the output like so 18 | 19 | make results 20 | make rerun 21 | make rerun 22 | make rerun 23 | cd Results && make LIST=/* 24 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for lmbench doc subdir. 2 | # $Id$ 3 | 4 | SHELL=/bin/sh 5 | DESC = description.ms 6 | USENIX = tmac.usenix usenix96.ms 7 | PIC = ctx.pic mem.pic 8 | SCRIPTS = ../scripts/ 9 | BASE=/usr/local 10 | MANDIR=${BASE}/man 11 | 12 | MAN = \ 13 | bargraph.1 graph.1 \ 14 | lmbench.3 reporting.3 results.3 timing.3 \ 15 | lmbench.8 mhz.8 cache.8 line.8 tlb.8 lmdd.8 \ 16 | lat_proc.8 lat_mmap.8 lat_ctx.8 lat_syscall.8 lat_pipe.8 \ 17 | lat_http.8 lat_tcp.8 lat_udp.8 lat_rpc.8 lat_connect.8 lat_fs.8 \ 18 | lat_ops.8 lat_pagefault.8 lat_mem_rd.8 lat_select.8 \ 19 | lat_fifo.8 lat_fcntl.8 lat_sig.8 lat_unix.8 lat_unix_connect.8 \ 20 | bw_file_rd.8 bw_mem.8 bw_mmap_rd.8 \ 21 | bw_pipe.8 bw_tcp.8 bw_unix.8 \ 22 | par_ops.8 par_mem.8 23 | 24 | ALL = $(DESC) $(USENIX) $(PIC) $(MAN) $(REFER) references 25 | 26 | .SUFFIXES: .pic .fig 27 | 28 | .fig.pic: 29 | fig2dev -L pic $< $*.pic 30 | 31 | PS ps: $(ALL) 32 | gindxbib references 33 | groff -t -e -G -s -p -R $(USENIX) > USENIX.PS 34 | #groff -s -p -mgs $(DESC) > DESC.PS 35 | #groff -fH -man $(MAN) > MAN.PS 36 | 37 | X x: $(ALL) 38 | gindxbib references 39 | $(SCRIPTS)xroff -t -e -s -p -R $(USENIX) 40 | #$(SCRIPTS)xroff -s -p -mgs $(DESC) 41 | #$(SCRIPTS)xroff -man -fH $(MAN) 42 | 43 | text: $(ALL) 44 | gindxbib references 45 | gsoelim usenix96.ms | sed "s/expand doublebox/center/" | \ 46 | sed s/doublebox// > Fixed.ms 47 | groff -Tascii -t -e -s -p -R -mgs Fixed.ms 2>/dev/null | colcrt - | more 48 | 49 | userguide.ps: $(ALL) references-userguide userguide.ms \ 50 | lmbench3_arch.pic lmbench3_signals.pic ctx.tbl \ 51 | bw_allmem.tbl bw_ipc.tbl bw_reread2.tbl bw_tcp.tbl \ 52 | lat_allmem.tbl lat_allproc.tbl lat_connect.tbl \ 53 | lat_disk.tbl lat_fs.tbl lat_ipc.tbl lat_nullsys.tbl \ 54 | lat_pipe.tbl lat_signal.tbl lat_tcp.tbl lat_udp.tbl 55 | gindxbib references-userguide 56 | groff -t -e -G -s -p -R tmac.usenix userguide.ms > userguide.ps 57 | 58 | memhier.ps: $(ALL) memhier-color.d memhier-tlb.d memhier-line.d references-memhier memhier.ms 59 | gindxbib references-memhier 60 | groff -G -t -e -s -p -R tmac.usenix memhier.ms > memhier.ps 61 | # ../scripts/graph -xm -logx -small -below -nomarks -nospace memhier-color.graph > memhier-color.pic 62 | # ../scripts/graph -xm -logx -small -below -nomarks -nospace memhier-line.graph > memhier-line.pic 63 | # ../scripts/graph -logx -small -below -nomarks -nospace memhier-tlb.graph > memhier-tlb.pic 64 | 65 | lmbench3.ps: $(ALL) references-lmbench3 lmbench3.ms \ 66 | lmbench3_arch.pic lmbench3_signals.pic 67 | gindxbib references-lmbench3 68 | groff -G -t -e -s -p -R tmac.usenix lmbench3.ms > lmbench3.ps 69 | 70 | parallel.ps: $(ALL) references-parallel parallel.ms 71 | gindxbib references-parallel 72 | groff -G -t -e -s -p -R tmac.usenix parallel.ms > parallel.ps 73 | 74 | install: $(MAN) 75 | for f in $(MAN); do \ 76 | for s in 1 2 3 4 5 6 7 8 9; do \ 77 | if [ ! -d ${MANDIR}/man$${s} ]; then \ 78 | mkdir -p ${MANDIR}/man$${s}; \ 79 | fi; \ 80 | base=`basename $${f} .$${s}`; \ 81 | if [ "$${base}.$${s}" = "$$f" ]; then \ 82 | cp $$f ${MANDIR}/man$${s}/; \ 83 | fi; \ 84 | done; \ 85 | done 86 | 87 | get: $(ALL) 88 | 89 | edit: 90 | get -e -s $(ALL) 91 | 92 | $(MAN): 93 | get -s $(MAN) 94 | 95 | $(PIC): 96 | get -s $(PIC) 97 | 98 | $(DESC): 99 | get -s $(DESC) 100 | 101 | $(USENIX): 102 | get -s $(USENIX) 103 | 104 | clean: 105 | -bk clean 106 | /bin/rm -f *.PS XXX bw.pic memrd_bcopy_comp.pic references.i 107 | -------------------------------------------------------------------------------- /doc/benchmarks: -------------------------------------------------------------------------------- 1 | Theme 2 | Data movement and the cost thereof 3 | Latency 4 | Time per operation 5 | CPU cycles per operation 6 | Bandwidth 7 | MB / sec 8 | CPU cycles / MB 9 | Media 10 | Memory (load, bcopy) 11 | Disk (randoms, sequentials) 12 | File system (directory ops, sequential) 13 | Network (hot potato, transfer) 14 | Pipes (hot potato, transfer) 15 | VM system (mmaps/munmaps, bcopy) 16 | Systems 17 | All Unix systems 18 | Windows NT 19 | VMS (?) 20 | Mainframes (?) 21 | Memory 22 | Small transfers (randoms) 23 | Load latency 24 | Large transfers (sequential) 25 | Bcopy bandwidth 26 | Processes 27 | Null process execution time 28 | Context switching 29 | Misc 30 | Null entry into the system 31 | Networking 32 | Small transfers (randoms) 33 | Transfers per second 34 | CPU cycles per transfer 35 | socket/bind/close per second 36 | Large transfers (sequential) 37 | MB per second 38 | CPU cycles per MB 39 | Disks 40 | Small transfers (randoms) 41 | Transfers per second 42 | CPU cycles per transfer 43 | Large transfers (sequential) 44 | MB per second 45 | CPU cycles per MB 46 | File system 47 | Small transfers (randoms) 48 | Creates / second 49 | Removes / second 50 | Random I/O's per second in large file 51 | CPU cycles per transfer 52 | MB / sec when reading many related small files 53 | Large files 54 | MB / second read/write 55 | CPU cycles per MB 56 | Hardness 57 | Measure fsck time? 58 | Virtual memory system 59 | Creation 60 | mmaps per second 61 | munmaps per second 62 | Also vary size of mapped region 63 | Small transfers (randoms) 64 | Random reads per second of large mmaped file 65 | CPU cycles per read 66 | Large transfers (cached sequential) 67 | MB per second read rate 68 | CPU cycles per MB 69 | -------------------------------------------------------------------------------- /doc/bw_allmem.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | c|c s|c s 5 | l|c c|c c 6 | l|r r|r r. 7 | Bcopy Memory 8 | System \fBunrolled\fP libc read write 9 | = 10 | DEC Alpha 41 39 76 78\ 11 | DEC Alpha 46 46 88 91\ 12 | DEC Alpha 46 45 79 91\ 13 | DEC Alpha 38 40 69 84\ 14 | SunOS-5.4 sun4d 22 21 47 38\ 15 | DEC Alpha 36 36 55 72\ 16 | DEC Alpha 38 38 64 79\ 17 | SunOS-5.4 sun4m 25 23 64 51\ 18 | SunOS-5.4 sun4m 24 23 59 40\ 19 | SunOS-5.4 sun4d 16 14 36 28\ 20 | SunOS-5.4 sun4m 31 26 80 62\ 21 | Sun SC1000 17 15 38 31\ 22 | Sun Ultra1 85 167 129 152\ 23 | Linux alpha 40 40 74 72\ 24 | Linux i686 42 57 205 56\ 25 | Linux i586 30 31 61 50\ 26 | Linux alpha 39 39 73 71\ 27 | Unixware/i686 65 55 214 86\ 28 | Linux i586 38 42 74 75\ 29 | IBM Power2 242 171 205 364\ 30 | IBM PowerPC 21 21 63 26\ 31 | dgux mc88110 17 17 37 19\ 32 | DEC Alpha 15 15 46 20\ 33 | IRIX64 IP21 68 70 92 90\ 34 | IRIX64-601 IP26 41 32 65 61\ 35 | Linux i586 38 41 74 75\ 36 | Linux i586 20 21 60 31\ 37 | Linux i586 20 21 58 30\ 38 | Linux i586 20 21 60 31\ 39 | Linux i486 16 17 33 41\ 40 | HP-UX 9000/819 55 48 97 89\ 41 | FreeBSD/i586 39 42 73 83\ 42 | FreeBSD/i586 38 41 65 83\ 43 | FreeBSD/i586 38 41 65 83\ 44 | HP-UX 9000/735 32 26 55 52\ 45 | HP-UX 9000/735 32 26 54 51\ 46 | FreeBSD/i586 36 40 62 83\ 47 | IRIX64 IP25 53 41 87 72\ 48 | IRIX64 IP19 32 34 65 67\ 49 | HP-UX 9000/735 31 26 53 51\ 50 | HP-UX 9000/735 32 26 53 51\ 51 | HP-UX 9000/755 31 25 49 52\ 52 | HP-UX 9000/770 31 33 56 61\ 53 | HP-UX 9000/897 19 19 40 37\ 54 | IRIX64 IP19 35 36 65 67\ 55 | IRIX IP19 33 34 67 72\ 56 | IRIX5.3 IP19 32 34 65 68\ 57 | IRIX IP22 32 33 68 72\ 58 | IRIX5.3 IP22 31 32 69 66\ 59 | FreeBSD/i586 39 42 65 83\ 60 | .TE 61 | .KE 62 | -------------------------------------------------------------------------------- /doc/bw_file_rd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_FILE_RD 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | bw_file_rd \- time the reading and summing of a file 5 | .SH SYNOPSIS 6 | .B bw_file_rd 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I size 17 | .I file 18 | .SH DESCRIPTION 19 | .B bw_file_rd 20 | times the read of the specified file in 64KB blocks. Each block is summed 21 | up as a seried of 4 byte integers in an unrolled loop. 22 | Results are reported in megabytes read per second. 23 | .LP 24 | The data is not accessed in the user program; the benchmark relies on 25 | the operating systems read interface to have actually moved the data. 26 | Systems that implement page flipping may fool this benchmark. 27 | .LP 28 | The benchmark is intended to be used on a file 29 | that is in memory, i.e., the benchmark is a reread benchmark. Other 30 | file benchmarking can be done with 31 | .BR lmdd (8). 32 | .LP 33 | The size 34 | specification may end with ``k'' or ``m'' to mean 35 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 36 | .SH OUTPUT 37 | Output format is \f(CB"%0.2f %.2f\\n", megabytes, megabytes_per_second\fP, i.e., 38 | .sp 39 | .ft CB 40 | 8.00 25.33 41 | .ft 42 | .SH MEMORY UTILIZATION 43 | This benchmark can move up to three times the requested memory. Most Unix 44 | systems implement the read system call as a bcopy from kernel space 45 | to user space. Bcopy will use 2-3 times as much memory bandwidth: 46 | there is one read from the source and a write to the destionation. The 47 | write usually results in a cache line read and then a write back of 48 | the cache line at some later point. Memory utilization might be reduced 49 | by 1/3 if the processor architecture implemented ``load cache line'' 50 | and ``store cache line'' instructions (as well as ``getcachelinesize''). 51 | .SH ACKNOWLEDGEMENT 52 | Funding for the development of 53 | this tool was provided by Sun Microsystems Computer Corporation. 54 | .SH "SEE ALSO" 55 | lmbench(8). 56 | .SH "AUTHOR" 57 | Carl Staelin and Larry McVoy 58 | .PP 59 | Comments, suggestions, and bug reports are always welcome. 60 | -------------------------------------------------------------------------------- /doc/bw_ipc.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c c 5 | l r r r. 6 | System bcopy \fBpipe\fP TCP 7 | = 8 | DEC Alpha 36 32 9\ 9 | DEC Alpha 46 54 11\ 10 | DEC Alpha 38 23 7\ 11 | DEC Alpha 45 35 9\ 12 | DEC Alpha 39 32 12\ 13 | Linux alpha 39 73 9\ 14 | Sun Ultra1 167 61 51\ 15 | SunOS-5.4 sun4m 26 11 11\ 16 | SunOS-5.4 sun4m 23 24 19\ 17 | DEC Alpha 40 24 6\ 18 | DEC Alpha 15 17 4\ 19 | Linux alpha 40 73 9\ 20 | Linux i586 42 34 7\ 21 | Linux i486 17 16 6\ 22 | Linux i586 31 24 3\ 23 | IBM Power2 171 84 10\ 24 | IBM PowerPC 21 30 17\ 25 | SunOS-5.4 sun4d 14 7 8\ 26 | HP-UX 9000/735 26 37 24\ 27 | SunOS-5.4 sun4m 23 7 9\ 28 | Linux i686 57 73 15\ 29 | Linux i586 41 22 5\ 30 | Linux i586 21 19 3\ 31 | Linux i586 21 18 3\ 32 | Linux i586 21 12 3\ 33 | Sun SC1000 15 9 11\ 34 | SunOS-5.4 sun4d 21 8 9\ 35 | IRIX5.3 IP22 32 34 22\ 36 | IRIX64-601 IP26 32 37 22\ 37 | HP-UX 9000/770 33 53 21\ 38 | HP-UX 9000/819 48 37 28\ 39 | HP-UX 9000/755 25 38 35\ 40 | IRIX IP22 33 32 7\ 41 | IRIX64 IP21 70 28 19\ 42 | HP-UX 9000/735 26 44 20\ 43 | HP-UX 9000/735 26 42 18\ 44 | HP-UX 9000/735 26 39 19\ 45 | IRIX64 IP25 41 40 26\ 46 | IRIX64 IP19 34 27 19\ 47 | IRIX64 IP19 36 17 31\ 48 | IRIX IP19 34 14 16\ 49 | IRIX5.3 IP19 34 12 12\ 50 | HP-UX 9000/897 19 26 17\ 51 | dgux mc88110 17 8 5\ 52 | .TE 53 | .KE 54 | -------------------------------------------------------------------------------- /doc/bw_mem.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_MEM 8 "$Date$" "(c)1994-2000 Larry McVoy and Carl Staelin" "LMBENCH" 3 | .SH NAME 4 | bw_mem \- time memory bandwidth 5 | .SH SYNOPSIS 6 | .B bw_mem_cp 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I size 17 | .I rd|wr|rdwr|cp|fwr|frd|bzero|bcopy 18 | .I [align] 19 | .SH DESCRIPTION 20 | .B bw_mem 21 | allocates twice the specified amount of memory, zeros it, and then times 22 | the copying of the first half to the second half. Results are reported 23 | in megabytes moved per second. 24 | .LP 25 | The size 26 | specification may end with ``k'' or ``m'' to mean 27 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 28 | .SH OUTPUT 29 | Output format is \f(CB"%0.2f %.2f\\n", megabytes, megabytes_per_second\fP, i.e., 30 | .sp 31 | .ft CB 32 | 8.00 25.33 33 | .ft 34 | .LP 35 | There are nine different memory benchmarks in 36 | .BR bw_mem . 37 | They each measure slightly different methods for reading, writing or 38 | copying data. 39 | .TP 40 | .B "rd" 41 | measures the time to read data into the processor. It computes the 42 | sum of an array of integer values. It accesses every fourth word. 43 | .TP 44 | .B "wr" 45 | measures the time to write data to memory. It assigns a constant 46 | value to each memory of an array of integer values. 47 | It accesses every fourth word. 48 | .TP 49 | .B "rdwr" 50 | measures the time to read data into memory and then write data to 51 | the same memory location. For each element in an array it adds 52 | the current value to a running sum before assigning a new (constant) 53 | value to the element. 54 | It accesses every fourth word. 55 | .TP 56 | .B "cp" 57 | measures the time to copy data from one location to another. It 58 | does an array copy: dest[i] = source[i]. 59 | It accesses every fourth word. 60 | .TP 61 | .B "frd" 62 | measures the time to read data into the processor. It computes the 63 | sum of an array of integer values. 64 | .TP 65 | .B "fwr" 66 | measures the time to write data to memory. It assigns a constant 67 | value to each memory of an array of integer values. 68 | .TP 69 | .B "fcp" 70 | measures the time to copy data from one location to another. It 71 | does an array copy: dest[i] = source[i]. 72 | .TP 73 | .B "bzero" 74 | measures how fast the system can 75 | .I bzero 76 | memory. 77 | .TP 78 | .B "bcopy" 79 | measures how fast the system can 80 | .I bcopy 81 | data. 82 | .SH MEMORY UTILIZATION 83 | This benchmark can move up to three times the requested memory. 84 | Bcopy will use 2-3 times as much memory bandwidth: 85 | there is one read from the source and a write to the destionation. The 86 | write usually results in a cache line read and then a write back of 87 | the cache line at some later point. Memory utilization might be reduced 88 | by 1/3 if the processor architecture implemented ``load cache line'' 89 | and ``store cache line'' instructions (as well as ``getcachelinesize''). 90 | .SH "SEE ALSO" 91 | lmbench(8). 92 | .SH "AUTHOR" 93 | Carl Staelin and Larry McVoy 94 | .PP 95 | Comments, suggestions, and bug reports are always welcome. 96 | -------------------------------------------------------------------------------- /doc/bw_mem_rd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_MEM_RD 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | bw_mem_rd \- time memory read rate (with overhead) 5 | .SH SYNOPSIS 6 | .B bw_mem_rd 7 | .I size 8 | .SH DESCRIPTION 9 | .B bw_mem_rd 10 | allocates the specified amount of memory, zeros it, and then times the 11 | reading of that memory as a series of integer loads and adds. Each 12 | four byte integer is loaded and added to accumulator. 13 | .LP 14 | The size 15 | specification may end with ``k'' or ``m'' to mean 16 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 17 | .SH OUTPUT 18 | Output format is \f(CB"%0.2f %.2f\\n", megabytes, megabytes_per_second\fP, i.e., 19 | .sp 20 | .ft CB 21 | 8.00 25.33 22 | .ft 23 | .SH MEMORY UTILIZATION 24 | This benchmark should move approximately the reported amount of memory. 25 | .SH ACKNOWLEDGEMENT 26 | Funding for the development of 27 | this tool was provided by Sun Microsystems Computer Corporation. 28 | .SH "SEE ALSO" 29 | lmbench(8). 30 | -------------------------------------------------------------------------------- /doc/bw_mmap_rd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_MMAP_RD 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | bw_mmap_rd \- time the reading and summing of a file 5 | .SH SYNOPSIS 6 | .B bw_mmap_rd 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I size 17 | .I file 18 | .SH DESCRIPTION 19 | .B bw_mmap_rd 20 | creates a memory mapping to the file and then reads the mapping in an unrolled 21 | loop similar to that used in bw_mem_rd(8). 22 | The benchmark is intended to be used on a file 23 | that is in memory, i.e., the benchmark is a reread benchmark. Other 24 | file benchmarking can be done with 25 | .BR lmdd (8). 26 | .LP 27 | The size 28 | specification may end with ``k'' or ``m'' to mean 29 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 30 | .SH OUTPUT 31 | Output format is \f(CB"%0.2f %.2f\\n", megabytes, megabytes_per_second\fP, i.e., 32 | .sp 33 | .ft CB 34 | 8.00 25.33 35 | .ft 36 | .SH MEMORY UTILIZATION 37 | This benchmark should move approximately the reported amount of memory. 38 | .SH ACKNOWLEDGEMENT 39 | Funding for the development of 40 | this tool was provided by Sun Microsystems Computer Corporation. 41 | .SH "SEE ALSO" 42 | lmbench(8). 43 | .SH "AUTHOR" 44 | Carl Staelin and Larry McVoy 45 | .PP 46 | Comments, suggestions, and bug reports are always welcome. 47 | -------------------------------------------------------------------------------- /doc/bw_pipe.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_PIPE 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | bw_pipe \- time data movement through pipes 5 | .SH SYNOPSIS 6 | .B bw_pipe 7 | [ 8 | .I "-m " 9 | ] 10 | [ 11 | .I "-M " 12 | ] 13 | [ 14 | .I "-P " 15 | ] 16 | [ 17 | .I "-W " 18 | ] 19 | [ 20 | .I "-N " 21 | ] 22 | .SH DESCRIPTION 23 | .B bw_pipe 24 | creates a Unix pipe between two processes and moves 25 | .I "total bytes" 26 | through the pipe in 27 | .I "message size" 28 | chunks (note that pipes are typically sized smaller than that). 29 | The default 30 | .I "total bytes" 31 | is 10MB and the default 32 | .I "message size" 33 | is 64KB. 34 | .SH OUTPUT 35 | Output format is \f(CB"Pipe bandwidth: %0.2f MB/sec\\n", megabytes_per_second\fP, i.e., 36 | .sp 37 | .ft CB 38 | Pipe bandwidth: 4.87 MB/sec 39 | .ft 40 | .SH MEMORY UTILIZATION 41 | This benchmark can move up to six times the requested memory per process. 42 | There are two processes, the sender and the receiver. 43 | Most Unix 44 | systems implement the read/write system calls as a bcopy from/to kernel space 45 | to/from user space. Bcopy will use 2-3 times as much memory bandwidth: 46 | there is one read from the source and a write to the destionation. The 47 | write usually results in a cache line read and then a write back of 48 | the cache line at some later point. Memory utilization might be reduced 49 | by 1/3 if the processor architecture implemented "load cache line" 50 | and "store cache line" instructions (as well as getcachelinesize). 51 | .SH ACKNOWLEDGEMENT 52 | Funding for the development of 53 | this tool was provided by Sun Microsystems Computer Corporation. 54 | .SH "SEE ALSO" 55 | lmbench(8). 56 | .SH "AUTHOR" 57 | Carl Staelin and Larry McVoy 58 | .PP 59 | Comments, suggestions, and bug reports are always welcome. 60 | -------------------------------------------------------------------------------- /doc/bw_reread2.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | c|c c|c c 5 | l|c c|c c 6 | l|r r|r r. 7 | Libc \fBFile\fP Memory File 8 | System bcopy \fBread\fP read mmap 9 | = 10 | DEC Alpha 38 37 64 12\ 11 | DEC Alpha 45 40 79 50\ 12 | DEC Alpha 36 36 55 19\ 13 | DEC Alpha 40 44 69 14\ 14 | DEC Alpha 46 48 88 26\ 15 | DEC Alpha 39 39 76 23\ 16 | SunOS-5.4 sun4m 23 31 59 31\ 17 | SunOS-5.4 sun4m 26 23 80 30\ 18 | SunOS-5.4 sun4d 14 23 36 25\ 19 | SunOS-5.4 sun4d 21 23 47 17\ 20 | Sun SC1000 15 20 38 28\ 21 | DEC Alpha 15 20 46 14\ 22 | Sun Ultra1 167 85 129 101\ 23 | Linux alpha 40 25 74 23\ 24 | Linux i586 31 17 61 14\ 25 | SunOS-5.4 sun4m 23 21 64 39\ 26 | Linux alpha 39 24 73 18\ 27 | Unixware/i686 55 53 214 198\ 28 | Linux i586 42 23 74 9\ 29 | IBM Power2 171 187 205 106\ 30 | IBM PowerPC 21 40 63 51\ 31 | Linux i486 17 9 33 10\ 32 | IRIX64 IP21 70 65 92 72\ 33 | Linux i686 57 46 205 34\ 34 | IRIX64-601 IP26 32 75 65 56\ 35 | Linux i586 41 21 74 13\ 36 | Linux i586 21 14 60 11\ 37 | Linux i586 21 14 58 10\ 38 | Linux i586 21 13 60 8\ 39 | HP-UX 9000/735 26 47 55 36\ 40 | HP-UX 9000/819 48 64 97 41\ 41 | HP-UX 9000/755 25 45 49 32\ 42 | FreeBSD/i586 42 38 65 49\ 43 | FreeBSD/i586 42 30 73 54\ 44 | FreeBSD/i586 41 29 65 46\ 45 | IRIX64 IP19 34 34 65 56\ 46 | FreeBSD/i586 40 28 62 47\ 47 | IRIX64 IP25 41 60 87 76\ 48 | HP-UX 9000/735 26 43 53 33\ 49 | HP-UX 9000/735 26 43 54 34\ 50 | HP-UX 9000/735 26 43 53 35\ 51 | HP-UX 9000/770 33 43 56 37\ 52 | HP-UX 9000/897 19 39 40 28\ 53 | FreeBSD/i586 41 29 65 50\ 54 | dgux mc88110 17 16 37 13\ 55 | IRIX5.3 IP22 32 32 69 44\ 56 | IRIX IP19 34 39 67 43\ 57 | IRIX64 IP19 36 36 65 56\ 58 | IRIX5.3 IP19 34 36 65 43\ 59 | IRIX IP22 33 37 68 48\ 60 | .TE 61 | .KE 62 | -------------------------------------------------------------------------------- /doc/bw_tcp.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_TCP 1 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | bw_tcp \- time data movement through TCP/IP sockets 5 | .SH SYNOPSIS 6 | .B bw_tcp 7 | [ 8 | .I "-m " 9 | ] 10 | [ 11 | .I "-M " 12 | ] 13 | [ 14 | .I "-P " 15 | ] 16 | [ 17 | .I "-W " 18 | ] 19 | [ 20 | .I "-N " 21 | ] 22 | .I "server" 23 | .br or 24 | .B bw_tcp 25 | .I -s 26 | .br or 27 | .B bw_tcp 28 | .I "-S " 29 | .SH DESCRIPTION 30 | .B bw_tcp 31 | is a client/server program that moves data over a TCP/IP socket. Nothing is 32 | done with the data on either side; 33 | .I "total bytes" 34 | of data is moved in 35 | .I "message size" 36 | chunks. 37 | .LP 38 | .B bw_tcp 39 | has three forms of usage: as a server (-s), as a client (bw_tcp localhost), and 40 | as a shutdown (bw_tcp -S localhost). 41 | .LP 42 | The default amount of data is 10MB. The client form may specify a different 43 | amount of data. Specifications may end with ``k'' or ``m'' to mean 44 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 45 | .SH OUTPUT 46 | Output format is 47 | .ft CB 48 | Socket bandwidth using localhost: 2.32 MB/sec 49 | .ft 50 | .SH MEMORY UTILIZATION 51 | This benchmark can move up to six times the requested memory per process 52 | when run through the loopback device. 53 | There are two processes, the sender and the receiver. 54 | Most Unix 55 | systems implement the read/write system calls as a bcopy from/to kernel space 56 | to/from user space. Bcopy will use 2-3 times as much memory bandwidth: 57 | there is one read from the source and a write to the destionation. The 58 | write usually results in a cache line read and then a write back of 59 | the cache line at some later point. Memory utilization might be reduced 60 | by 1/3 if the processor architecture implemented "load cache line" 61 | and "store cache line" instructions (as well as getcachelinesize). 62 | .SH ACKNOWLEDGEMENT 63 | Funding for the development of 64 | this tool was provided by Sun Microsystems Computer Corporation 65 | and Silicon Graphics, Inc. 66 | .SH SEE ALSO 67 | lmbench(8). 68 | .SH "AUTHOR" 69 | Carl Staelin and Larry McVoy 70 | .PP 71 | Comments, suggestions, and bug reports are always welcome. 72 | -------------------------------------------------------------------------------- /doc/bw_tcp.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | center expand doublebox; 4 | l r. 5 | Linux alpha 8.9 6 | Linux i486 5.5 7 | Linux alpha 8.8 8 | Linux i586 3.2 9 | Linux i486 5.6 10 | Linux i586 2.9 11 | DEC Alpha 11.2 12 | Linux i586 3.0 13 | SunOS-5.4 sun4m 9.5 14 | SunOS-5.4 sun4m 11.0 15 | DEC Alpha 4.1 16 | DEC Alpha 6.6 17 | DEC Alpha 12.1 18 | Linux i586 3.0 19 | SunOS-5.4 sun4d 7.9 20 | SunOS-5.4 sun4d 9.1 21 | DEC Alpha 8.6 22 | DEC Alpha 6.0 23 | DEC Alpha 10.5 24 | Sun SC1000 10.9 25 | Linux i586 5.1 26 | DEC Alpha 9.2 27 | Linux i586 6.8 28 | FreeBSD/i586 0.1 29 | IRIX IP22 7.2 30 | Linux i686 14.7 31 | FreeBSD/i586 0.1 32 | SunOS-5.4 sun4m 19.5 33 | FreeBSD/i586 0.1 34 | Sun Ultra1 51.3 35 | FreeBSD/i586 0.2 36 | FreeBSD/i586 0.2 37 | IBM Power2 10.5 38 | IBM PowerPC 16.6 39 | dgux mc88110 4.6 40 | IRIX64 IP21 18.8 41 | IRIX IP19 16.4 42 | HP-UX 9000/735 18.4 43 | HP-UX 9000/735 19.0 44 | HP-UX 9000/735 23.9 45 | HP-UX 9000/897 16.9 46 | IRIX64-601 IP26 21.5 47 | IRIX5.3 IP22 22.1 48 | IRIX5.3 IP19 12.2 49 | IRIX64 IP19 18.8 50 | IRIX64 IP25 26.1 51 | IRIX64 IP19 30.8 52 | HP-UX 9000/770 20.5 53 | HP-UX 9000/819 27.7 54 | HP-UX 9000/755 35.2 55 | HP-UX 9000/735 19.6 56 | .TE 57 | .KE 58 | -------------------------------------------------------------------------------- /doc/bw_unix.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH BW_UNIX 8 "$Date$" "(c)1994-2000 Larry McVoy and Carl Staelin" "LMBENCH" 3 | .SH NAME 4 | bw_unix \- UNIX pipe bandwidth 5 | .SH SYNOPSIS 6 | .B bw_unix 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I size 17 | .SH DESCRIPTION 18 | .B bw_unix 19 | creates a pipe and forks a child process which keeps writing 20 | data to the pipe as fast as it can. The benchmark measures 21 | how fast the parent process can 22 | .I read 23 | the data in 24 | .IR size -byte 25 | chunks from the pipe. Nothing is done with the data in either 26 | the parent (reader) or child (writer) processes. 27 | .LP 28 | The 29 | .I size 30 | specification may end with ``k'' or ``m'' to mean 31 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 32 | .SH OUTPUT 33 | Output format is \f(CB"%0.2f %.2f\\n", megabytes, megabytes_per_second\fP, i.e., 34 | .sp 35 | .ft CB 36 | 8.00 25.33 37 | .ft 38 | .SH "MEMORY UTILIZATION" 39 | This benchmark should move approximately the reported amount of memory. 40 | .SH ACKNOWLEDGEMENT 41 | Funding for the development of 42 | this tool was provided by Sun Microsystems Computer Corporation. 43 | .SH "SEE ALSO" 44 | lmbench(8). 45 | .SH "AUTHOR" 46 | Carl Staelin and Larry McVoy 47 | .PP 48 | Comments, suggestions, and bug reports are always welcome. 49 | -------------------------------------------------------------------------------- /doc/cache.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH CACHE 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | cache \- cache parameters 5 | .SH SYNOPSIS 6 | .B cache 7 | [ 8 | .I "-L " 9 | ] 10 | [ 11 | .I "-M " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .SH DESCRIPTION 20 | .B cache 21 | tries to determine the characteristics of the memory hierarchy. It 22 | attempts to determine the number of caches, the size of each cache, 23 | the line size for each cache, and the available memory parallelism at 24 | each level in the memory hierarchy. 25 | The largest amount of memory it will examine is 26 | .I len 27 | bytes. 28 | .LP 29 | .B cache 30 | first attempts to determine the number and size of caches by measuring 31 | the memory latency for various memory sizes. Once it has identified 32 | the various caches it then measures the latency, parallelism, and line 33 | size for each cache. Unfortunately, determining the cache size merely 34 | from latency is exceedingly difficult due to variations in cache 35 | replacement and prefetching strategies. 36 | .SH BUGS 37 | .B cache 38 | is an experimental benchmark and is known to fail on many processors. 39 | In particular there are a large number of machines with weird caching 40 | behavior that confuse 41 | .B cache 42 | and prevent it from accurately determining the number and size of the 43 | various caches. 44 | .SH "SEE ALSO" 45 | lmbench(8), line(8), tlb(8), par_mem(8). 46 | .SH "AUTHOR" 47 | Carl Staelin and Larry McVoy 48 | .PP 49 | Comments, suggestions, and bug reports are always welcome. 50 | -------------------------------------------------------------------------------- /doc/ctx.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | c|c s|c s 5 | l|c c|c c 6 | l|r r|r r. 7 | 2 processes 8 processes 8 | System \fB0KB\fP 32KB 0KB 32KB 9 | = 10 | Linux alpha 10 17 13 41\ 11 | Linux i486 11 394 18 594\ 12 | Linux alpha 11 73 13 92\ 13 | Linux i486 -1 70 -1 78\ 14 | Linux i586 10 163 13 215\ 15 | DEC Alpha 25 18 42 21\ 16 | SunOS-5.4 sun4m 37 128 52 73\ 17 | DEC Alpha 39 55 46 112\ 18 | DEC Alpha 53 50 56 62\ 19 | DEC Alpha 53 66 59 93\ 20 | DEC Alpha 59 68 115 134\ 21 | DEC Alpha 14 27 22 159\ 22 | DEC Alpha 40 42 46 205\ 23 | Sun Ultra1 14 27 20 73\ 24 | Unixware/i686 21 22 \ 25 | DEC Alpha 43 142 45 197\ 26 | SunOS-5.4 sun4m 54 65 85 102\ 27 | SunOS-5.4 sun4m 75 31 110 102\ 28 | IBM Power2 13 16 18 43\ 29 | HP-UX 9000/819 13 41 15 109\ 30 | HP-UX 9000/755 25 29 29 220\ 31 | HP-UX 9000/735 29 39 31 204\ 32 | HP-UX 9000/735 29 42 34 205\ 33 | HP-UX 9000/735 29 32 30 164\ 34 | Linux i586 36 163 47 222\ 35 | Linux i686 6 22 7 107\ 36 | Linux i586 13 178 20 273\ 37 | Linux i586 13 182 21 232\ 38 | Linux i586 16 218 22 266\ 39 | Linux i586 66 240 83 347\ 40 | Sun SC1000 107 135 104 362\ 41 | SunOS-5.4 sun4d 137 245 164 486\ 42 | SunOS-5.4 sun4d 224 113 245 134\ 43 | FreeBSD/i586 28 67 34 158\ 44 | IRIX5.3 IP22 40 47 38 104\ 45 | IBM PowerPC 16 87 26 144\ 46 | FreeBSD/i586 30 54 36 137\ 47 | FreeBSD/i586 24 54 28 137\ 48 | IRIX64 IP21 84 104 87 101\ 49 | dgux mc88110 89 119 122 263\ 50 | HP-UX 9000/897 20 39 23 111\ 51 | HP-UX 9000/735 27 37 30 222\ 52 | FreeBSD/i586 29 41 35 123\ 53 | FreeBSD/i586 29 -13 36 78\ 54 | IRIX IP22 38 50 42 74\ 55 | IRIX64-601 IP26 72 92 74 93\ 56 | IRIX64 IP19 59 68 79 91\ 57 | IRIX64 IP25 55 77 59 85\ 58 | IRIX64 IP19 63 80 69 93\ 59 | IRIX IP19 141 150 96 115\ 60 | HP-UX 9000/770 21 24 21 218\ 61 | IRIX5.3 IP19 150 157 102 167\ 62 | .TE 63 | .KE 64 | -------------------------------------------------------------------------------- /doc/graph.1: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .de DS 3 | . sp .5 4 | . nf 5 | . in +4 6 | . ft CW 7 | . vs -1 8 | .. 9 | .de DE 10 | . sp .5 11 | . fi 12 | . in 13 | . ft 14 | . vs 15 | .. 16 | .TH GRAPH 1 17 | .SH NAME 18 | graph \- compile graphs into pic input 19 | .SH SYNOPSIS 20 | .B graph 21 | [ options ] 22 | [ 23 | .I filename 24 | \&.\|.\|. 25 | ] 26 | .SH DESCRIPTION 27 | .LP 28 | .B graph 29 | is a perl script which 30 | takes sets of X Y data and generates a (human readable) pic program 31 | that will produce the graphed data. The output is designed such that 32 | you can save it in a file and tweak it to make it fit your document. 33 | Try one and look at the output. The output is actually commented. 34 | .LP 35 | The graph is autosized and auto ticked. 36 | .LP 37 | The input data format is similar 38 | that of xgraph(1), i.e., 39 | .DS 40 | 1 1 41 | 2 2 42 | 3 3 43 | "sloped across 44 | 45 | 1 4 46 | 2 4 47 | 3 4 48 | "straight across 49 | .DE 50 | .SH "CONTROL OPTIONS" 51 | .LP 52 | You may set the graph title, the X title, and the Y title with the 53 | following control sequences in the data stream: 54 | .DS 55 | %T Graph title in +4 point font 56 | %X X axis title and/or units in +2 point font 57 | %Y Y axis title and/or units in +2 point font 58 | %fakemax-X force graph to be that big 59 | %fakemax-Y force graph to be that big 60 | %fakemin-X force graph to be that small 61 | %fakemin-Y force graph to be that small 62 | .DE 63 | .SH OPTIONS 64 | .IP -rev 12 65 | reverse X/Y data sense (and titles). Note this is done after processing 66 | any fudging of the input data stream(s) (see -xk, -yk, -logx, etc below). 67 | .IP -below 68 | put data set titles below the graph rather than to the right. 69 | .IP -close 70 | no extra space around the data's endpoints. 71 | .IP -qline 72 | connect the quartile center points. 73 | .IP -grid 74 | dotted line grid marks. 75 | .IP -nobox 76 | no box around whole graph. 77 | .IP -big 78 | make the graph take the whole page. 79 | .IP -medium 80 | make the graph take about 1/2 the page. 81 | .IP -small 82 | make the graph be small. 83 | .IP -grapheach 84 | draw each data set in its own graph. 85 | .IP -nolabels 86 | no X/Y/Title labels. 87 | .IP -nodatal 88 | no data set labels. 89 | .IP -nomarks 90 | do not mark each data point with distinct markers (endpoints are still 91 | marked). 92 | .IP -k 93 | print values larger than 1000 as value/1000. 94 | .IP -xk 95 | multiply X input by 1024 (blech). 96 | .IP -yk 97 | multiply Y input by 1024 (blech). 98 | .IP -xm 99 | multiply X input by 1024*1024 (blech). 100 | .IP -ym 101 | multiply Y input by 1024*1024 (blech). 102 | .IP -logx 103 | convert X input into lag base 2 of X input. 104 | .IP -logy 105 | convert Y input into lag base 2 of Y input. 106 | .SH EXAMPLE 107 | Workstation price performance from a Digital ad. Process with 108 | .DS 109 | .ps -2 110 | graph -rev workstations | groff -TX75 111 | 112 | "%T Workstation Price / Performance, 6/93 113 | "%X SPECINT 92 Performance 114 | "%Y Price in $1000's 115 | 35 5 116 | 65 10 117 | 78 15 118 | 110 70 119 | "Dec AXP line 120 | 121 | 25 4 122 | 25 8 123 | 38 16 124 | 48 21 125 | 52 23 126 | 64 27 127 | "Sun SPARC line 128 | .DE 129 | .ps 130 | .SH "QUARTILE FORMAT" 131 | Data points are \f(CBx y1 y2 y3 y4 y5\fP. You get a two lines from the 132 | first two y values, a mark at the third, and another line from the last two. 133 | .SH "SEE ALSO" 134 | .BR gtroff (1), 135 | .BR gpic (1), 136 | .BR perl (1). 137 | .SH BUGS 138 | This should probably be called pic_graph or something like that. 139 | .LP 140 | This isn't done as much as I would like. 141 | It isn't integrated with the groff preprocessor yet. 142 | It doesn't know about .GS/.GE things. I use it to manually generate 143 | a pic file and then include that. 144 | -------------------------------------------------------------------------------- /doc/lat_allmem.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c c 5 | l c c c 6 | l r r r. 7 | Level 1 Level 2 Main 8 | System cache cache memory 9 | = 10 | Linux i586 8 103 151\ 11 | DEC Alpha 12 67 291\ 12 | Linux i586 8 107 150\ 13 | DEC Alpha 10 56 321\ 14 | Unixware/i686 14 34 196\ 15 | DEC Alpha 9 51 288\ 16 | DEC Alpha 7 47 458\ 17 | DEC Alpha 12 57 468\ 18 | SunOS-5.4 sun4m 13 -- 180\ 19 | SunOS-5.4 sun4m 20 -- 291\ 20 | SunOS-5.4 sun4m 16 115 816\ 21 | Sun Ultra1 6 42 270\ 22 | SunOS-5.4 sun4d 16 116 995\ 23 | IBM Power2 -- 13 141\ 24 | IBM PowerPC 6 164 394\ 25 | DEC Alpha 10 53 477\ 26 | FreeBSD/i586 10 115 179\ 27 | FreeBSD/i586 7 111 181\ 28 | DEC Alpha 13 104 957\ 29 | FreeBSD/i586 10 118 180\ 30 | FreeBSD/i586 10 101 180\ 31 | HP-UX 9000/735 -- 10 347\ 32 | Sun SC1000 20 140 1236\ 33 | HP-UX 9000/770 -- 9 376\ 34 | SunOS-5.4 sun4d 24 173 1246\ 35 | Linux i686 12 90 194\ 36 | Linux i586 10 190 320\ 37 | Linux i586 10 148 320\ 38 | Linux i586 10 198 321\ 39 | Linux i586 10 222 321\ 40 | Linux i486 12 234 336\ 41 | Linux alpha 3 83 354\ 42 | Linux alpha 3 43 361\ 43 | DEC Alpha 3 42 396\ 44 | HP-UX 9000/735 -- 10 348\ 45 | IRIX5.3 IP22 10 76 1018\ 46 | IRIX64 IP25 8 58 1134\ 47 | HP-UX 9000/735 -- 10 347\ 48 | HP-UX 9000/897 -- 11 424\ 49 | HP-UX 9000/819 -- 10 430\ 50 | IRIX64 IP21 11 100 709\ 51 | IRIX64 IP19 10 75 1150\ 52 | IRIX IP19 8 64 1189\ 53 | IRIX5.3 IP19 10 75 1149\ 54 | IRIX64 IP19 10 70 1152\ 55 | IRIX IP22 8 64 1170\ 56 | FreeBSD/i586 10 106 181\ 57 | HP-UX 9000/735 -- 10 348\ 58 | HP-UX 9000/755 -- 10 393\ 59 | dgux mc88110 22 319 753\ 60 | IRIX64-601 IP26 13 120 1244\ 61 | .TE 62 | .KE 63 | -------------------------------------------------------------------------------- /doc/lat_allproc.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l|c|c|c 5 | l|r|r|r. 6 | fork \fBfork, exec\fP fork, exec 7 | System & exit \fB& exit\fP sh -c & exit 8 | = 9 | DEC Alpha 4.6 13\ 42\ 10 | DEC Alpha 3.3 11\ 44\ 11 | Linux alpha 0.7 3\ 12\ 12 | Linux alpha 1.0 2\ 16\ 13 | DEC Alpha 2.0 6\ 43\ 14 | DEC Alpha 4.8 16\ 64\ 15 | Linux i686 0.5 5\ 17\ 16 | DEC Alpha 3.1 10\ 281\ 17 | Linux i586 0.9 5\ 16\ 18 | DEC Alpha 5.3 14\ 27\ 19 | DEC Alpha 5.1 15\ 89\ 20 | Sun Ultra1 3.7 20\ 10\ 21 | SunOS-5.4 sun4m 8.0 46\ 237\ 22 | SunOS-5.4 sun4m 18.0 83\ 37\ 23 | SunOS-5.4 sun4m 10.7 57\ 87\ 24 | Linux i486 3.3 10\ 112\ 25 | Linux i586 1.6 12\ 44\ 26 | SunOS-5.4 sun4d 13.7 75\ 113\ 27 | IBM Power2 1.2 8\ 16\ 28 | IBM PowerPC 2.9 8\ 50\ 29 | SunOS-5.4 sun4d 20.8 93\ 136\ 30 | HP-UX 9000/735 1.3 3\ 17\ 31 | IRIX5.3 IP19 4.3 8\ 20\ 32 | IRIX5.3 IP22 3.1 8\ 19\ 33 | IRIX64-601 IP26 4.6 24\ 39\ 34 | IRIX IP22 3.0 8\ 22\ 35 | Linux i586 2.4 9\ 26\ 36 | Linux i586 1.8 15\ 30\ 37 | Linux i586 1.9 15\ 30\ 38 | Linux i586 3.1 24\ 73\ 39 | DEC Alpha 13.4 33\ 39\ 40 | Sun SC1000 14.0 69\ 175\ 41 | FreeBSD/i586 2.9 14\ 22\ 42 | FreeBSD/i586 2.7 13\ 21\ 43 | IRIX64 IP21 4.2 14\ 30\ 44 | HP-UX 9000/770 3.1 9\ 18\ 45 | FreeBSD/i586 2.8 13\ 22\ 46 | HP-UX 9000/735 3.5 10\ 20\ 47 | HP-UX 9000/735 3.5 10\ 19\ 48 | IRIX64 IP19 4.5 19\ 37\ 49 | HP-UX 9000/819 4.2 67\ 118\ 50 | HP-UX 9000/755 3.6 10\ 18\ 51 | HP-UX 9000/897 6.7 15\ 37\ 52 | IRIX IP19 6.2 19\ 46\ 53 | HP-UX 9000/735 3.5 10\ 20\ 54 | FreeBSD/i586 2.7 12\ 20\ 55 | FreeBSD/i586 3.0 14\ 23\ 56 | IRIX64 IP25 3.3 12\ 24\ 57 | IRIX64 IP19 4.0 14\ 24\ 58 | dgux mc88110 8.8 13\ 67\ 59 | .TE 60 | .KE 61 | -------------------------------------------------------------------------------- /doc/lat_connect.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_CONNECT 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_connect \- measure interprocess connection latency via TCP/IP 5 | .SH SYNOPSIS 6 | .B lat_connect 7 | .I -s 8 | .sp .5 9 | .B lat_connect 10 | [ 11 | .I "-P " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .I hostname 20 | .sp .5 21 | .B lat_connect 22 | .I "-S hostname" 23 | .SH DESCRIPTION 24 | .B lat_connect 25 | is a client/server program that measures interprocess 26 | connection latencies. The benchmark times the creation and connection of 27 | an AF_INET (aka TCP/IP) socket to a remote server. Care is take that the 28 | connection time does not include any other overhead, such as the 29 | \fIgethostbyname()\fP or remote port lookups since these add more overhead 30 | than the connection establishment itself. 31 | .LP 32 | .B lat_connect 33 | has three forms of usage: as a server (-s), as a client (lat_connect localhost), 34 | and as a shutdown (lat_connect -S localhost). 35 | .SH OUTPUT 36 | The reported time is in microseconds per connection. 37 | Output format is like so 38 | .sp 39 | .ft CB 40 | TCP/IP connection cost to localhost: 1006 microseconds 41 | .ft 42 | .SH "SEE ALSO" 43 | lmbench(8). 44 | .SH "AUTHOR" 45 | Carl Staelin and Larry McVoy 46 | .PP 47 | Comments, suggestions, and bug reports are always welcome. 48 | -------------------------------------------------------------------------------- /doc/lat_connect.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | center expand doublebox; 4 | l r. 5 | DEC Alpha 976 6 | Linux i586 606 7 | IRIX IP22 470 8 | SunOS-5.4 sun4d 852 9 | SunOS-5.4 sun4d 3123 10 | Sun SC1000 4594 11 | IRIX64-601 IP26 316 12 | Linux i586 1155 13 | IRIX5.3 IP22 349 14 | IRIX64 IP21 667 15 | IBM Power2 339 16 | dgux mc88110 4635 17 | DEC Alpha 4700 18 | HP-UX 9000/770 319 19 | HP-UX 9000/755 384 20 | HP-UX 9000/735 389 21 | IRIX64 IP25 716 22 | IRIX64 IP19 763 23 | IRIX5.3 IP19 694 24 | Linux i686 746 25 | Linux i586 775 26 | Linux i586 779 27 | Linux i586 835 28 | Linux i586 1348 29 | Linux i486 1439 30 | DEC Alpha 3047 31 | FreeBSD/i586 454 32 | HP-UX 9000/897 765 33 | FreeBSD/i586 465 34 | FreeBSD/i586 454 35 | FreeBSD/i586 397 36 | IRIX IP19 697 37 | HP-UX 9000/735 388 38 | IRIX64 IP19 805 39 | HP-UX 9000/735 459 40 | HP-UX 9000/819 585 41 | HP-UX 9000/735 740 42 | FreeBSD/i586 481 43 | .TE 44 | .KE 45 | -------------------------------------------------------------------------------- /doc/lat_ctx.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_CTX 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_ctx \- context switching benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | [ 17 | .I "-s " 18 | ] 19 | .I "#procs" 20 | [ 21 | .I "#procs ..." 22 | ] 23 | .SH DESCRIPTION 24 | .B lat_ctx 25 | measures context switching time for any reasonable 26 | number of processes of any reasonable size. 27 | The processes are connected in a ring of Unix pipes. Each process 28 | reads a token from its pipe, possibly does some work, and then writes 29 | the token to the next process. 30 | .LP 31 | Processes may vary in number. Smaller numbers of processes result in 32 | faster context switches. More than 20 processes is not supported. 33 | .LP 34 | Processes may vary in size. A size of zero is the baseline process that 35 | does nothing except pass the token on to the next process. A process size 36 | of greater than zero means that the process does some work before passing 37 | on the token. The work is simulated as the summing up of an array of the 38 | specified size. The summing is an unrolled loop of about a 2.7 thousand 39 | instructions. 40 | .LP 41 | The effect is that both the data and the instruction cache 42 | get polluted by some amount before the token is passed on. The data 43 | cache gets polluted by approximately the process ``size''. The instruction 44 | cache gets polluted by a constant amount, approximately 2.7 45 | thousand instructions. 46 | .LP 47 | The pollution of the caches results in larger context switching times for 48 | the larger processes. This may be confusing because the benchmark takes 49 | pains to measure only the context switch time, not including the overhead 50 | of doing the work. The subtle point is that the overhead is measured using 51 | hot caches. As the number and size of the processes increases, the caches 52 | are more and more polluted until the set of processes do not fit. The 53 | context switch times go up because a context switch is defined as the switch 54 | time 55 | plus the time it takes to restore all of the process state, including 56 | cache state. This means that the switch includes the time for the cache 57 | misses on larger processes. 58 | .SH OUTPUT 59 | Output format is intended as input to \fBxgraph\fP or some similar program. 60 | The format is multi line, the first line is a title that specifies the 61 | size and non-context switching overhead of the test. Each subsequent 62 | line is a pair of numbers that indicates the number of processes and 63 | the cost of a context switch. The overhead and the context switch times are 64 | in micro second units. The numbers below are for a SPARCstation 2. 65 | .sp 66 | .ft CB 67 | .nf 68 | "size=0 ovr=179 69 | 2 71 70 | 4 104 71 | 8 134 72 | 16 333 73 | 20 438 74 | .br 75 | .fi 76 | .ft 77 | .SH BUGS 78 | The numbers produced by this benchmark are somewhat inaccurate; they vary 79 | by about 10 to 15% from run to run. A series of runs may be done and the 80 | lowest numbers reported. The lower the number the more accurate the results. 81 | .LP 82 | The reasons for the inaccuracies are possibly interaction between the 83 | VM system and the processor caches. It is possible that sometimes the 84 | benchmark processes are laid out in memory such that there are fewer 85 | TLB/cache conflicts than other times. This is pure speculation on our part. 86 | .SH ACKNOWLEDGEMENT 87 | Funding for the development of 88 | this tool was provided by Sun Microsystems Computer Corporation. 89 | .SH "SEE ALSO" 90 | lmbench(8). 91 | .SH "AUTHOR" 92 | Carl Staelin and Larry McVoy 93 | .PP 94 | Comments, suggestions, and bug reports are always welcome. 95 | 96 | -------------------------------------------------------------------------------- /doc/lat_disk.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | center expand doublebox; 4 | l r. 5 | SunOS-5.4 sun4m 2876 6 | Sun SC1000 1466 7 | DEC Alpha 1436 8 | DEC Alpha 1995 9 | IRIX IP22 984 10 | Sun Ultra1 2242 11 | HP-UX 9000/770 732 12 | IRIX IP19 920 13 | IRIX5.3 IP22 1265 14 | IRIX5.3 IP19 991 15 | DEC Alpha 2057 16 | DEC Alpha 3729 17 | FreeBSD/i586 297 18 | FreeBSD/i586 306 19 | FreeBSD/i586 2314 20 | FreeBSD/i586 2284 21 | FreeBSD/i586 310 22 | .TE 23 | .KE 24 | -------------------------------------------------------------------------------- /doc/lat_fcntl.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_FCNTL 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_fcntl \- fcntl file locking benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .SH DESCRIPTION 17 | .B lat_fcntl 18 | is a client/server program that measures file locking latencies. The 19 | benchmark alternately locks and unlocks files so that only one of the 20 | client or server is running at a time, similar to ``hot potato'' 21 | message passing benchmarks. 22 | No other work is done in the processes. 23 | .SH ACKNOWLEDGEMENT 24 | Funding for the development of 25 | this tool was provided by Sun Microsystems Computer Corporation. 26 | .SH "SEE ALSO" 27 | lmbench(8), lat_fifo(8), lat_tcp(8), lat_udp(8), lat_unix(8). 28 | .SH "AUTHOR" 29 | Carl Staelin and Larry McVoy 30 | .PP 31 | Comments, suggestions, and bug reports are always welcome. 32 | 33 | -------------------------------------------------------------------------------- /doc/lat_fifo.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_FIFO 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_fifo \- FIFO benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .SH DESCRIPTION 17 | .B lat_fifo 18 | is a client/server program that measures interprocess 19 | communication latencies. The benchmark passes a message back and forth between 20 | the two processes (this sort of benchmark is frequently referred to as a 21 | ``hot potato'' benchmark). No other work is done in the processes. 22 | The message is passed back and forth using FIFOs. 23 | .SH ACKNOWLEDGEMENT 24 | Funding for the development of 25 | this tool was provided by Sun Microsystems Computer Corporation. 26 | .SH "SEE ALSO" 27 | lmbench(8), lat_fcntl(8), lat_tcp(8), lat_udp(8), lat_unix(8). 28 | .SH "AUTHOR" 29 | Carl Staelin and Larry McVoy 30 | .PP 31 | Comments, suggestions, and bug reports are always welcome. 32 | 33 | -------------------------------------------------------------------------------- /doc/lat_fs.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_FS 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_fs \- measure file system create/delete performance 5 | .SH SYNOPSIS 6 | .B lat_fs 7 | [ 8 | .I dir 9 | ] 10 | .SH DESCRIPTION 11 | .B lat_fs 12 | is a program that creates a number of small files in the current working 13 | directory and then removes the files. Both the creation and removal of 14 | the files is timed. 15 | .SH OPTIONS 16 | If 17 | .I dir 18 | is specified, 19 | .B lat_fs 20 | will change to that directory first and do the creates and deletes there. 21 | Otherwise the creates and deletes are done in $PWD. 22 | .SH OUTPUT 23 | The results are in terms of creates per second and deletes per second 24 | as a function of file size. The output is in 4 column form and is the 25 | size of the file, the number created, the creations per second, and the 26 | removals per second. Output format looks like: 27 | .sp 28 | .ft CB 29 | .nf 30 | 0k 500 1304 2740 31 | 1k 500 904 1663 32 | 4k 500 861 1647 33 | 10k 500 674 1516 34 | .fi 35 | .ft 36 | .SH "SEE ALSO" 37 | lmbench(8). 38 | -------------------------------------------------------------------------------- /doc/lat_fs.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c 5 | l r r. 6 | System Create \fBDelete\fP 7 | = 8 | Linux i586 1.4 0.1 9 | IRIX64-601 IP26 0.9 0.1 10 | Linux i586 1.5 0.1 11 | Linux i586 1.1 0.1 12 | Linux i586 1.4 0.1 13 | Linux i686 1.2 0.1 14 | SunOS-5.4 sun4d 0.7 0.4 15 | SunOS-5.4 sun4d 18.2 8.3 16 | Linux i586 1.4 0.1 17 | Linux i486 0.8 0.1 18 | Linux i486 0.8 0.1 19 | Linux i586 2.7 0.2 20 | Sun SC1000 3.7 1.3 21 | Linux alpha 4.3 4.2 22 | DEC Alpha 25.0 11.4 23 | DEC Alpha 25.0 11.1 24 | DEC Alpha 0.8 0.3 25 | DEC Alpha 1.3 0.5 26 | DEC Alpha 38.5 12.3 27 | DEC Alpha 33.3 11.9 28 | DEC Alpha 23.3 11.5 29 | IRIX64 IP25 3.5 4.0 30 | IRIX64 IP19 3.1 5.0 31 | IRIX IP22 13.3 8.4 32 | Linux alpha 25.0 11.5 33 | DEC Alpha 25.6 14.1 34 | dgux mc88110 2.4 0.5 35 | HP-UX 9000/735 2.8 3.9 36 | FreeBSD/i586 20.0 8.3 37 | FreeBSD/i586 20.4 8.3 38 | FreeBSD/i586 22.7 8.3 39 | FreeBSD/i586 22.7 8.3 40 | FreeBSD/i586 19.6 8.3 41 | IRIX IP19 12.0 11.8 42 | IRIX5.3 IP19 11.5 11.2 43 | IBM Power2 13.3 12.8 44 | IRIX5.3 IP22 9.4 8.5 45 | HP-UX 9000/735 28.6 11.5 46 | IRIX64 IP21 11.9 11.5 47 | IBM PowerPC 12.7 12.7 48 | HP-UX 9000/770 20.0 11.1 49 | HP-UX 9000/735 15.4 11.1 50 | HP-UX 9000/819 3.7 11.8 51 | HP-UX 9000/897 58.8 17.2 52 | HP-UX 9000/755 26.3 11.2 53 | IRIX64 IP19 12.5 9.8 54 | HP-UX 9000/735 26.3 12.0 55 | .TE 56 | .KE 57 | -------------------------------------------------------------------------------- /doc/lat_http.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_FCNTL 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_fcntl \- fcntl file locking benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-d" 9 | ] 10 | [ 11 | .I "-e" 12 | ] 13 | [ 14 | .I "-S" 15 | ] 16 | .I serverhost 17 | [ 18 | .I port 19 | ] 20 | .SH DESCRIPTION 21 | .B lat_http 22 | is a client/server program that measures simple http transaction 23 | latencies. It has its own HTTP server, and it is meant to simply 24 | measure the minimum overall costs of simple HTTP ``GET'' 25 | transactions. It does not measure the performance of third-party HTTP 26 | servers. 27 | .LP 28 | The client simply makes a series of HTTP GET requests for files. The 29 | files are a fixed set of files included with the benchmark. No 30 | special care was made to ensure that the file sizes match and 31 | predetermined distribution. 32 | .SH ACKNOWLEDGEMENT 33 | Funding for the development of 34 | this tool was provided by Sun Microsystems Computer Corporation. 35 | .SH "SEE ALSO" 36 | lmbench(8), lat_connect(8), lat_tcp(8), lat_sig(8). 37 | .SH "AUTHOR" 38 | Carl Staelin and Larry McVoy 39 | .PP 40 | Comments, suggestions, and bug reports are always welcome. 41 | 42 | -------------------------------------------------------------------------------- /doc/lat_ipc.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l l c c c 5 | l l r r r. 6 | System Network \fBTCP bw\fP TCP latency UDP latency 7 | = 8 | IRIX IP21 hippi 62 1068 1099 9 | SunOS-5.5 sun4u@167 100baseT 9.5 280 308 10 | HP-UX 9000/735 fddi 8.8 425 441 11 | IRIX IP22 10baseT .9 543 602 12 | IRIX IP21 10baseT .9 1463 1376 13 | HP-UX 9000/735 10baseT .9 592 603 14 | Linux 10baseT .7 2954 1912 15 | .TE 16 | .KE 17 | -------------------------------------------------------------------------------- /doc/lat_mem_rd.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_MEM_RD 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_mem_rd \- memory read latency benchmark 5 | .SH SYNOPSIS 6 | .B lat_mem_rd 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I "size_in_megabytes" 17 | .I "stride" 18 | [ 19 | .I "stride stride..." 20 | ] 21 | .SH DESCRIPTION 22 | .B lat_mem_rd 23 | measures memory read latency for varying memory sizes and strides. The 24 | results are reported in nanoseconds per load and have been verified 25 | accurate to within a few nanoseconds on an SGI Indy. 26 | .LP 27 | The 28 | entire memory hierarchy is measured, including onboard cache latency 29 | and size, external cache latency and size, main memory latency, and TLB 30 | miss latency. 31 | .LP 32 | Only data accesses are measured; the instruction cache is not measured. 33 | .LP 34 | The benchmark runs as two nested loops. The outer loop is the stride size. 35 | The inner loop is the array size. For each array size, the benchmark 36 | creates a ring of pointers that point backward one stride. Traversing the 37 | array is done by 38 | .sp 39 | .ft CB 40 | p = (char **)*p; 41 | .ft 42 | .sp 43 | in a for loop (the over head of the for loop is not significant; the loop is 44 | an unrolled loop 100 loads long). 45 | .LP 46 | The size of the array varies from 512 bytes to (typically) eight megabytes. 47 | For the small sizes, the cache will have an effect, and the loads will be 48 | much faster. This becomes much more apparent when the data is plotted. 49 | .LP 50 | Since this benchmark uses fixed-stride offsets in the pointer chain, 51 | it may be vulnerable to smart, stride-sensitive cache prefetching 52 | policies. Older machines were typically able to prefetch for 53 | sequential access patterns, and some were able to prefetch for strided 54 | forward access patterns, but only a few could prefetch for backward 55 | strided patterns. These capabilities are becoming more widespread 56 | in newer processors. 57 | .SH OUTPUT 58 | Output format is intended as input to \fBxgraph\fP or some similar program 59 | (we use a perl script that produces pic input). 60 | There is a set of data produced for each stride. The data set title 61 | is the stride size and the data points are the array size in megabytes 62 | (floating point value) and the load latency over all points in that array. 63 | .SH "INTERPRETING THE OUTPUT" 64 | The output is best examined in a graph where you typically get a graph 65 | that has four plateaus. The graph should plotted in log base 2 of the 66 | array size on the X axis and the latency on the Y axis. Each stride 67 | is then plotted as a curve. The plateaus that appear correspond to 68 | the onboard cache (if present), external cache (if present), main 69 | memory latency, and TLB miss latency. 70 | .LP 71 | As a rough guide, you may be able to extract the latencies of the 72 | various parts as follows, but you should really look at the graphs, 73 | since these rules of thumb do not always work (some systems do not 74 | have onboard cache, for example). 75 | .IP "onboard cache" 16 76 | Try stride of 128 and array size of .00098. 77 | .IP "external cache" 78 | Try stride of 128 and array size of .125. 79 | .IP "main memory" 80 | Try stride of 128 and array size of 8. 81 | .IP "TLB miss" 82 | Try the largest stride and the largest array. 83 | .SH BUGS 84 | This program is dependent on the correct operation of 85 | .BR mhz (8). 86 | If you are getting numbers that seem off, check that 87 | .BR mhz (8) 88 | is giving you a clock rate that you believe. 89 | .SH ACKNOWLEDGEMENT 90 | Funding for the development of 91 | this tool was provided by Sun Microsystems Computer Corporation. 92 | .SH "SEE ALSO" 93 | lmbench(8), tlb(8), cache(8), line(8). 94 | .SH "AUTHOR" 95 | Carl Staelin and Larry McVoy 96 | .PP 97 | Comments, suggestions, and bug reports are always welcome. 98 | -------------------------------------------------------------------------------- /doc/lat_mmap.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_MMAP 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_mmap \- costs of mmapping and unmmapping varying file sizes 5 | .SH SYNOPSIS 6 | .B lat_mmap 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I size 17 | .I file 18 | .SH DESCRIPTION 19 | .B lat_mmap 20 | times how fast a mapping can be made and unmade. This is useful because it 21 | is a fundemental part of processes that use SunOS style shared libraries 22 | (the libraries are mapped in at process start up time and unmapped at 23 | process exit). 24 | .LP 25 | The benchmark maps in and unmaps the first \fIsize\fP bytes of the file 26 | repeatedly and reports the average time for one mapping/unmapping. 27 | .LP 28 | The size 29 | specification may end with ``k'' or ``m'' to mean 30 | kilobytes (* 1024) or megabytes (* 1024 * 1024). 31 | .SH OUTPUT 32 | Output format is \f(CB"%0.2f %d\\n", megabytes, usecs\fP, i.e., 33 | .sp 34 | .ft CB 35 | 8.00 1200 36 | .ft 37 | .SH ACKNOWLEDGEMENT 38 | Funding for the development of 39 | this tool was provided by Sun Microsystems Computer Corporation. 40 | .SH "SEE ALSO" 41 | lmbench(8). 42 | .SH "AUTHOR" 43 | Carl Staelin and Larry McVoy 44 | .PP 45 | Comments, suggestions, and bug reports are always welcome. 46 | -------------------------------------------------------------------------------- /doc/lat_nullsys.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | center expand doublebox; 4 | l r. 5 | SunOS-5.4 sun4m 7 6 | Sun SC1000 9 7 | SunOS-5.4 sun4d 12 8 | SunOS-5.4 sun4m 9 9 | SunOS-5.4 sun4m 13 10 | Linux alpha 2 11 | Linux i586 2 12 | Linux i586 2 13 | Unixware/i686 5 14 | Sun Ultra1 5 15 | DEC Alpha 9 16 | Linux i586 3 17 | Linux i586 3 18 | Linux alpha 3 19 | DEC Alpha 11 20 | DEC Alpha 12 21 | DEC Alpha 15 22 | IBM PowerPC 12 23 | DEC Alpha 17 24 | FreeBSD/i586 7 25 | FreeBSD/i586 9 26 | FreeBSD/i586 10 27 | DEC Alpha 17 28 | FreeBSD/i586 7 29 | SunOS-5.4 sun4d 26 30 | Linux i686 4 31 | Linux i586 5 32 | Linux i586 5 33 | Linux i486 6 34 | Linux i486 6 35 | DEC Alpha 9 36 | DEC Alpha 13 37 | HP-UX 9000/735 12 38 | HP-UX 9000/735 13 39 | HP-UX 9000/735 14 40 | IRIX5.3 IP19 20 41 | HP-UX 9000/755 14 42 | HP-UX 9000/819 19 43 | IRIX64 IP25 23 44 | IRIX IP22 10 45 | IRIX IP19 16 46 | IRIX64 IP19 18 47 | IRIX64 IP19 24 48 | FreeBSD/i586 9 49 | HP-UX 9000/770 11 50 | HP-UX 9000/897 92 51 | HP-UX 9000/735 12 52 | dgux mc88110 75 53 | IBM Power2 16 54 | IRIX64-601 IP26 20 55 | IRIX64 IP21 25 56 | IRIX5.3 IP22 11 57 | .TE 58 | .KE 59 | -------------------------------------------------------------------------------- /doc/lat_ops.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_OPS 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_ops \- basic CPU operation parallelism 5 | .SH SYNOPSIS 6 | .B lat_ops 7 | [ 8 | .I "-W " 9 | ] 10 | [ 11 | .I "-N " 12 | ] 13 | .SH DESCRIPTION 14 | .B lat_ops 15 | measures the latency of basic CPU operations, such as 16 | integer ADD. 17 | .TP 18 | integer bit, add, mul, div, mod operations 19 | maximum parallelism for integer XOR, ADD, MUL, DIV, MOD operations. 20 | .TP 21 | uint64 bit, add, mul, div, mod operations 22 | maximum parallelism for uint64 XOR, ADD, MUL, DIV, MOD operations. 23 | .TP 24 | float add, mul, div operations 25 | maximum parallelism for flot ADD, MUL, DIV operations. 26 | .TP 27 | double add, mul, div operations 28 | maximum parallelism for flot ADD, MUL, DIV operations. 29 | .SH BUGS 30 | This benchmark is highly experimental and may sometimes (frequently?) 31 | give erroneous results. 32 | .SH "SEE ALSO" 33 | lmbench(8), par_ops(8). 34 | .SH "AUTHOR" 35 | Carl Staelin and Larry McVoy 36 | .PP 37 | Comments, suggestions, and bug reports are always welcome. 38 | -------------------------------------------------------------------------------- /doc/lat_pagefault.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_PAGEFAULT 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_pagefault \- measure the cost of pagefaulting pages from a file 5 | .SH SYNOPSIS 6 | .B lat_pagefault 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I file 17 | [ 18 | .I file.... 19 | ] 20 | .SH DESCRIPTION 21 | .B lat_pagefault 22 | times how fast a page of a file can be faulted in. The file is flushed from 23 | (local) memory by using the \f(CBmsync()\fP interface with the invalidate 24 | flag set. (Note that NFS does not send this over the wire so this makes 25 | for a handy way to measure the cost of going across the wire.) 26 | .LP 27 | The benchmark maps in the entire file and the access pages backwards using 28 | a stride of 256K kilobytes. 29 | .SH OUTPUT 30 | Output format is below; it prints the average cost of page faulting a page. 31 | .sp 32 | .ft CB 33 | Pagefaults on : usecs 34 | .ft 35 | .SH BUGS 36 | Using a stride of 256K may be a bad idea because SCSI controllers 37 | may have caches bigger than that. 38 | .SH ACKNOWLEDGEMENT 39 | Funding for the development of 40 | this tool was provided by Sun Microsystems Computer Corporation. 41 | .SH "SEE ALSO" 42 | lmbench(8). 43 | .SH "AUTHOR" 44 | Carl Staelin and Larry McVoy 45 | .PP 46 | Comments, suggestions, and bug reports are always welcome. 47 | -------------------------------------------------------------------------------- /doc/lat_pipe.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_PIPE 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_pipe \- measure interprocess communication latency through pipes 5 | .SH SYNOPSIS 6 | .B lat_pipe 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .SH DESCRIPTION 17 | .B lat_pipe 18 | uses two processes communicating through a Unix pipe to measure interprocess 19 | communication latencies. The benchmark passes a token back and forth between 20 | the two processes (this sort of benchmark is frequently referred to as a 21 | ``hot potato'' benchmark). No other work is done in the processes. 22 | .SH OUTPUT 23 | The reported time is in microseconds per round trip and includes the total 24 | time, i.e., the context switching overhead is includeded. 25 | Output format is like so 26 | .sp 27 | .ft CB 28 | Pipe latency: 491 microseconds 29 | .ft 30 | .SH ACKNOWLEDGEMENT 31 | Funding for the development of 32 | this tool was provided by Sun Microsystems Computer Corporation. 33 | .SH "SEE ALSO" 34 | lmbench(8). 35 | .SH "AUTHOR" 36 | Carl Staelin and Larry McVoy 37 | .PP 38 | Comments, suggestions, and bug reports are always welcome. 39 | -------------------------------------------------------------------------------- /doc/lat_pipe.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | center expand doublebox; 4 | l r. 5 | SunOS-5.4 sun4m 194 6 | SunOS-5.4 sun4m 150 7 | DEC Alpha 141 8 | Linux alpha 34 9 | Linux i486 56 10 | Linux i486 56 11 | Unixware/i686 86 12 | Linux i586 33 13 | Sun Ultra1 62 14 | SunOS-5.4 sun4m 372 15 | Linux alpha 34 16 | DEC Alpha 162 17 | DEC Alpha 191 18 | Linux i586 42 19 | DEC Alpha 71 20 | DEC Alpha 179 21 | Sun SC1000 278 22 | IBM PowerPC 65 23 | dgux mc88110 474 24 | SunOS-5.4 sun4d 519 25 | FreeBSD/i586 104 26 | FreeBSD/i586 111 27 | FreeBSD/i586 115 28 | SunOS-5.4 sun4d 671 29 | Linux i586 84 30 | Linux i686 31 31 | Linux i586 43 32 | Linux i586 43 33 | Linux i586 140 34 | DEC Alpha 185 35 | DEC Alpha 198 36 | DEC Alpha 278 37 | HP-UX 9000/755 193 38 | HP-UX 9000/897 118 39 | IRIX64 IP19 187 40 | HP-UX 9000/770 148 41 | HP-UX 9000/819 113 42 | HP-UX 9000/735 181 43 | FreeBSD/i586 115 44 | IRIX IP22 118 45 | HP-UX 9000/735 178 46 | HP-UX 9000/735 169 47 | HP-UX 9000/735 172 48 | IRIX64 IP21 264 49 | IRIX5.3 IP19 366 50 | IBM Power2 91 51 | IRIX64 IP25 230 52 | IRIX64-601 IP26 222 53 | IRIX64 IP19 251 54 | IRIX IP19 333 55 | FreeBSD/i586 127 56 | IRIX5.3 IP22 131 57 | .TE 58 | .KE 59 | -------------------------------------------------------------------------------- /doc/lat_proc.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_PROC 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_proc \- process creation tests 5 | .SH SYNOPSIS 6 | .B lat_proc 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I "procedure|fork|exec|shell" 17 | .SH DESCRIPTION 18 | .B lat_proc 19 | creates processes in three different forms, each more expensive than the last. 20 | The purposes is to measure the time that it takes to create a basic thread 21 | of control. 22 | .LP 23 | The forms are listed and described below: 24 | .TP 20 25 | Process fork+exit 26 | The time it takes to split a process into two (nearly) identical copies 27 | and have one exit. This is how new processes are created but is not 28 | very useful since both processes are doing the same thing. 29 | .TP 30 | Process fork+execve 31 | The time it takes to create a new process and have that new process run a new 32 | program. This is the inner loop of all shells (command interpreters). 33 | .TP 34 | Process fork+/bin/sh -c 35 | The time it takes to create a new process and have that new process run a new 36 | program by asking the system shell to find that program and run it. This is 37 | how the C library interface called \f(CBsystem\fP is implemented. It is the 38 | most general and the most expensive. 39 | .SH OUTPUT 40 | Output is in microseconds per operation like so: 41 | .sp 42 | .ft CB 43 | .nf 44 | Process fork+exit: 6054 microseconds 45 | Process fork+execve: 11212 microseconds 46 | Process fork+/bin/sh -c: 44346 microseconds 47 | .br 48 | .fi 49 | .ft 50 | .SH ACKNOWLEDGEMENT 51 | Funding for the development of 52 | this tool was provided by Sun Microsystems Computer Corporation. 53 | .SH "SEE ALSO" 54 | lmbench(8). 55 | .SH "AUTHOR" 56 | Carl Staelin and Larry McVoy 57 | .PP 58 | Comments, suggestions, and bug reports are always welcome. 59 | -------------------------------------------------------------------------------- /doc/lat_rpc.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_RPC 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_rpc \- measure interprocess communication latency via Sun RPC 5 | .SH SYNOPSIS 6 | .B lat_rpc 7 | .I -s 8 | .sp .5 9 | .B lat_rpc 10 | [ 11 | .I "-P " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | [ 20 | .I "-p tcp|udp" 21 | ] 22 | .I hostname 23 | [ 24 | .I "udp|tcp" 25 | ] 26 | .sp .5 27 | .B lat_rpc 28 | .I "-S hostname" 29 | .SH DESCRIPTION 30 | .B lat_rpc 31 | is a client/server program that measures interprocess 32 | communication latencies. The benchmark passes a token back and forth between 33 | the two processes (this sort of benchmark is frequently referred to as a 34 | ``hot potato'' benchmark). No other work is done in the processes. 35 | .LP 36 | This benchmark may be compared to the TCP and UDP forms of the same benchmark 37 | to accurately see the cost of using RPC versus the cost of using plain 38 | old TCP or UDP sockets. It is worth noting that the RPC form is passing 39 | back and forth a single byte, not some long complicated record. 40 | .LP 41 | .B lat_rpc 42 | has three forms of usage: as a server (-s), as a client (lat_rpc localhost), and 43 | as a shutdown (lat_rpc -S localhost). 44 | .LP 45 | The client form may specify the protocol over which the RPCs are performed. 46 | The default is to measure performance for both 47 | .I udp 48 | and 49 | .IR tcp . 50 | .SH OUTPUT 51 | The reported time is in microseconds per round trip and includes the total 52 | time, i.e., the context switching overhead is includeded. 53 | Output format is like so 54 | .sp 55 | .ft CB 56 | RPC/udp latency using localhost: 1344 microseconds 57 | .br 58 | RPC/tcp latency using localhost: 2089 microseconds 59 | .ft 60 | .SH ACKNOWLEDGEMENT 61 | Funding for the development of 62 | this tool was provided by Sun Microsystems Computer Corporation. 63 | .SH "SEE ALSO" 64 | lmbench(8). 65 | .SH "AUTHOR" 66 | Carl Staelin and Larry McVoy 67 | .PP 68 | Comments, suggestions, and bug reports are always welcome. 69 | -------------------------------------------------------------------------------- /doc/lat_select.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_SELECT 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_select \- select benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | [ 17 | .I "n" 18 | ] 19 | .SH DESCRIPTION 20 | .B lat_select 21 | measures the time to do a select on 22 | .I n 23 | file descriptors. 24 | .SH ACKNOWLEDGEMENT 25 | Funding for the development of 26 | this tool was provided by Sun Microsystems Computer Corporation. 27 | .SH "SEE ALSO" 28 | lmbench(8). 29 | .SH "AUTHOR" 30 | Carl Staelin and Larry McVoy 31 | .PP 32 | Comments, suggestions, and bug reports are always welcome. 33 | 34 | -------------------------------------------------------------------------------- /doc/lat_sig.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_SIG 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_sig \- select benchmark 5 | .SH SYNOPSIS 6 | .B lat_ctx 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I "install|catch|prot" 17 | [ 18 | .I "file" 19 | ] 20 | .SH DESCRIPTION 21 | .B lat_sig 22 | measures the time to install and catch signals. It can also measure 23 | the time to catch a protection fault. 24 | .SH ACKNOWLEDGEMENT 25 | Funding for the development of 26 | this tool was provided by Sun Microsystems Computer Corporation. 27 | .SH "SEE ALSO" 28 | lmbench(8). 29 | .SH "AUTHOR" 30 | Carl Staelin and Larry McVoy 31 | .PP 32 | Comments, suggestions, and bug reports are always welcome. 33 | 34 | -------------------------------------------------------------------------------- /doc/lat_signal.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c 5 | l r r. 6 | System sigaction \fBsig handler\fP 7 | = 8 | DEC Alpha 20 30 9 | IRIX5.3 IP22 5 9 10 | IRIX IP22 10 12 11 | IRIX64-601 IP26 11 10 12 | Linux i586 11 22 13 | Linux i586 12 22 14 | DEC Alpha 5 101 15 | Linux alpha 13 38 16 | Linux i486 6 45 17 | Linux alpha 18 37 18 | Linux i586 9 25 19 | Linux i586 8 50 20 | dgux mc88110 5 16 21 | FreeBSD/i586 4 16 22 | FreeBSD/i586 10 34 23 | Linux i486 7 52 24 | FreeBSD/i586 9 34 25 | DEC Alpha 6 138 26 | IRIX64 IP19 6 9 27 | IRIX5.3 IP19 4 8 28 | IRIX64 IP21 5 13 29 | Linux i686 4 14 30 | Linux i586 4 23 31 | Linux i586 6 23 32 | HP-UX 9000/897 10 38 33 | IRIX64 IP19 4 35 34 | HP-UX 9000/770 10 37 35 | HP-UX 9000/819 11 54 36 | HP-UX 9000/755 10 52 37 | HP-UX 9000/735 10 38 38 | HP-UX 9000/735 6 32 39 | IRIX IP19 6 79 40 | HP-UX 9000/735 5 55 41 | IRIX64 IP25 5 55 42 | IBM PowerPC 5 19 43 | FreeBSD/i586 13 56 44 | IBM Power2 52 355 45 | HP-UX 9000/735 15 47 46 | FreeBSD/i586 18 52 47 | .TE 48 | .KE 49 | -------------------------------------------------------------------------------- /doc/lat_syscall.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_SYSCALL 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_syscall - time simple entry into the operating system 5 | .SH SYNOPSIS 6 | .B lat_syscall 7 | [ 8 | .I "-P " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .I "null|read|write|stat|fstat|open" 17 | [ 18 | .I file 19 | ] 20 | .SH DESCRIPTION 21 | .TP 22 | null 23 | measures how long it takes to do 24 | .IR getppid (). 25 | We chose 26 | .IR getppid () 27 | because in all UNIX variants we are aware of, it requires a round-trip 28 | to/from kernel space and the actual work required inside the kernel is 29 | small and bounded. 30 | .TP 31 | read 32 | measures how long it takes to read one byte from \f(CB/dev/zero\fP. 33 | Note that some operating systems do not support \f(CB/dev/zero\fP. 34 | .TP 35 | write 36 | times how long it takes to write one byte to \f(CB/dev/null\fP. This 37 | is useful as a lower bound cost on anything that has to interact with 38 | the operating system. 39 | .TP 40 | stat 41 | measures how long it takes to 42 | .IR stat () 43 | a file whose inode is already cached. 44 | .TP 45 | fstat 46 | measures how long it takes to 47 | .IR fstat () 48 | an open file whose inode is already cached. 49 | .TP 50 | open 51 | measures how long it takes to 52 | .IR open () 53 | and then 54 | .IR close() 55 | a file. 56 | .SH OUTPUT 57 | Output format is 58 | .sp 59 | .ft CB 60 | Null syscall: 67 microseconds 61 | .ft 62 | .SH ACKNOWLEDGEMENT 63 | Funding for the development of 64 | this tool was provided by Sun Microsystems Computer Corporation. 65 | .SH "SEE ALSO" 66 | lmbench(8). 67 | .SH "AUTHOR" 68 | Carl Staelin and Larry McVoy 69 | .PP 70 | Comments, suggestions, and bug reports are always welcome. 71 | -------------------------------------------------------------------------------- /doc/lat_tcp.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_TCP 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_tcp \- measure interprocess communication latency via TCP/IP 5 | .SH SYNOPSIS 6 | .B lat_tcp 7 | .I -s 8 | .sp .5 9 | .B lat_tcp 10 | [ 11 | .I "-m " 12 | ] 13 | [ 14 | .I "-P " 15 | ] 16 | [ 17 | .I "-W " 18 | ] 19 | [ 20 | .I "-N " 21 | ] 22 | .I hostname 23 | .sp .5 24 | .B lat_tcp 25 | .I "-S hostname" 26 | .SH DESCRIPTION 27 | .B lat_tcp 28 | is a client/server program that measures interprocess 29 | communication latencies. The benchmark passes a message back and forth between 30 | the two processes (this sort of benchmark is frequently referred to as a 31 | ``hot potato'' benchmark). No other work is done in the processes. 32 | .LP 33 | .B lat_tcp 34 | has three forms of usage: as a server (-s), as a client (lat_tcp localhost), and 35 | as a shutdown (lat_tcp -S localhost). 36 | .SH OUTPUT 37 | The reported time is in microseconds per round trip and includes the total 38 | time, i.e., the context switching overhead is includeded. 39 | Output format is like so 40 | .sp 41 | .ft CB 42 | TCP latency using localhost: 700 microseconds 43 | .ft 44 | .SH ACKNOWLEDGEMENT 45 | Funding for the development of 46 | this tool was provided by Sun Microsystems Computer Corporation. 47 | .SH "SEE ALSO" 48 | lmbench(8), lat_fcntl(8), lat_fifo(8), lat_tcp(8), lat_udp(8), lat_unix(8). 49 | .SH "AUTHOR" 50 | Carl Staelin and Larry McVoy 51 | .PP 52 | Comments, suggestions, and bug reports are always welcome. 53 | -------------------------------------------------------------------------------- /doc/lat_tcp.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c 5 | l r r. 6 | System TCP \fBRPC/TCP\fP 7 | = 8 | DEC Alpha 485 788 9 | DEC Alpha 581 822 10 | Linux alpha 419 617 11 | DEC Alpha 629 994 12 | DEC Alpha 428 851 13 | DEC Alpha 267 371 14 | DEC Alpha 526 872 15 | DEC Alpha 412 673 16 | Linux i686 263 427 17 | Sun SC1000 855 1386 18 | DEC Alpha 826 1451 19 | Sun Ultra1 162 346 20 | Linux alpha 429 602 21 | Linux i586 1149 1434 22 | SunOS-5.4 sun4m 560 1196 23 | SunOS-5.4 sun4d 1006 1584 24 | SunOS-5.4 sun4m 826 1631 25 | SunOS-5.4 sun4m 335 784 26 | SunOS-5.4 sun4d 1211 1847 27 | Linux i586 467 713 28 | Linux i486 1592 2147 29 | FreeBSD/i586 264 450 30 | FreeBSD/i586 297 510 31 | IRIX5.3 IP22 278 641 32 | IRIX64-601 IP26 467 1018 33 | IRIX IP22 279 580 34 | Linux i586 477 718 35 | Linux i586 1196 1506 36 | Linux i586 1291 1668 37 | Linux i486 1465 2078 38 | IBM PowerPC 299 698 39 | FreeBSD/i586 312 548 40 | HP-UX 9000/735 222 707 41 | FreeBSD/i586 290 532 42 | HP-UX 9000/770 186 712 43 | FreeBSD/i586 295 535 44 | HP-UX 9000/819 393 668 45 | HP-UX 9000/735 257 805 46 | HP-UX 9000/755 262 812 47 | HP-UX 9000/735 245 800 48 | HP-UX 9000/897 286 854 49 | dgux mc88110 1381 1851 50 | IBM Power2 332 649 51 | IRIX64 IP25 482 806 52 | IRIX IP19 766 913 53 | IRIX64 IP21 643 974 54 | IRIX64 IP19 886 957 55 | HP-UX 9000/735 248 820 56 | IRIX64 IP19 546 900 57 | IRIX5.3 IP19 815 1006 58 | .TE 59 | .KE 60 | -------------------------------------------------------------------------------- /doc/lat_udp.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_UDP 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_udp \- measure interprocess communication latency via UDP/IP 5 | .SH SYNOPSIS 6 | .B lat_udp 7 | .I -s 8 | .sp .5 9 | .B lat_udp 10 | [ 11 | .I "-m " 12 | ] 13 | [ 14 | .I "-P " 15 | ] 16 | [ 17 | .I "-W " 18 | ] 19 | [ 20 | .I "-N " 21 | ] 22 | .I hostname 23 | .sp .5 24 | .B lat_udp 25 | .I "-S hostname" 26 | .SH DESCRIPTION 27 | .B lat_udp 28 | is a client/server program that measures interprocess 29 | communication latencies. The benchmark passes a message back and forth between 30 | the two processes (this sort of benchmark is frequently referred to as a 31 | ``hot potato'' benchmark). No other work is done in the processes. 32 | .LP 33 | .B lat_udp 34 | has three forms of usage: as a server (-s), as a client (lat_udp localhost), and 35 | as a shutdown (lat_udp -S localhost). 36 | .SH OUTPUT 37 | The reported time is in microseconds per round trip and includes the total 38 | time, i.e., the context switching overhead is included. 39 | Output format is like so 40 | .sp 41 | .ft CB 42 | UDP latency using localhost: 650 microseconds 43 | .ft 44 | .SH ACKNOWLEDGEMENT 45 | Funding for the development of 46 | this tool was provided by Sun Microsystems Computer Corporation. 47 | .SH "SEE ALSO" 48 | lmbench(8), lat_fcntl(8), lat_fifo(8), lat_tcp(8), lat_unix(8). 49 | .SH "AUTHOR" 50 | Carl Staelin and Larry McVoy 51 | .PP 52 | Comments, suggestions, and bug reports are always welcome. 53 | -------------------------------------------------------------------------------- /doc/lat_udp.tbl: -------------------------------------------------------------------------------- 1 | .KS 2 | .TS 3 | expand doublebox; 4 | l c c 5 | l r r. 6 | System UDP \fBRPC/UDP\fP 7 | = 8 | DEC Alpha 404 718 9 | Linux alpha 180 317 10 | Linux alpha 199 330 11 | DEC Alpha 259 358 12 | Linux i686 112 217 13 | Linux i486 368 770 14 | Linux i586 187 366 15 | Linux i586 276 538 16 | DEC Alpha 379 717 17 | DEC Alpha 676 765 18 | DEC Alpha 489 834 19 | Sun Ultra1 197 267 20 | Linux i586 281 552 21 | Linux i586 272 553 22 | SunOS-5.4 sun4m 414 622 23 | SunOS-5.4 sun4m 914 1290 24 | DEC Alpha 569 836 25 | Sun SC1000 739 1101 26 | SunOS-5.4 sun4m 590 935 27 | FreeBSD/i586 213 387 28 | FreeBSD/i586 249 408 29 | HP-UX 9000/819 413 655 30 | IRIX5.3 IP22 313 671 31 | IRIX64-601 IP26 474 1008 32 | IRIX IP22 261 562 33 | Linux i486 351 831 34 | DEC Alpha 709 1109 35 | SunOS-5.4 sun4d 1084 1430 36 | SunOS-5.4 sun4d 1180 1562 37 | IRIX IP19 796 903 38 | FreeBSD/i586 240 420 39 | IBM Power2 254 531 40 | IBM PowerPC 206 536 41 | FreeBSD/i586 265 459 42 | IRIX64 IP21 660 783 43 | dgux mc88110 1373 2175 44 | HP-UX 9000/897 289 673 45 | HP-UX 9000/770 185 657 46 | HP-UX 9000/735 244 742 47 | IRIX5.3 IP19 785 960 48 | IRIX64 IP25 486 740 49 | HP-UX 9000/735 248 759 50 | HP-UX 9000/735 246 768 51 | HP-UX 9000/735 252 786 52 | IRIX64 IP19 814 964 53 | HP-UX 9000/755 244 832 54 | IRIX64 IP19 678 893 55 | .TE 56 | .KE 57 | -------------------------------------------------------------------------------- /doc/lat_unix.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_UNIX 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_unix \- measure interprocess communication latency via UNIX sockets 5 | .SH SYNOPSIS 6 | .B lat_unix 7 | [ 8 | .I "-m " 9 | ] 10 | [ 11 | .I "-P " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .SH DESCRIPTION 20 | .B lat_unix 21 | is a client/server program that measures interprocess 22 | communication latencies. The benchmark passes a message back and forth between 23 | the two processes (this sort of benchmark is frequently referred to as a 24 | ``hot potato'' benchmark). No other work is done in the processes. 25 | .SH OUTPUT 26 | The reported time is in microseconds per round trip and includes the total 27 | time, i.e., the context switching overhead is includeded. 28 | Output format is like so 29 | .sp 30 | .ft CB 31 | AF_UNIX sock stream latency: 700 microseconds 32 | .ft 33 | .SH ACKNOWLEDGEMENT 34 | Funding for the development of 35 | this tool was provided by Sun Microsystems Computer Corporation. 36 | .SH "SEE ALSO" 37 | lmbench(8), lat_fcntl(8), lat_fifo(8), lat_tcp(8), lat_udp(8). 38 | .SH "AUTHOR" 39 | Carl Staelin and Larry McVoy 40 | .PP 41 | Comments, suggestions, and bug reports are always welcome. 42 | -------------------------------------------------------------------------------- /doc/lat_unix_connect.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LAT_UNIX_CONNECT 8 "$Date$" "(c)1994 Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | lat_unix_connect \- measure interprocess connection latency via UNIX sockets 5 | .SH SYNOPSIS 6 | .B lat_unix_connect 7 | .I -s 8 | .sp .5 9 | .B lat_unix_connect 10 | [ 11 | .I "-P " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .sp .5 20 | .B lat_unix_connect 21 | .I "-S" 22 | .SH DESCRIPTION 23 | .B lat_unix_connect 24 | is a client/server program that measures interprocess 25 | connection latencies. The benchmark times the creation and connection of 26 | an AF_UNIX socket to a local server. 27 | .LP 28 | .B lat_connect 29 | has three forms of usage: as a server (-s), as a client (lat_connect), 30 | and as a shutdown (lat_connect -S). 31 | .SH OUTPUT 32 | The reported time is in microseconds per connection. 33 | Output format is like so 34 | .sp 35 | .ft CB 36 | UNIX connection cost: 1006 microseconds 37 | .ft 38 | .SH "SEE ALSO" 39 | lmbench(8). 40 | .SH "AUTHOR" 41 | Carl Staelin and Larry McVoy 42 | .PP 43 | Comments, suggestions, and bug reports are always welcome. 44 | -------------------------------------------------------------------------------- /doc/line.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH LINE 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | line \- cache line size 5 | .SH SYNOPSIS 6 | .B line 7 | [ 8 | .I "-M " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .SH DESCRIPTION 17 | .B line 18 | tries to determine the cache line size in bytes of the largest cache 19 | which is smaller than 20 | .I len 21 | bytes. 22 | .LP 23 | .B line 24 | creates pointer chains which access the first word on each cache line 25 | on a page (randomly meandering through all the lines in a page before 26 | jumping to the next page). It measures the average memory latency 27 | for a variety of line sizes, starting with a line size of one word. 28 | When it finds an increase in the average latency that is significantly 29 | larger than the latency for the smaller line size then it assumes that 30 | it has found the line size. 31 | .LP 32 | This algorithm works because for line sizes less than the true line 33 | size, at least two 34 | .B line 35 | cache lines fit in the space of a true cache line. Since that cache 36 | line will be accessed twice, the first access will cause an expensive 37 | cache miss, while the second access will be a cache hit. Once the 38 | .B line 39 | cache line is equal to the true cache line size, then all accesses 40 | will cause cache misses. 41 | .SH BUGS 42 | .B line 43 | is an experimental benchmark, but it seems to work well on most 44 | systems. 45 | .SH "SEE ALSO" 46 | lmbench(8), tlb(8), cache(8), par_mem(8). 47 | .SH "AUTHOR" 48 | Carl Staelin and Larry McVoy 49 | .PP 50 | Comments, suggestions, and bug reports are always welcome. 51 | -------------------------------------------------------------------------------- /doc/lmbench3_signals.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Inches 5 | Letter 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 6 225 1575 1050 2025 11 | 2 2 2 1 0 0 50 0 10 3.000 0 0 -1 0 0 5 12 | 225 1800 375 1800 375 1950 225 1950 225 1800 13 | 2 2 2 1 0 0 50 0 3 3.000 0 0 -1 0 0 5 14 | 225 1575 375 1575 375 1725 225 1725 225 1575 15 | 4 0 0 50 0 0 12 0.0000 4 180 600 450 1725 working\001 16 | 4 0 0 50 0 0 12 0.0000 4 180 465 450 1950 timing\001 17 | -6 18 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 19 | 2025 300 2025 1725 20 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 21 | 2250 300 2250 1575 22 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 23 | 1 1 1.00 60.00 120.00 24 | 750 525 2250 525 25 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 26 | 1 1 1.00 60.00 120.00 27 | 750 825 2250 825 28 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 29 | 1 1 1.00 60.00 120.00 30 | 1575 675 750 675 31 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 32 | 1 1 1.00 60.00 120.00 33 | 1800 975 750 975 34 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 35 | 1 1 1.00 60.00 120.00 36 | 750 1125 2250 1125 37 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 38 | 1800 300 1800 1875 39 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 40 | 1 1 1.00 60.00 120.00 41 | 3000 600 2250 600 42 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 43 | 1 1 1.00 60.00 120.00 44 | 1575 675 3000 675 45 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 46 | 1 1 1.00 60.00 120.00 47 | 3000 900 2250 900 48 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 49 | 1 1 1.00 60.00 120.00 50 | 1800 1200 3000 1200 51 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 52 | 1 1 1.00 60.00 120.00 53 | 3000 1275 2250 1275 54 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 55 | 1 1 1.00 60.00 120.00 56 | 2025 1350 3000 1350 57 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 58 | 1500 750 1650 600 59 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 60 | 1950 1425 2100 1275 61 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 62 | 1500 75 2325 75 2325 300 1500 300 1500 75 63 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 64 | 1575 300 1575 2025 65 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 66 | 1 1 1.00 60.00 120.00 67 | 2025 1350 750 1350 68 | 2 2 2 1 0 0 50 0 3 3.000 0 0 -1 0 0 5 69 | 150 525 750 525 750 975 150 975 150 525 70 | 2 2 2 1 0 0 50 0 10 3.000 0 0 -1 0 0 5 71 | 150 675 750 675 750 825 150 825 150 675 72 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 73 | 150 225 750 225 750 1350 150 1350 150 225 74 | 2 2 2 1 0 0 50 0 3 3.000 0 0 -1 0 0 5 75 | 3000 600 3600 600 3600 1200 3000 1200 3000 600 76 | 2 2 2 1 0 0 50 0 10 3.000 0 0 -1 0 0 5 77 | 3000 675 3600 675 3600 900 3000 900 3000 675 78 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 79 | 3000 225 3600 225 3600 1425 3000 1425 3000 225 80 | 4 0 0 50 0 0 12 0.0000 4 150 480 1650 225 parent\001 81 | 4 0 0 50 0 1 12 0.0000 4 180 420 900 525 ready\001 82 | 4 0 0 50 0 1 12 0.0000 4 135 360 900 825 done\001 83 | 4 0 0 50 0 1 12 0.0000 4 135 495 1200 975 results\001 84 | 4 0 0 50 0 1 12 0.0000 4 180 1020 825 1125 timing results\001 85 | 4 0 0 50 0 0 12 0.0000 4 135 450 3075 375 child1\001 86 | 4 0 0 50 0 1 12 0.0000 4 135 495 2325 1200 results\001 87 | 4 0 0 50 0 1 12 0.0000 4 180 420 2550 600 ready\001 88 | 4 0 0 50 0 1 12 0.0000 4 135 360 2550 900 done\001 89 | 4 0 0 50 0 1 12 0.0000 4 135 165 1350 675 go\001 90 | 4 0 0 50 0 1 12 0.0000 4 135 300 1275 1350 exit\001 91 | 4 0 0 50 0 0 12 0.0000 4 105 360 1650 2025 start\001 92 | 4 0 0 50 0 0 12 0.0000 4 135 690 2325 1575 response\001 93 | 4 0 0 50 0 0 12 0.0000 4 135 285 2100 1725 exit\001 94 | 4 0 0 50 0 0 12 0.0000 4 135 435 1875 1875 result\001 95 | 4 0 0 50 0 0 12 0.0000 4 135 450 225 375 child0\001 96 | -------------------------------------------------------------------------------- /doc/memhier-color.d: -------------------------------------------------------------------------------- 1 | frame invis ht 1.5 wid 2.5 left solid bot solid 2 | label top "\fBalpha Linux 2.2.16-3\fR" down 0.3 3 | label bot "Size (MB)" 4 | label left "Latency (ns)" 5 | coord log log 6 | ticks bottom out at 0.000512 "512", 0.001024 "", 0.002048 "", 0.004096 "", 0.008192 "8K", 0.016384 "", 0.032768 "", 0.065536 "", 0.098304 "96K", 0.131072 "", 0.262144 "", 0.524288 "", 1.048576 "1M", 2.097152 "", 4.194304 "", 8.388608 "", 16.777216 "", 33.554432 "32M" 7 | draw dotted 8 | 0.000512 4.042 9 | 0.008192 4.046 10 | 0.010240 8.873 11 | 0.012288 12.085 12 | 0.016384 16.097 13 | 0.032768 16.103 14 | 0.065536 19.908 15 | 0.098304 20.622 16 | 0.114688 29.808 17 | 0.131072 37.724 18 | 0.196608 47.561 19 | 0.262144 52.134 20 | 0.524288 66.410 21 | 1.048576 74.897 22 | 1.310720 153.075 23 | 1.572864 198.678 24 | 2.097152 264.935 25 | 3.145728 333.862 26 | 4.194304 366.109 27 | 8.388608 370.522 28 | 33.554432 370.682 29 | "Colored" ljust at 1.572864, 222.789 30 | draw solid 31 | 0.000512 4.042 32 | 0.000640 4.043 33 | 0.000768 4.044 34 | 0.000896 4.043 35 | 0.001024 4.043 36 | 0.001280 4.044 37 | 0.001536 4.044 38 | 0.001792 4.044 39 | 0.002048 4.041 40 | 0.002560 4.044 41 | 0.003072 4.045 42 | 0.003584 4.044 43 | 0.004096 4.045 44 | 0.005120 4.046 45 | 0.006144 4.047 46 | 0.007168 4.048 47 | 0.008192 4.048 48 | 0.010240 8.872 49 | 0.012288 12.079 50 | 0.014336 14.379 51 | 0.016384 16.097 52 | 0.020480 16.104 53 | 0.024576 16.117 54 | 0.028672 16.114 55 | 0.032768 16.106 56 | 0.040960 16.110 57 | 0.049152 16.123 58 | 0.057344 18.062 59 | 0.065536 19.179 60 | 0.081920 97.039 61 | 0.098304 84.011 62 | 0.114688 81.764 63 | 0.131072 79.122 64 | 0.163840 82.634 65 | 0.196608 108.550 66 | 0.229376 104.530 67 | 0.262144 119.771 68 | 0.327680 111.317 69 | 0.393216 131.057 70 | 0.458752 143.902 71 | 0.524288 173.323 72 | 0.655360 197.268 73 | 0.786432 219.736 74 | 0.917504 224.743 75 | 1.048576 249.878 76 | 1.310720 287.157 77 | 1.572864 302.857 78 | 1.835008 315.170 79 | 2.097152 329.874 80 | 2.621440 347.418 81 | 3.145728 357.183 82 | 3.670016 362.297 83 | 4.194304 365.720 84 | 5.242880 369.345 85 | 33.554432 370.296 86 | "Malloc'ed" rjust at 0.458752, 219.736 87 | -------------------------------------------------------------------------------- /doc/memhier-line.d: -------------------------------------------------------------------------------- 1 | frame invis ht 1.5 wid 2.5 left solid bot solid 2 | label top "\fBalpha Linux 2.2.16-3\fR" down 0.3 3 | label bot "Line Size (Bytes)" 4 | label left "Latency (ns)" 5 | coord log log 6 | ticks bottom out from 8 to 512 by *4 7 | ticks bottom out from 8 to 512 by *2 "" 8 | draw solid 9 | 8 7.247 10 | 16 10.909 11 | 32 16.788 12 | 64 17.083 13 | 128 16.272 14 | 256 16.721 15 | 512 16.129 16 | "L1" rjust above at 512, 16.129 17 | draw solid 18 | 8 22.853 19 | 16 41.496 20 | 32 78.712 21 | 64 141.658 22 | 128 139.119 23 | 256 138.446 24 | 512 137.902 25 | "L2" rjust above at 512, 137.902 26 | draw solid 27 | 8 51.529 28 | 16 98.915 29 | 32 193.614 30 | 64 372.230 31 | 128 371.689 32 | 256 371.486 33 | 512 371.486 34 | "L3" rjust above at 512, 371.486 35 | -------------------------------------------------------------------------------- /doc/mhz.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH MHZ 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | mhz \- calulate processor clock rate 5 | .SH SYNOPSIS 6 | .B mhz 7 | .I [-c] 8 | .SH DESCRIPTION 9 | .B mhz 10 | calculates the processor clock rate and megahertz. It uses an 11 | unrolled, interlocked loop of adds or shifts. So far, superscalarness 12 | has been defeated on the tested processors (SuperSPARC, RIOS, Alpha). 13 | .SH OUTPUT 14 | Output format is either just the clock rate as a float (-c) or more verbose 15 | .sp 16 | .ft CB 17 | 39.80 Mhz, 25 nanosec clock 18 | .ft 19 | .LP 20 | .B mhz 21 | is described more completely in ``mhz: Anatomy of a microbenchmark'' 22 | in 23 | .I "Proceedings of 1998 USENIX Annual Technical Conference", June 1998. 24 | .SH "SEE ALSO" 25 | lmbench(8). 26 | .SH "AUTHOR" 27 | Carl Staelin and Larry McVoy 28 | .PP 29 | Comments, suggestions, and bug reports are always welcome. 30 | -------------------------------------------------------------------------------- /doc/par_mem.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH PAR_MEM 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | par_mem \- memory parallelism benchmark 5 | .SH SYNOPSIS 6 | .B par_mem 7 | [ 8 | .I "-L " 9 | ] 10 | [ 11 | .I "-M " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .SH DESCRIPTION 20 | .B par_mem 21 | measures the available parallelism in the memory hierarchy, up to 22 | .I len 23 | bytes. Modern processors can often service multiple memory requests 24 | in parallel, while older processors typically blocked on LOAD 25 | instructions and had no available parallelism (other than that 26 | provided by cache prefetching). 27 | .B par_mem 28 | measures the available parallelism at a variety of points, since the 29 | available parallelism is often a function of the data location in the 30 | memory hierarchy. 31 | .LP 32 | In order to measure the available parallelism 33 | .B par_mem 34 | conducts a variety of experiments at each memory size; one for each 35 | level of parallelism. It builds a pointer chain of the desired 36 | length. It then creates an array of pointers which point to chain 37 | entries which are evenly spaced across the chain. Then it starts 38 | running the pointers forward through the chain in parallel. It can 39 | then measure the average memory latency for each level of parallelism, 40 | and the available parallelism is the minimum average memory latency 41 | for parallelism 1 divided by the average memory latency across all 42 | levels of available parallelism. 43 | .LP 44 | For example, the inner loop which measures parallelism 2 would look 45 | something like: 46 | .sp 47 | .ft CB 48 | for (i = 0; i < N; ++i) { 49 | p0 = (char **)*p0; 50 | p1 = (char **)*p1; 51 | } 52 | .ft 53 | .sp 54 | in a 55 | .I for 56 | loop (the overhead of the 57 | .I for 58 | loop is not significant; the loop is an unrolled loop 100 loads long). 59 | In this case, if the hardware can process two LOAD operations in parallel, 60 | then the overall latency of the loop should be equivalent to that of a 61 | single pointer chain, so the measured parallelism would be roughly two. 62 | If, however, the hardware can only process a single LOAD operation at 63 | once, or if there is (significant) resource contention between the two 64 | LOAD operations, then the loop will be much slower than a loop with a 65 | single pointer chain, so the measured parallelism will be less than 66 | two, and probably no smaller than one. 67 | .SH OUTPUT 68 | Output format is intended as input to \fBxgraph\fP or some similar program 69 | (we use a perl script that produces pic input). 70 | There is a set of data produced for each stride. The data set title 71 | is the stride size and the data points are the array size in megabytes 72 | (floating point value) and the load latency over all points in that array. 73 | .SH "SEE ALSO" 74 | lmbench(8), line(8), cache(8), tlb(8), par_ops(8). 75 | .SH "AUTHOR" 76 | Carl Staelin and Larry McVoy 77 | .PP 78 | Comments, suggestions, and bug reports are always welcome. 79 | -------------------------------------------------------------------------------- /doc/par_ops.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH PAR_OPS 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | par_ops \- basic CPU operation parallelism 5 | .SH SYNOPSIS 6 | .B par_ops 7 | [ 8 | .I "-W " 9 | ] 10 | [ 11 | .I "-N " 12 | ] 13 | .SH DESCRIPTION 14 | .B par_ops 15 | measures the available parallelism for basic CPU operations, such as 16 | integer ADD. Results are reported as the average operation latency 17 | divided by the minimum average operation latency across all levels of 18 | parallelism. 19 | .TP 20 | integer bit, add, mul, div, mod operations; 21 | maximum parallelism for integer XOR, ADD, MUL, DIV, MOD operations. 22 | .TP 23 | uint64 bit, add, mul, div, mod operations; 24 | maximum parallelism for uint64 XOR, ADD, MUL, DIV, MOD operations. 25 | .TP 26 | float add, mul, div operations; 27 | maximum parallelism for flot ADD, MUL, DIV operations. 28 | .TP 29 | double add, mul, div operations; 30 | maximum parallelism for flot ADD, MUL, DIV operations. 31 | .SH BUGS 32 | This benchmark is highly experimental and may sometimes (frequently?) 33 | give erroneous results. 34 | .SH "SEE ALSO" 35 | lmbench(8), lat_ops(8), par_mem(8). 36 | .SH "AUTHOR" 37 | Carl Staelin and Larry McVoy 38 | .PP 39 | Comments, suggestions, and bug reports are always welcome. 40 | -------------------------------------------------------------------------------- /doc/refdbms.keys: -------------------------------------------------------------------------------- 1 | Chen93d 2 | Chen94a 3 | Fenwick95 4 | Howard88 5 | Jain91 6 | McCalpin95 7 | Ousterhout90 8 | Park90 9 | Smith82b 10 | Smith85 11 | Wolman89 12 | Wong88 13 | Agarwal95 14 | Bailey93 15 | Bitton83 16 | Chen91b 17 | Dietrich92 18 | Leutenegger93 19 | Nelson89 20 | TPPC92 21 | -------------------------------------------------------------------------------- /doc/references.private: -------------------------------------------------------------------------------- 1 | %z Article 2 | %K McCalpin95 3 | %A John D. McCalpin 4 | %T Memory bandwidth and machine balance in current high performance computers 5 | %J IEEE Technical Committee on Computer Architecture newsletter 6 | %V to appear 7 | %D Dec. 1995 8 | -------------------------------------------------------------------------------- /doc/reporting.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" @(#)lmbench.man 2.0 98/04/24 3 | .\" 4 | .\" lmbench - benchmarking toolbox 5 | .\" 6 | .\" Copyright (C) 1998 Carl Staelin and Larry McVoy 7 | .\" E-mail: staelin@hpl.hp.com 8 | .\" 9 | .TH "lmbench reporting" 3 "$Date:" "(c)1998-2000 Larry McVoy and Carl Staelin" "LMBENCH" 10 | .SH "NAME" 11 | milli, micro, nano, mb, kb \- the lmbench reporting subsystem 12 | .SH "SYNOPSIS" 13 | .B "#include ``lmbench.h''" 14 | .LP 15 | .B "void milli(char *s, uint64 n)" 16 | .LP 17 | .B "void micro(char *s, uint64 n)" 18 | .LP 19 | .B "void nano(char *s, uint64 n)" 20 | .LP 21 | .B "void mb(uint64 bytes)" 22 | .LP 23 | .B "void kb(uint64 bytes)" 24 | .SH "DESCRIPTION" 25 | Creating benchmarks using the 26 | .I lmbench 27 | timing harness is easy. 28 | Since it is so easy to measure performance using 29 | .IR lmbench , 30 | it is possible to quickly answer questions that arise during system 31 | design, development, or tuning. For example, image processing 32 | .LP 33 | There are two attributes that are critical for performance, latency 34 | and bandwidth, and 35 | .IR lmbench 's 36 | timing harness makes it easy to measure and report results for both. 37 | The measurement interface, 38 | .B benchmp 39 | is the same, but the reporting functions are different. 40 | Latency is usually important for frequently executed operations, and 41 | bandwidth is usually important when moving large chunks of data. 42 | .TP 43 | .B "void milli(char *s, uint64 n)" 44 | print out the time per operation in milli-seconds. 45 | .I n 46 | is the number of operations during the timing interval, which is passed 47 | as a parameter because each 48 | .I loop_body 49 | can contain several operations. 50 | .TP 51 | .B "void micro(char *s, uint64 n)" 52 | print the time per opertaion in micro-seconds. 53 | .TP 54 | .B "void nano(char *s, uint64 n)" 55 | print the time per operation in nano-seconds. 56 | .TP 57 | .B "void mb(uint64 bytes)" 58 | print the bandwidth in megabytes per second. 59 | .TP 60 | .B "void kb(uint64 bytes)" 61 | print the bandwidth in kilobytes per second. 62 | .SH "FUTURES" 63 | Development of 64 | .I lmbench 65 | is continuing. 66 | .SH "SEE ALSO" 67 | lmbench(8), lmbench(3), timing(3), results(3) 68 | .SH "AUTHOR" 69 | Carl Staelin and Larry McVoy 70 | .PP 71 | Comments, suggestions, and bug reports are always welcome. 72 | -------------------------------------------------------------------------------- /doc/results.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" @(#)results.man 2.0 98/04/24 3 | .\" 4 | .\" results - lmbench results subsystem 5 | .\" 6 | .\" Copyright (C) 1998 Carl Staelin and Larry McVoy 7 | .\" E-mail: staelin@hpl.hp.com 8 | .\" 9 | .TH "lmbench result management" 3 "$Date:$" "(c)1998 Larry McVoy" "LMBENCH" 10 | .SH "NAME" 11 | insertinit, insertsort, get_results, set_results, save_median, save_minimum 12 | \- the lmbench results subsystem 13 | .SH "SYNOPSIS" 14 | .B "#include ``lmbench.h''" 15 | .LP 16 | .B "#define TRIES 11" 17 | .LP 18 | .B "typedef struct { uint64 u, n } value_t;" 19 | .LP 20 | .B "typedef struct { int N; value_t v[TRIES]; } result_t;" 21 | .LP 22 | .B "int sizeof_result(int N)" 23 | .LP 24 | .B "void insertinit(result_t *r)" 25 | .LP 26 | .B "void insertsort(uint64 u, uint64 n, result_t *r)" 27 | .LP 28 | .B "result_t* get_results()" 29 | .LP 30 | .B "void set_results(result_t *r)" 31 | .LP 32 | .B "void save_median()" 33 | .LP 34 | .B "void save_minimum()" 35 | .SH "DESCRIPTION" 36 | These routines provide some simple data management functionality. 37 | In most cases, you will not need these routines. 38 | .LP 39 | The current timing results can be accessed using the routines in 40 | timing(3). The current timing results may be modified using 41 | .B save_median 42 | and 43 | .BR save_minimum . 44 | .TP 45 | .B "int sizeof_result(int N)" 46 | returns the number of bytes to allocate for a result_t which contains 47 | .I N 48 | results. 49 | .TP 50 | .B "void insertinit(result_t *r)" 51 | initializes the results array. 52 | .TP 53 | .B "void insertsort(uint64 u, uint64 n, result_t *r)" 54 | insert 55 | .I u 56 | and 57 | .I n 58 | into 59 | .IR r . 60 | Results are sorted in decreasing order by 61 | .IR u/n . 62 | .TP 63 | .B "void get_results(result_t *r)" 64 | get a copy of the current results. 65 | .TP 66 | .B "void set_results(result_t *r)" 67 | save a copy 68 | .I r 69 | as the current results. 70 | .TP 71 | .B "void save_median()" 72 | sets the timing results to the median of the current results. 73 | .TP 74 | .B "void save_minimum()" 75 | sets the timing restuls to the minimum of the current results. 76 | .LP 77 | Results are sorted in ascending order, so the minimum value is at 78 | .B TRIES-1 79 | and the maximum value is at 80 | .BR 0 . 81 | .SH "FUTURES" 82 | Development of \fIlmbench\fR is continuing. 83 | .SH "SEE ALSO" 84 | lmbench(8), lmbench(3), reporting(3), results(3) 85 | .SH "AUTHOR" 86 | Carl Staelin and Larry McVoy 87 | .PP 88 | Comments, suggestions, and bug reports are always welcome. 89 | -------------------------------------------------------------------------------- /doc/stream.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH stream 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | stream \- John McCalpin's STREAM benchmark 5 | .SH SYNOPSIS 6 | .B stream 7 | [ 8 | .I "-M " 9 | ] 10 | [ 11 | .I "-W " 12 | ] 13 | [ 14 | .I "-N " 15 | ] 16 | .SH DESCRIPTION 17 | .B stream 18 | mimics John McCalpin's STREAM benchmark. It measures memory bandwidth. 19 | .SH BUGS 20 | .B stream 21 | is an experimental benchmark, but it seems to work well on most 22 | systems. 23 | .SH "SEE ALSO" 24 | lmbench(8), bw_mem(8), line(8), tlb(8), cache(8), par_mem(8). 25 | .SH "AUTHOR" 26 | Carl Staelin and Larry McVoy 27 | .PP 28 | Comments, suggestions, and bug reports are always welcome. 29 | -------------------------------------------------------------------------------- /doc/tlb.8: -------------------------------------------------------------------------------- 1 | .\" $Id$ 2 | .TH TLB 8 "$Date$" "(c)2000 Carl Staelin and Larry McVoy" "LMBENCH" 3 | .SH NAME 4 | tlb \- TLB size and latency benchmark 5 | .SH SYNOPSIS 6 | .B tlb 7 | [ 8 | .I "-L " 9 | ] 10 | [ 11 | .I "-M " 12 | ] 13 | [ 14 | .I "-W " 15 | ] 16 | [ 17 | .I "-N " 18 | ] 19 | .SH DESCRIPTION 20 | .B tlb 21 | tries to determine the size, in pages, of the TLB. 22 | The largest amount of memory it will examine is 23 | .I len 24 | bytes. 25 | .LP 26 | .B tlb 27 | compares the memory latency for two different pointer chains. 28 | The two chains occupy the same amount of cache space, but they stress 29 | the memory subsystem differently. The first chain accesses one word 30 | per page, while the second chain 31 | randomly jumps through all the lines on a page before jumping to the 32 | next page. When all of the pointers reside in the cache (which is the 33 | usual case), and all of the pages for the first chain reside in the 34 | TLB, then the average memory latencies should be identical. Assuming 35 | there is a fixed size TLB, then at some point the number of pages 36 | accessed by the first page will be larger than the TLB. At this point 37 | the average latency for each memory access for the first chain will be 38 | a cache hit plus some fraction of a TLB miss. 39 | .LP 40 | Once the TLB boundary is located 41 | .B tlb 42 | reports the TLB miss latency as the TLB latency for twice as many 43 | pages as the TLB can hold. 44 | .SH BUGS 45 | .B tlb 46 | is an experimental benchmark, but it seems to work well on most 47 | systems. However, if a processor has a TLB hierarchy 48 | .B tlb 49 | only finds the top level TLB. 50 | .SH "SEE ALSO" 51 | lmbench(8), line(8), cache(8), par_mem(8). 52 | .SH "AUTHOR" 53 | Carl Staelin and Larry McVoy 54 | .PP 55 | Comments, suggestions, and bug reports are always welcome. 56 | -------------------------------------------------------------------------------- /doc/usenix.ol: -------------------------------------------------------------------------------- 1 | Introduction 2 | What is it? 3 | A bunch of speed of light benchmarks, 4 | not MP, not throughput, not saturation, not stress tests. 5 | A microbenchmark suite 6 | Measures system performance 7 | Latency and bandwidth measurements 8 | Measurements focus on OS and hardware 9 | What is delivered to the application 10 | Not marketing numbers 11 | Benchmark performance predicts application performance 12 | Results for which systems? 13 | Sun, SGI, DEC, IBM, HP, PCs 14 | Useful information to whom? 15 | Performance engineers, system programmers, system architects. 16 | Motivation 17 | What are we measuring? 18 | Control / latecy operatins 19 | Bandwidth operations 20 | What aren't we measuring? 21 | Basic MIPS & MFLOPS. XXX - not unless I do it right. 22 | What can I learn? 23 | Cost of operations 24 | ****Operations per time unit**** 25 | Compare speed of alternative paths (e.g. mmap vs. read) 26 | Performance problems = f(bw issues + latency issues) 27 | Give at least two examples 28 | NFS control & data: UDP lat, proc lat, & various BW metrics 29 | Oracle lock manager: TCP lat 30 | Verilog: mem lat 31 | AIM: fs ops XXX -ask Scott about pipes. 32 | Knowing the speeds of primitives can provide speeds of apps. 33 | An example here would be nice. 34 | Outline 35 | Describe benchmark 36 | Give results from current machines 37 | Discuss results 38 | Future changes, enhancements, etc. 39 | Tutorial on benchmarks 40 | For each metric 41 | what is it? 42 | why is it being measured? 43 | How is it measured? 44 | Measuring subtlities 45 | Interpreting the results 46 | Latency 47 | Process stuff 48 | networking stuff 49 | file system stuff 50 | memory stuff 51 | whatever 52 | Bandwidth 53 | networking 54 | file system 55 | memory 56 | Results 57 | Tabular results - XXX update that table to reflect the newer metrics 58 | Graphs of memory latency & context switches 59 | Discussion 60 | Memory stuff 61 | Maybe contrast AIX with the $100K IBM 62 | uniprocessor w/ killer memory perf and point out 63 | that it is the memory that is making AIX go 64 | fast, it certainly isn't AIX. A more politic 65 | observation would be that systems with good 66 | memory performace tend to have good system 67 | performance; the point being to shift people's 68 | attention to system performance, especially 69 | memory subsystem, as opposed to processor mips. 70 | Comparisons 71 | Maybe look at the table and draw attention to 72 | really good and really bad numbers for various 73 | platforms (like Linux' context switch time, 74 | Linux fs ops, solaris syscall, process stuff, 75 | 990 memory BW). 76 | Graphs 77 | A graph showing a range of really fast to really slow ops, all on the 78 | same graph. Do bandwidth stuff normalized on MB/sec. 79 | Carl sez: show both ops/sec and cost/op on two graphs. 80 | A graph showing processor slow down due to memory misses, assuming 81 | each instruction misses. Maybe a graph that shows # of clocks 82 | (or better yet, # of instructions - think super scalar) that you would 83 | have to have between each memory miss in order to run at the clock 84 | speed. 85 | War stories 86 | Sun page coloring bug 87 | SGI page coloring bug 88 | SGI hippi bug - XXX ask Thomas 89 | Sun bcopy bug 90 | Lmbench [optional?] 91 | how to get lmbench 92 | how to compile 93 | how to run 94 | how to show results 95 | Future work 96 | More hardware stuff - better latency measurements (write lat, 97 | cache to cache latency). 98 | add throughput & saturation measurements 99 | TODO 100 | get some similar papers for comparison 101 | Someday I need reasonable I/O benchmarks to show off good 102 | big SMP machines like Challenge. 103 | -------------------------------------------------------------------------------- /scripts/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for lmbench scripts subdir. 2 | #$Id$ 3 | 4 | get: 5 | get -s 6 | 7 | clean: 8 | -------------------------------------------------------------------------------- /scripts/README: -------------------------------------------------------------------------------- 1 | $Id$ 2 | 3 | This directory contains scripts used to generate or post process lmbench 4 | output. You probably do not want to be here or run these by hand, the 5 | Makefiles in ../src and ../results invoke these. There are some useful 6 | scripts here, however, in particular the graphing scripts. If you are 7 | interested in groff graphing tools, check out ../doc/*graph.1. 8 | -------------------------------------------------------------------------------- /scripts/TODO: -------------------------------------------------------------------------------- 1 | Make graph take a %T and %T2 and put %T above %T2 2 | 3 | Or make it take \n in the title and deal. 4 | -------------------------------------------------------------------------------- /scripts/allctx: -------------------------------------------------------------------------------- 1 | 2 | # Extract the context switching information from lmbench result files. 3 | # Usage: getctx file file.... 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1994 Larry McVoy. GPLed software. 7 | # $Id$ 8 | eval 'exec perl -Ss $0 "$@"' 9 | if 0; 10 | 11 | $first = 1; 12 | foreach $file (@ARGV) { 13 | open(FD, $file); 14 | $file =~ s|.*/||; 15 | $file =~ s/\.\d+//; 16 | while () { 17 | chop; 18 | if (/^\[lmbench/) { 19 | @_ = split; 20 | if ($_[3] eq "SunOS") { 21 | $_[3] .= "-$_[5]"; 22 | } 23 | $uname = "@_"; 24 | } 25 | if (/Mhz/) { 26 | $mhz = $_; 27 | } 28 | if (/^.size=/) { 29 | s/size/Process size/; 30 | s/ ovr/\toverhead/; 31 | @info = &getinfo($uname, $mhz); 32 | ($f = $file) =~ s|.*/||; 33 | print "\n" unless $first; 34 | $first = 0; 35 | print "%T $info[3] $info[$#info]Mhz\n"; 36 | print "$_\n"; 37 | while () { 38 | last if /^Null/ || /^Pipe/ || /^Memor/; 39 | next if /\$Id/; 40 | s/ ovr/\toverhead/; 41 | s/size/Process size/; 42 | print ; 43 | } 44 | last; 45 | } 46 | } 47 | } 48 | exit 0; 49 | 50 | # Try and create sensible names from uname -a output 51 | sub getinfo 52 | { 53 | local(@info); 54 | local($name); 55 | local($mhz) = sprintf("%.0f", $_[1]); 56 | 57 | @info = split(/\s+/, $_[0]); 58 | $name = pop(@info); 59 | chop($name); 60 | if ($name eq "mips") { 61 | $name = "$info[$#info]@$mhz"; 62 | } elsif ($_[0] =~ /HP-UX/) { 63 | $name = "$info[7]@$mhz"; 64 | } elsif ($_[0] =~ /SunOS/) { 65 | $name = "$info[7]@$mhz"; 66 | } else { 67 | $name .= "@$mhz"; 68 | } 69 | push(@info, $name); 70 | @info; 71 | } 72 | -------------------------------------------------------------------------------- /scripts/allmem: -------------------------------------------------------------------------------- 1 | 2 | # Extract the memory latency graph data from lmbench result files. 3 | # 4 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 5 | # Copyright (c) 1994 Larry McVoy. GPLed software. 6 | # $Id$ 7 | eval 'exec perl -Ss $0 "$@"' 8 | if 0; 9 | 10 | # Uses a stride of 128 11 | #print "\"%X Array size\n\"%Y Latency in nanoseconds\n"; 12 | foreach $file (@ARGV) { 13 | open(FD, $file); 14 | $file =~ s|.*/||; 15 | while () { 16 | chop; 17 | if (/^\[lmbench/) { 18 | @_ = split; 19 | if ($_[3] eq "SunOS") { 20 | $_[3] .= "-$_[5]"; 21 | } 22 | $uname = "@_"; 23 | } 24 | if (/Mhz/) { 25 | $mhz = $_; 26 | } 27 | if (/^Memory load latency/) { 28 | @info = &getinfo($uname, $mhz); 29 | ($f = $file) =~ s|.*/||; 30 | print "\"$file $info[3] $info[$#info]\n"; 31 | while () { 32 | next unless /^"stride=128/; 33 | last; 34 | } 35 | while () { 36 | if (/^\s*$/) { 37 | print "\n"; 38 | last; 39 | } 40 | print; 41 | } 42 | last; 43 | } 44 | } 45 | } 46 | exit 0; 47 | 48 | # Try and create sensible names from uname -a output 49 | sub getinfo 50 | { 51 | local(@info); 52 | local($name); 53 | local($mhz) = sprintf("%.0f", $_[1]); 54 | 55 | @info = split(/\s+/, $_[0]); 56 | $name = pop(@info); 57 | chop($name); 58 | if ($name eq "mips") { 59 | $name = "$info[$#info]@$mhz"; 60 | } elsif ($_[0] =~ /HP-UX/) { 61 | $name = "$info[7]@$mhz"; 62 | } elsif ($_[0] =~ /SunOS/) { 63 | $name = "$info[7]@$mhz"; 64 | } else { 65 | $name .= "@$mhz"; 66 | } 67 | push(@info, $name); 68 | @info; 69 | } 70 | -------------------------------------------------------------------------------- /scripts/bghtml: -------------------------------------------------------------------------------- 1 | 2 | # Make HTML files that will point to the right GIF files. 3 | # Usage: bghtml file file file.... 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1995 Larry McVoy. GPLed software. 7 | # $Id$ 8 | eval 'exec perl -Ss $0 "$@"' 9 | if 0; 10 | 11 | $bar = 0; 12 | for ($i = 0; $i <= $#ARGV; ++$i) { 13 | $file = $ARGV[$i]; $file =~ s|tmp/||; $file =~ s|.bg$||; 14 | if ($i > 0) { 15 | $prev = $ARGV[$i - 1]; 16 | $prev =~ s|tmp/||; 17 | $prev =~ s|.bg$||; 18 | $prev_html = "${prev}.html"; 19 | } 20 | if ($i < $#ARGV) { 21 | $next = $ARGV[$i + 1]; 22 | $next =~ s|tmp/||; 23 | $next =~ s|.bg$||; 24 | $next_html = "${next}.html"; 25 | } 26 | $name = "HTML/${file}.html"; 27 | open(F, ">$name"); 28 | print F "Man page for this benchmark

\n"; 29 | $str = sprintf("\n", ++$bar); 30 | print F "$str

"; 31 | print F "\n"; 32 | print F "\n"; 33 | print F "\n" 34 | if $i > 0; 35 | print F "\n" 36 | if $i < $#ARGV; 37 | close(F); 38 | } 39 | exit 0; 40 | -------------------------------------------------------------------------------- /scripts/compiler: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "X$CC" != "X" ] && echo "$CC" | grep '`' > /dev/null 4 | then 5 | CC= 6 | fi 7 | 8 | if [ X$CC = X ] 9 | then CC=cc 10 | for p in `echo $PATH | sed 's/:/ /g'` 11 | do if [ -f $p/gcc ] 12 | then CC=gcc 13 | fi 14 | done 15 | fi 16 | echo $CC 17 | -------------------------------------------------------------------------------- /scripts/config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | UNAME=`uname -n 2>/dev/null` 4 | if [ X$UNAME = X ] 5 | then echo CONFIG 6 | else echo CONFIG.$UNAME 7 | fi 8 | -------------------------------------------------------------------------------- /scripts/depend: -------------------------------------------------------------------------------- 1 | 2 | # Figure out dependencies for lmbench src. 3 | # 4 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 5 | # Copyright (c) 1994 Larry McVoy. GPLed software. 6 | # $Id$ 7 | eval 'exec perl -Ssw $0 "$@"' 8 | if 0; 9 | 10 | open(M, "Makefile"); 11 | while() { 12 | push(@Makefile, $_); 13 | last if /^..MAKEDEPEND/; 14 | } 15 | close(M); 16 | open(G, "gcc -MM *.c | grep -v mhz.c | grep -v lat_ctx.c|"); 17 | while () { 18 | @_ = chop; 19 | @_ = split(/:/); 20 | $_[0] =~ s/\.o\s*$//; 21 | push(@Makefile, "\$O/$_[0]: $_[1] \$O/lmbench.a\n"); 22 | push(@Makefile, "\t\$(COMPILE) -o \$O/$_[0] $_[0].c \$O/lmbench.a \$(LDLIBS)\n\n"); 23 | } 24 | system "mv Makefile Makefile.old"; 25 | open(M, ">Makefile"); 26 | print M @Makefile; 27 | close(M); 28 | exit 0; 29 | -------------------------------------------------------------------------------- /scripts/do_ctx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Make sure we can find: ./cmd, df, and netstat 4 | PATH=.:$PATH:/etc:/usr/etc:/sbin:/usr/sbin 5 | export PATH 6 | 7 | if [ X$MB = X ] 8 | then MB=8 9 | fi 10 | AVAILKB=`expr $MB \* 1024` 11 | 12 | # Figure out how big we can go for stuff that wants to use 13 | # all and half of memory. 14 | HALF="512 1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1m" 15 | ALL="$HALF 2m" 16 | i=4 17 | while [ $i -le $MB ] 18 | do 19 | ALL="$ALL ${i}m" 20 | h=`expr $i / 2` 21 | HALF="$HALF ${h}m" 22 | i=`expr $i \* 2` 23 | done 24 | 25 | msleep 250 26 | if [ "X$CTX" = X ] 27 | then CTX="0 4 8 16 32 64" 28 | fi 29 | if [ "X$N" = X ] 30 | then N="2 4 8 16 24 32 64 96" 31 | fi 32 | for size in $CTX 33 | do lat_ctx -s $size $N 34 | done 35 | exit 0 36 | -------------------------------------------------------------------------------- /scripts/getctx: -------------------------------------------------------------------------------- 1 | 2 | # Extract the context switching information from lmbench result files. 3 | # Usage: getctx file file.... 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1994 Larry McVoy. GPLed software. 7 | # $Id$ 8 | eval 'exec perl -Ss $0 "$@"' 9 | if 0; 10 | 11 | $title = "foo" if 0; 12 | 13 | foreach $file (@ARGV) { 14 | open(FD, $file); 15 | while () { 16 | chop; 17 | if (/^\[lmbench/) { 18 | @_ = split; 19 | if ($_[3] eq "SunOS") { 20 | $_[3] .= "-$_[5]"; 21 | } 22 | $uname = "@_"; 23 | } 24 | if (/Mhz/) { 25 | $mhz = $_; 26 | } 27 | if (/^.size=/) { 28 | s/size/Process size/; 29 | s/ ovr/\toverhead/; 30 | @info = &getinfo($uname, $mhz); 31 | ($f = $file) =~ s|/|-|; 32 | print "tmp/ctx.$f\n"; 33 | open(OUT, ">tmp/ctx.$f"); 34 | print OUT "\"%X Processes \n\"%Y Time in microseconds\n"; 35 | if ($title) { 36 | print OUT "%T $f\n"; 37 | } else { 38 | print OUT 39 | "\"%T Context switches for " . 40 | "$info[3] $info[$#info]Mhz\n"; 41 | } 42 | print OUT "$_\n"; 43 | while () { 44 | last if /^Null/ || /^Pipe/ || /^Memor/ || /^tlb:/; 45 | next if /\$Id/; 46 | next if m|scripts/lmbench: /dev/tty|; 47 | s/ ovr/\toverhead/; 48 | s/size/Process size/; 49 | print OUT; 50 | } 51 | close(OUT); 52 | last; 53 | } 54 | } 55 | } 56 | 57 | # Try and create sensible names from uname -a output 58 | sub getinfo 59 | { 60 | local(@info); 61 | local($name); 62 | local($mhz); 63 | 64 | ($mhz = $_[1]) =~ s/[\. ].*//; 65 | @info = split(/\s+/, $_[0]); 66 | $name = pop(@info); 67 | chop($name); 68 | if ($name eq "mips") { 69 | $name = "$info[$#info]@$mhz"; 70 | } elsif ($_[0] =~ /HP-UX/) { 71 | $name = "$info[7]@$mhz"; 72 | } elsif ($_[0] =~ /SunOS/) { 73 | $name = "$info[7]@$mhz"; 74 | } else { 75 | $name .= "@$mhz"; 76 | } 77 | push(@info, $name); 78 | @info; 79 | } 80 | -------------------------------------------------------------------------------- /scripts/getdisk: -------------------------------------------------------------------------------- 1 | 2 | # Extract the disk graph data from lmbench result files. 3 | # 4 | # Hacked into existence by Larry McVoy 5 | # Copyright (c) 1994 Larry McVoy. GPLed software. 6 | # $Id$ 7 | eval 'exec perl -Ssw $0 "$@"' 8 | if 0; 9 | 10 | foreach $file (@ARGV) { 11 | open(FD, $file); 12 | $file =~ s|/|-|; 13 | while () { 14 | next unless /DISK_DESC/; 15 | s/.DISK_DESC: //; 16 | chop; chop; chop; 17 | @_ = split(/[\[\]]/, $_); 18 | foreach $_ (@_) { 19 | next unless /:/; 20 | @foo = split(/:/, $_); 21 | $foo[0] =~ s|/dev/||; 22 | $disks{$foo[0]} = $foo[1]; 23 | } 24 | last; 25 | } 26 | while () { 27 | if (/^"Seek times for \/dev\/(.*)$/) { 28 | $ok = 0; 29 | foreach $key (keys %disks) { 30 | next unless $key eq $1; 31 | $ok = 1; 32 | } 33 | if ($ok != 1) { 34 | die "Disk results are screwed up, no $1.\n"; 35 | } 36 | print "tmp/seek_$1.$file\n"; 37 | open(OUT, ">tmp/seek_$1.$file"); 38 | print OUT "%T Seek times for $disks{$1}\n"; 39 | print OUT "%X Seek distance (MB)\n"; 40 | print OUT "%Y Time in millisec\n"; 41 | while () { 42 | last unless /^\d/; 43 | print OUT; 44 | } 45 | close(OUT); 46 | } 47 | if (/^"Zone bandwidth for \/dev\/(.*)$/) { 48 | $ok = 0; 49 | foreach $key (keys %disks) { 50 | next unless $key eq $1; 51 | $ok = 1; 52 | } 53 | if ($ok != 1) { 54 | die "Disk results are screwed up, no $1.\n"; 55 | } 56 | print "tmp/zone_$1.$file\n"; 57 | open(OUT, ">tmp/zone_$1.$file"); 58 | print OUT "%T Zone bandwidths for $disks{$1}\n"; 59 | print OUT "%X Disk offset (MB)\n"; 60 | print OUT "%Y Bandwidth (MB/sec)\n"; 61 | while () { 62 | last unless /^\d/; 63 | print OUT; 64 | } 65 | close(OUT); 66 | } 67 | } 68 | } 69 | exit 0; 70 | -------------------------------------------------------------------------------- /scripts/getlist: -------------------------------------------------------------------------------- 1 | 2 | # Find everything in my results directory that looks like lmbench output. 3 | # 4 | # Hacked into existence by Larry McVoy (lm@bitmover.com) 5 | # Copyright (c) 1994-1998 Larry McVoy. 6 | # $Id$ 7 | eval 'exec perl -Ssw $0 "$@"' 8 | if 0; 9 | 10 | $LIST = "no such file"; 11 | $LIST = "LIST" if (-f "LIST"); 12 | $LIST = $ARGV[0] if (($#ARGV == 0) && (-f $ARGV[0])); 13 | if (-f $LIST) { 14 | open(L, $LIST); 15 | $_ = ; 16 | chop; 17 | @files = split; 18 | close(L); 19 | } else { 20 | @files = <*/*>; 21 | } 22 | foreach $file (@files) { 23 | next if $file =~ /\.INFO$/; 24 | open(FD, $file) || next; 25 | next unless defined($_ = ); 26 | close(FD); 27 | next unless /^\[lmbench3.[01]/; 28 | print "$file "; 29 | } 30 | print "\n"; 31 | exit 0; 32 | -------------------------------------------------------------------------------- /scripts/getmax: -------------------------------------------------------------------------------- 1 | 2 | # Look at a bunch of bargraph files and figure out the max amongst them all. 3 | # Usage: getmax file file file.... 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1994 Larry McVoy. GPLed software. 7 | # $Id$ 8 | 9 | eval 'exec perl -Ssw $0 "$@"' 10 | if 0; 11 | 12 | $graph = 1 if 0; 13 | $exit = 1; 14 | foreach $file (@ARGV) { 15 | $exit = 0 if -f $file; 16 | } 17 | exit $exit if $noop; 18 | 19 | $noop = 1 if 0; 20 | $max_X = $max_Y = -1000000000; 21 | $min_X = $min_Y = 1000000000; 22 | foreach $file (@ARGV) { 23 | next if $rmmax; 24 | unless (open(FD, $file)) { 25 | warn "Can't open $file\n"; 26 | next; 27 | } 28 | while () { 29 | next if /^"/; 30 | next if /^%/; 31 | next if /^\s*$/; 32 | next if m|scripts/lmbench: /dev/tty|; 33 | @_ = split; 34 | $min_X = $_[0] if ($_[0] < $min_X); 35 | $min_Y = $_[1] if ($_[1] < $min_Y); 36 | $max_X = $_[0] if ($_[0] > $max_X); 37 | $max_Y = $_[1] if ($_[1] > $max_Y); 38 | } 39 | close(FD); 40 | } 41 | $half = 0 if 0; # lint 42 | $max_X /= 2 if ($half); 43 | foreach $file (@ARGV) { 44 | unless (open(FD, $file)) { 45 | warn "Can't open $file\n"; 46 | next; 47 | } 48 | @lines = ; 49 | open(FD, ">$file") || die "Can't open $file\n"; 50 | if ($graph) { 51 | print FD "%fakemin-X $min_X\n"; 52 | print FD "%fakemin-Y $min_Y\n"; 53 | print FD "%fakemax-X $max_X\n"; 54 | print FD "%fakemax-Y $max_Y\n"; 55 | foreach $_ (@lines) { 56 | next if /^%fakem/; 57 | print FD; 58 | } 59 | warn "Max X is $max_X\n" if $v; 60 | warn "Max Y is $max_Y\n" if $v; 61 | } elsif ($rmmax) { 62 | foreach $_ (@lines) { 63 | next if /^%fakem/; 64 | print FD; 65 | } 66 | } else { 67 | print FD @lines; 68 | print FD "%fakemax $max_X\n"; 69 | warn "Max X is $max_X\n" if $v; 70 | } 71 | close(FD); 72 | } 73 | exit $exit; 74 | -------------------------------------------------------------------------------- /scripts/getmem: -------------------------------------------------------------------------------- 1 | 2 | # Extract the memory latency graph data from lmbench result files. 3 | # 4 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 5 | # Copyright (c) 1994 Larry McVoy. GPLed software. 6 | # $Id$ 7 | eval 'exec perl -Ss $0 "$@"' 8 | if 0; 9 | 10 | foreach $file (@ARGV) { 11 | open(FD, $file); 12 | $file =~ s|/|-|; 13 | while () { 14 | chop; 15 | next if m|scripts/lmbench: /dev/tty|; 16 | if (/^\[lmbench/) { 17 | @_ = split; 18 | if ($_[3] eq "SunOS") { 19 | $_[3] .= "-$_[5]"; 20 | } 21 | $uname = "@_"; 22 | } 23 | if (/Mhz/) { 24 | $mhz = $_; 25 | } 26 | if (/^Memory load latency/) { 27 | @info = &getinfo($uname, $mhz); 28 | ($f = $file) =~ s|.*/||; 29 | print "tmp/mem.$f\n"; 30 | open(OUT, ">tmp/mem.$f"); 31 | print OUT "\"%X Array size\n\"%Y Latency in nanoseconds\n"; 32 | print OUT 33 | "\"%T $file $info[3] $info[$#info] memory latencies\n"; 34 | while () { 35 | next if /\$Id/; 36 | next if /^\[/; 37 | last if /^Random load latency/; 38 | print OUT; 39 | } 40 | close(OUT); 41 | last; 42 | } 43 | } 44 | } 45 | exit 0; 46 | 47 | # Try and create sensible names from uname -a output 48 | sub getinfo 49 | { 50 | local(@info); 51 | local($name); 52 | local($mhz) = $_[1]; 53 | 54 | $mhz =~ s/\..*//; 55 | $mhz =~ s/ .*//; 56 | @info = split(/\s+/, $_[0]); 57 | $name = pop(@info); 58 | chop($name); 59 | if ($name eq "mips") { 60 | $name = "$info[$#info]@$mhz"; 61 | } elsif ($_[0] =~ /HP-UX/) { 62 | $name = "$info[7]@$mhz"; 63 | } elsif ($_[0] =~ /SunOS/) { 64 | $name = "$info[7]@$mhz"; 65 | } else { 66 | $name .= "@$mhz"; 67 | } 68 | push(@info, $name); 69 | @info; 70 | } 71 | -------------------------------------------------------------------------------- /scripts/getresults: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -ws 2 | 3 | # Search through the archives splitting out stuff that has pathnames. 4 | 5 | while (1) { 6 | &headers; 7 | &body; 8 | } 9 | 10 | sub headers 11 | { 12 | while (<>) { 13 | warn "HDR $_" if ($debug); 14 | return if /^\s*$/; 15 | } 16 | exit; 17 | } 18 | 19 | # Save the info for the system, skipping everything ig there is no info. 20 | sub body 21 | { 22 | @info = (); 23 | while (<>) { 24 | last if m|^[-]+ \.\./results|; 25 | last if /^\[lmbench/; 26 | if (/^From[: ]/) { warn "FROM $_"; return; } 27 | warn "INFO $_" if ($debug); 28 | push(@info, $_); 29 | } 30 | if (/^[-]+ \.\.\/results/) { 31 | @foo = split; 32 | $path = $foo[1]; 33 | $path =~ s|\.\./||; 34 | warn "PATH $path\n" if ($debug); 35 | &results; 36 | return; 37 | } 38 | warn "SKIPPING one\n"; 39 | while (<>) { 40 | warn "SKIP $_" if ($SKIP); 41 | last if /^Memory load latency/; 42 | if (/^From[: ]/) { warn "FROM $_"; return; } 43 | } 44 | die "No memory load latency" unless /^Memory load latency/; 45 | while (<>) { 46 | warn "SKIP $_" if ($SKIP); 47 | last if /^\[/; 48 | if (/^From[: ]/) { warn "FROM $_"; return; } 49 | } 50 | die "No date" unless /^\[/; 51 | while (<>) { 52 | last unless /^\s*$/; 53 | if (/^From[: ]/) { warn "FROM $_"; return; } 54 | } 55 | } 56 | 57 | sub results 58 | { 59 | @results = (); 60 | while (<>) { 61 | goto done if (/^From[: ]/); 62 | warn "RES $_" if ($RES); 63 | push(@results, $_); 64 | last if /^Memory load latency/; 65 | } 66 | die "No memory load latency" unless /^Memory load latency/; 67 | while (<>) { 68 | goto done if (/^From[: ]/); 69 | warn "RES $_" if ($RES); 70 | push(@results, $_); 71 | last if /^\[/; 72 | } 73 | die "No date" unless /^\[/; 74 | while (<>) { 75 | last unless /^\s*$/; 76 | } 77 | 78 | done: 79 | ($dir = $path) =~ s|/[^/]+$||; 80 | warn "DIR $dir\n" if ($debug); 81 | system "mkdir -p $dir"; 82 | if (-e $path) { 83 | warn "CONFLICT on $path\n" if $debug; 84 | for ($i = 0; ; $i++) { 85 | $tmp = "${path}.${i}"; 86 | last if ! -e $tmp; 87 | warn "CONFLICT on $tmp\n" if $debug; 88 | } 89 | $path = $tmp; 90 | } 91 | $info = $path . ".INFO"; 92 | open(O, ">$info"); 93 | print O @info; 94 | close(O); 95 | warn "Saving $path\n" if $verbose; 96 | open(O, ">$path"); 97 | print O @results; 98 | close(O); 99 | } 100 | -------------------------------------------------------------------------------- /scripts/gifs: -------------------------------------------------------------------------------- 1 | 2 | # Make HTML files that will point to the right GIF files. 3 | # Usage: bghtml file file file.... 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1995 Larry McVoy. GPLed software. 7 | # $Id$ 8 | eval 'exec perl -Ssw $0 "$@"' 9 | if 0; 10 | 11 | &pbm; 12 | exit 0; 13 | 14 | sub pbm 15 | { 16 | @ctx = ; pop(@ctx); 17 | @mem = ; pop(@mem); 18 | @bar = ; pop(@bar); 19 | 20 | foreach $i () { 21 | ($out = $i) =~ s/.pbm//; 22 | warn "Bitmap munging $out\n"; 23 | #system "pnmcrop < $i | ppmtogif -transparent 1,1,1 > $out"; 24 | system " 25 | pnmcrop < $i > HTML/___tmp 2>/dev/null 26 | set `pnmfile HTML/___tmp` 27 | newx=`expr \$4 - 2` 28 | newy=`expr \$6 - 2` 29 | pnmcut 1 1 \$newx \$newy < HTML/___tmp > HTML/___tmp.pnm 30 | convert -mattecolor slategrey -frame 15x15+0+6 HTML/___tmp.pnm HTML/___tmp.ppm 31 | ppmtogif < HTML/___tmp.ppm > $out.gif 2>/dev/null"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /scripts/html-list: -------------------------------------------------------------------------------- 1 | 2 | # Take the list of files and turn them into an html file that points 3 | # at their context & mem latency GIFs. 4 | # 5 | # Usage: html-list file file file.... 6 | # 7 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 8 | # Copyright (c) 1995 Larry McVoy. GPLed software. 9 | # $Id$ 10 | eval 'exec perl -Ssw $0 "$@"' 11 | if 0; 12 | 13 | open(H, ">HTML/specific.html"); 14 | print H <LMBENCH System Results 16 |

LMBENCH System Results

17 |

Summary of results

18 |
19 | EOF 20 | 21 | # The order that is passed in is the order of the generated 22 | # graphs so save that. 23 | $val = 0; 24 | foreach $file (@ARGV) { 25 | $number{$file} = ++$val; 26 | } 27 | 28 | # Now sort them so we can group by OS 29 | @ARGV = sort(@ARGV); 30 | 31 | # Figure out the different OS 32 | foreach $file (@ARGV) { 33 | ($os = $file) =~ s|/.*||; 34 | push(@os, $os); 35 | $done{$os} = 0; 36 | } 37 | 38 | foreach $os (@os) { 39 | next if $done{$os}; 40 | $done{$os} = 1; 41 | # Print out an OS specific heading 42 | print H "

Results from $os

\n"; 43 | 44 | for ($i = 0; $i <= $#os; $i++) { 45 | $file = $ARGV[$i]; 46 | next unless $file =~ /$os/; 47 | open(F, $file); 48 | $_ = ; 49 | close(F); 50 | next unless /lmbench1.[01]/; 51 | chop; 52 | $title = $_; 53 | #s/.lmbench1.? results for //; 54 | ($sys = $file) =~ s|.*/||; 55 | if ($i > 0) { 56 | ($prev_sys = $ARGV[$i - 1]) =~ s|.*/||; 57 | } 58 | if ($i < $#os) { 59 | ($next_sys = $ARGV[$i + 1]) =~ s|.*/||; 60 | } 61 | print H <Dataset: $sys 63 |

$title

64 | Context switch details, 65 | memory bandwidths, 66 | file reread vs. memory bandwidths, 67 | and 68 | memory latencies. 69 | EOF 70 | 71 | # Create the files referencing the data GIFs 72 | $N = sprintf("%02d", $number{$file}); 73 | $prev = $next = ""; 74 | %label = ('ctx', 'context switching', 75 | 'mem', 'memory latency', 76 | 'bwmem', 'memory bandwidth', 77 | 'bwfile', 'file reread bandwidth'); 78 | %doc = ('ctx', 'lat_ctx.8.html', 79 | 'mem', 'lat_mem_rd.8.html', 80 | 'bwmem', 'bw_mem.8.html', 81 | 'bwfile', 'bw_file_rd.8.html'); 82 | $back = ""; 83 | $forward = ""; 84 | for $what ('ctx', 'mem', 'bwmem', 'bwfile') { 85 | for $scale ('', '-unscaled') { 86 | open(S, ">HTML/${sys}-${what}${scale}.html"); 87 | if ($scale eq '') { 88 | $notscale = "-unscaled"; 89 | $lab = ""; 90 | $Lab = "Unscaled "; 91 | } else { 92 | $notscale = ""; 93 | $lab = "scaled "; 94 | $Lab = "Scaled "; 95 | } 96 | $prev = 97 | " 98 | Previous ${lab}$label{$what} result

" 99 | if $i > 0; 100 | $next = 101 | " 102 | Next ${lab}$label{$what} result

" 103 | if $i < $#os; 104 | print S<$title 106 | Information on this benchmark (Not up to date) 107 |

\n

108 | 109 | LMBENCH table of contents 110 | 111 | System results table of contents 112 |

113 | $next 114 | $prev 115 | 116 | ${Lab}$label{$what} results for this system 117 | EOF 118 | } 119 | } 120 | 121 | } 122 | } 123 | exit 0; 124 | -------------------------------------------------------------------------------- /scripts/html-man: -------------------------------------------------------------------------------- 1 | eval 'exec perl -Ssw $0 "$@"' 2 | if 0; 3 | 4 | # Take a man tree and make an html tree out of it 5 | # 6 | # Derived from Donners man2html script 7 | 8 | from=/usr/man 9 | to=/u/eo/repository/system/unix/man 10 | 11 | function disambiguate 12 | { 13 | newbase=${1} 14 | newname="${newbase}.1" 15 | dis=2 16 | while [ -a "${newname}" ] 17 | do 18 | newname=$newbase"."$dis 19 | dis=$(expr $dis + 1) 20 | done 21 | } 22 | 23 | while ($ARGV[0] =~ /^-/) { 24 | if ($ARGV[0] eq "-f") { 25 | shift(@ARGV); 26 | $from = shift(@ARGV); 27 | } 28 | if ($ARGV[0] eq "-t") { 29 | shift(@ARGV); 30 | $to = shift(@ARGV); 31 | } 32 | } 33 | 34 | open(FD, "find $from -name '*.[0-9ln]' -print |"); 35 | while ($find = ) { 36 | } 37 | 38 | if [ ! "${indexonly}" ] 39 | then 40 | print "Processing the man pages ..." 41 | for i in man${sections}/* 42 | do 43 | if [ "$verbose" ] 44 | then 45 | print $i 46 | fi 47 | # n=${i%.*} 48 | name=${to}/${i} 49 | if [ -a "${name}" ] 50 | then 51 | oldname=$name 52 | disambiguate $name 53 | name=$newname 54 | print "Collision - ${oldname} will be stored as ${name}" 55 | fi 56 | eqn $i | tbl | nroff -man | rman -f HTML | sed -e "s/MS_LOCAL_HOST/${localeo}/g" > ${name} 57 | done 58 | fi 59 | 60 | print "Building the index.html files ..." 61 | cd $to 62 | for i in man${sections} 63 | do 64 | if [ "$verbose" ] 65 | then 66 | print $i 67 | fi 68 | cd $i 69 | rm -f index.html 70 | echo '

    ' > ../new.html 71 | for j in * 72 | do 73 | if [ "$verbose" ] 74 | then 75 | print -n "$j " 76 | fi 77 | print 78 | print "
  • $j" >> ../new.html 79 | done 80 | echo '
' >> ../new.html 81 | mv ../new.html index.html 82 | cd .. 83 | done 84 | -------------------------------------------------------------------------------- /scripts/info: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | UNAME=`uname -n 2>/dev/null` 4 | if [ X$UNAME = X ] 5 | then echo INFO 6 | else echo INFO.$UNAME 7 | fi 8 | -------------------------------------------------------------------------------- /scripts/info-template: -------------------------------------------------------------------------------- 1 | Thanks very much for filling this out. The system will save it across 2 | runs so that you don't have to do it again unless you change what you 3 | are measuring (i.e., add disks to the mix). The stuff you fill in is 4 | in lower case, the uppercase stuff you should leave as is. 5 | 6 | If you used "vi" and you don't know how to use it, just type ZZ and skip 7 | this step. 8 | 9 | VENDOR: i.e. SGI, Compaq, Sun, etc. For PC clones, just say clone. 10 | 11 | MOTHERBOARD: this mostly for PC's - it's very important to know there. 12 | 13 | MODEL: SGI O200, Sun Ultra2, Compaq Pressario, Gateway 10,000,000 14 | 15 | YEAR BOUGHT: 1982 16 | 17 | PRICE: $10,000 18 | 19 | PROCESSORS: 20 | NUMBER: 2 21 | TYPE: 200 Mhz Pentium Pro 22 | 23 | MEMORY: 24 | AMOUNT: 32M, etc. 25 | SPEED: i.e, 60ns, 70ns, etc. 26 | TYPE: FPM, EDO, DIMM, etc 27 | 28 | CACHE: 29 | ONCHIP DCACHE: 32K, set associative (2 or 4 way, can't remember) 30 | ONCHIP ICACHE: 32K, set associative (2 or 4 way, can't remember) 31 | LEVEL 2: 1MB, 2 way set associative, unified 32 | 33 | NETWORK: 34 | ETHERNET: 100baseT, DEC Tulip chip, SMC PCI card 35 | HIPPI: 100MB/sec, 64bit PCI, SGI onboard R4K processors, full duplex 36 | 37 | DISKS: 38 | /dev/sda 4GB Quantum, model 1234 39 | 40 | MISC: 41 | Anything else that you think is interesting for people 42 | to know about your system. 43 | -------------------------------------------------------------------------------- /scripts/make: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "X$MAKE" != "X" ] && echo "$MAKE" | grep '`' > /dev/null 4 | then 5 | MAKE= 6 | fi 7 | 8 | if [ X$MAKE = X ] 9 | then MAKE=make 10 | for p in `echo $PATH | sed 's/:/ /g'` 11 | do if [ -f $p/gmake ] 12 | then 13 | if $p/gmake testmake > /dev/null 2>&1 14 | then 15 | MAKE=$p/gmake 16 | fi 17 | fi 18 | done 19 | fi 20 | echo $MAKE 21 | -------------------------------------------------------------------------------- /scripts/mkrelease: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # %W% 4 | # 5 | # XXX - does not check for checked out files. 6 | 7 | make -s clean 8 | make -s get 9 | VERS=`egrep 'MAJOR|MINOR' src/version.h | awk '{print $3}'` 10 | set `echo $VERS` 11 | if [ $2 -lt 0 ] 12 | then VERS=`echo $1$2 | sed s/-/alpha/` 13 | else VERS=`echo $VERS |sed 's/ /./'` 14 | fi 15 | D=lmbench-$VERS 16 | mkdir $D $D/results 17 | cp -rp SCCS doc hbench-REBUTTAL lmbench-HOWTO scripts src $D 18 | cp -rp results/SCCS $D/results 19 | (cd $D && make -s get) 20 | /bin/rm -rf $D/SCCS $D/*/SCCS 21 | tar czvf $D.tgz $D 22 | /bin/rm -rf $D 23 | make -s clean 24 | -------------------------------------------------------------------------------- /scripts/new2oldctx: -------------------------------------------------------------------------------- 1 | 2 | # Convert the new format: 3 | # Context switch of 8 4k processes: 64.17 (60.02 overhead) 4 | # to the old format: 5 | #"size=0 ovr=22 6 | # 2 8 7 | # 4 14 8 | # 8 18 9 | # 16 21 10 | # 20 22 11 | 12 | eval 'exec perl -Ssw $0 "$@"' 13 | if 0; 14 | 15 | @lines = grep(/Context switch/, <>); 16 | foreach $size ("0k", "4k", "16k", "32k", "64k") { 17 | @data = grep(/$size/, @lines); 18 | @a = @b = @c = (); 19 | $i = 0; 20 | foreach $n (2, 4, 8, 16, 20) { 21 | @tmp = (); 22 | foreach $_ (grep(/of $n/, @data)) { 23 | @_ = split; 24 | push(@tmp, "$_[3] $_[6]\n"); 25 | } 26 | ($a[$i],$b[$i],$c[$i]) = @tmp; 27 | $i++; 28 | } 29 | print "\n\"size=$size \n"; 30 | print @c; 31 | } 32 | -------------------------------------------------------------------------------- /scripts/opercent: -------------------------------------------------------------------------------- 1 | 2 | eval "exec perl -sS $0 $*" 3 | if 0; 4 | 5 | $fmt = 0; 6 | @fmts = ( 7 | "%33s %4s %4s %3s %4s %4s %4s %4s %4s %4s\n", 8 | "%28s %6s %6s %5s %6s %7s %7s\n", 9 | "%29s %5s %4s %5s %5s %5s %5s %4s\n", 10 | "%30s %6s %6s %6s %8s %5s %7s\n", 11 | "%28s %4s %4s %6s %6s %6s %6s %4s %5s\n", 12 | "%29s %5s %6s %11s\n", 13 | ); 14 | while (<>) { 15 | print; 16 | next unless /^Host/; 17 | $_ = <>; print; 18 | unless (/^-/) { 19 | $_ = <>; print; 20 | } 21 | @values = (); 22 | @a = @b = @c = @d = @e = @f = @g = @h = @i = @j = @k = (); 23 | $i = 0; 24 | while (<>) { 25 | last if /^\s/; 26 | print; 27 | s/.......................\s+//; 28 | ($a[$i],$b[$i],$c[$i],$d[$i],$e[$i],$f[$i],$g[$i],$h[$i],$i[$i],$j[$i],$k[$i]) = split; 29 | $i++; 30 | } 31 | $a = &sss(@a) if $#a != -1; 32 | $b = &sss(@b) if $#b != -1; 33 | $c = &sss(@c) if $#c != -1; 34 | $d = &sss(@d) if $#d != -1; 35 | $e = &sss(@e) if $#e != -1; 36 | $f = &sss(@f) if $#f != -1; 37 | $g = &sss(@g) if $#g != -1; 38 | $h = &sss(@h) if $#h != -1; 39 | $i = &sss(@i) if $#i != -1; 40 | $j = &sss(@j) if $#j != -1; 41 | $k = &sss(@k) if $#k != -1; 42 | printf $fmts[$fmt], $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k; 43 | print "\n"; 44 | exit if $fmt++ == $#fmts; 45 | } 46 | 47 | sub sss 48 | { 49 | local($tmp); 50 | local(@values) = (); 51 | local($n, $sum, $min, $max) = (0,0,1.7E+300,2.2E-300); 52 | 53 | foreach $_ (@_) { 54 | next unless /^\d/; 55 | chop if /K$/; 56 | push(@values, $_); 57 | $sum += $_; 58 | $min = $_ if $_ < $min; 59 | $max = $_ if $_ > $max; 60 | $n++; 61 | } 62 | return "" if $#values == -1; 63 | # Do some statistics. 64 | @s = sort(@values); 65 | if ($n & 1) { 66 | $median = $s[($n + 1)/2]; 67 | } else { 68 | $i = $n / 2; 69 | $median = ($s[$i] + $s[$i+1]) / 2; 70 | } 71 | $avg = $sum/$n; 72 | $avgdev = $var = 0; 73 | foreach $_ (@values) { 74 | $var += ($_ - $median) ** 2; 75 | $tmp = $_ - $median; 76 | $avgdev += $tmp > 0 ? $tmp : -$tmp; 77 | } 78 | $var /= $n - 1; 79 | $stddev = sqrt($var); 80 | $avgdev /= $n; 81 | #printf("%8s %8s %8s %8s %8s %4s %8s\n", "Min", "Max", "Average", "Median", "Std Dev", "%", "Avg Dev"); 82 | #printf "%8.2f %8.2f %8.2f %8.2f %8.2f %4.1f%% %8.2f\n", $min, $max, $avg, $median, $stddev, $stddev/$median*100, $avgdev; 83 | $percent = $stddev/$median*100; 84 | if ($percent > 90) { 85 | printf "Huh: $percent $stddev $median @values\n"; 86 | } 87 | if ($percent >= 10) { 88 | return sprintf "%.0f%%", $percent; 89 | } else { 90 | return sprintf "%.1f%%", $percent; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /scripts/os: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "X$OS" != "X" ] && echo "$OS" | grep '`' > /dev/null 4 | then 5 | OS= 6 | fi 7 | 8 | if [ "X$OS" = "X" ] 9 | then OS=bloat-os 10 | MACHINE=`uname -m | sed -e 's/ //g' | sed -e 's?/?-?g'` 11 | SYSTEM=`uname -s | sed -e 's/ //g' | sed -e 's?/?-?g'` 12 | OS="${MACHINE}-${SYSTEM}" 13 | if [ -f ../scripts/gnu-os ] 14 | then OS=`../scripts/gnu-os | sed s/unknown-//` 15 | fi 16 | if [ -f ../../scripts/gnu-os ] 17 | then OS=`../../scripts/gnu-os | sed s/unknown-//` 18 | fi 19 | fi 20 | echo $OS 21 | -------------------------------------------------------------------------------- /scripts/output: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | trap "echo /dev/null" 20 3 | OUTPUT=/dev/null; export OUTPUT 4 | if [ -w /dev/tty ]; then 5 | if echo "" > /dev/tty; then 6 | OUTPUT=/dev/tty; export OUTPUT 7 | fi 8 | fi 2>/dev/null 9 | echo "${OUTPUT}" 10 | exit 0 11 | -------------------------------------------------------------------------------- /scripts/percent: -------------------------------------------------------------------------------- 1 | 2 | eval "exec perl -sS $0 $*" 3 | if 0; 4 | 5 | $fmt = 0; 6 | @fmts = ( 7 | "%24s %4s %4s %3s %4s %5s %4s %4s %4s %5s %4s %3s\n", 8 | "%24s %4s %6s %5s %5s %6s %7s %7s\n", 9 | "%24s %4s %5s %4s %5s %5s %5s %5s %4s\n", 10 | "%24s %6s %6s %6s %8s %5s %7s\n", 11 | "%24s %3s %4s %4s %6s %7s %6s %5s %5s %5s\n", 12 | "%24s %5s %5s %5s %12s\n", 13 | ); 14 | while (<>) { 15 | print; 16 | next unless /^Host/; 17 | $_ = <>; print; 18 | unless (/^-/) { 19 | $_ = <>; print; 20 | } 21 | @values = (); 22 | @a = @b = @c = @d = @e = @f = @g = @h = @i = @j = @k = (); 23 | $i = 0; 24 | while (<>) { 25 | last if /^\s/; 26 | print; 27 | s/.......................\s+//; 28 | ($a[$i],$b[$i],$c[$i],$d[$i],$e[$i],$f[$i],$g[$i],$h[$i],$i[$i],$j[$i],$k[$i]) = split; 29 | $i++; 30 | } 31 | $a = &sss(@a) if $#a != -1; 32 | $b = &sss(@b) if $#b != -1; 33 | $c = &sss(@c) if $#c != -1; 34 | $d = &sss(@d) if $#d != -1; 35 | $e = &sss(@e) if $#e != -1; 36 | $f = &sss(@f) if $#f != -1; 37 | $g = &sss(@g) if $#g != -1; 38 | $h = &sss(@h) if $#h != -1; 39 | $i = &sss(@i) if $#i != -1; 40 | $j = &sss(@j) if $#j != -1; 41 | $k = &sss(@k) if $#k != -1; 42 | printf $fmts[$fmt], "", $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k; 43 | print "\n"; 44 | exit if $fmt++ == $#fmts; 45 | } 46 | 47 | sub sss 48 | { 49 | local($i, $tmp); 50 | local(@values) = (); 51 | local($n, $sum, $min, $max) = (0,0,1.7E+300,2.2E-300); 52 | 53 | foreach $_ (@_) { 54 | next unless /^\d/; 55 | chop if /K$/; 56 | push(@values, $_); 57 | $sum += $_; 58 | $min = $_ if $_ < $min; 59 | $max = $_ if $_ > $max; 60 | $n++; 61 | } 62 | return "" if $#values == -1; 63 | # Do some statistics. 64 | @s = sort(@values); 65 | if ($n & 1) { 66 | $median = $s[($n + 1)/2]; 67 | } else { 68 | $i = $n / 2; 69 | $median = ($s[$i] + $s[$i+1]) / 2; 70 | } 71 | $avg = $sum/$n; 72 | $avgdev = $var = 0; 73 | foreach $_ (@values) { 74 | $var += ($_ - $median) ** 2; 75 | $tmp = $_ - $median; 76 | $avgdev += $tmp > 0 ? $tmp : -$tmp; 77 | } 78 | $var /= $n - 1; 79 | $stddev = sqrt($var); 80 | $avgdev /= $n; 81 | #printf("%8s %8s %8s %8s %8s %4s %8s\n", "Min", "Max", "Average", "Median", "Std Dev", "%", "Avg Dev"); 82 | #printf "%8.2f %8.2f %8.2f %8.2f %8.2f %4.1f%% %8.2f\n", $min, $max, $avg, $median, $stddev, $stddev/$median*100, $avgdev; 83 | $percent = $stddev/$median*100; 84 | if ($percent > 90) { 85 | printf "Huh: $percent $stddev $median @values\n"; 86 | } 87 | if ($percent < .5) { 88 | return "0 "; 89 | } elsif ($percent < 1) { 90 | $tmp = sprintf "%.1f%%", $percent; 91 | return $tmp; 92 | } else { 93 | return sprintf "%.0f%%", $percent; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /scripts/results: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # $Id$ 4 | 5 | OS=`../scripts/os` 6 | CONFIG=`../scripts/config` 7 | RESULTS=results/$OS 8 | BASE=../$RESULTS/`uname -n` 9 | EXT=0 10 | 11 | if [ ! -f "../bin/$OS/$CONFIG" ] 12 | then echo "No config file?" 13 | exit 1 14 | fi 15 | . ../bin/$OS/$CONFIG 16 | 17 | if [ ! -d ../$RESULTS ] 18 | then mkdir -p ../$RESULTS 19 | fi 20 | 21 | #[ARC changes] Allow log file name be passed from cmd line 22 | if [ $# -eq 0 ] ; then 23 | RESULTS=$BASE.$EXT 24 | while [ -f $RESULTS ] 25 | do EXT=`expr $EXT + 1` 26 | RESULTS=$BASE.$EXT 27 | done 28 | else 29 | RESULTS=../results/$OS/$1 30 | fi 31 | 32 | #[ARC changes] Warn if file already existed 33 | if [ -e $RESULTS ] ; then 34 | echo "Over-writing the output file" 35 | fi 36 | 37 | cd ../bin/$OS 38 | PATH=.:${PATH}; export PATH 39 | export SYNC_MAX 40 | export OUTPUT 41 | lmbench $CONFIG 2>../${RESULTS} 42 | 43 | if [ X$MAIL = Xyes ] 44 | then echo Mailing results 45 | (echo ---- $INFO --- 46 | cat $INFO 47 | echo ---- $RESULTS --- 48 | cat ../$RESULTS) | mail lmbench3@bitmover.com 49 | fi 50 | exit 0 51 | -------------------------------------------------------------------------------- /scripts/save: -------------------------------------------------------------------------------- 1 | # Save the input in the specified file if possible. If the file exists, 2 | # add a numeric suffice, i.e., .1, and increment that until the file 3 | # does not exist. Use the first name found as the file to save. 4 | # 5 | # Typical usage is: xroff -man -fH *.1 | save MAN.PS 6 | # 7 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 8 | # Copyright (c) 1994 Larry McVoy. GPLed software. 9 | # $Id$ 10 | eval 'exec perl -Ssw $0 "$@"' 11 | if 0; 12 | 13 | $base = $#ARGV == 0 ? shift : "save"; 14 | $file = $base; 15 | $ext = 1; 16 | 17 | while (-e $file) { 18 | $file = "$base.$ext"; 19 | $ext++; 20 | } 21 | warn "Saving in $file\n"; 22 | open(FD, ">$file"); 23 | while(<>) { 24 | print FD; 25 | } 26 | exit 0; 27 | -------------------------------------------------------------------------------- /scripts/stats: -------------------------------------------------------------------------------- 1 | 2 | # Convert the Y coordinate to an average 3 | 4 | eval "exec perl -sS $0 $*" 5 | if 0; 6 | 7 | @values = (); 8 | $sum = $n = 0; 9 | $min = 1.7E+308; 10 | $max = 2.2E-308; 11 | while (<>) { 12 | next if /^[%#]/; 13 | @_ = split; 14 | if ($_[0] > 1000000) { 15 | #warn "$file: ignoring $_"; 16 | next; 17 | } 18 | if ($#_ >= 1) { 19 | $val = $_[1]; 20 | } else { 21 | $val = $_[0]; 22 | } 23 | push(@values, $val); 24 | $sum += $val; 25 | $min = $val if $val < $min; 26 | $max = $val if $val > $max; 27 | $n++; 28 | } 29 | # Do some statistics. 30 | @s = sort(@values); 31 | if ($n & 1) { 32 | $median = $s[($n + 1)/2]; 33 | } else { 34 | $i = $n / 2; 35 | $median = ($s[$i] + $s[$i+1]) / 2; 36 | } 37 | $avg = $sum/$n; 38 | $avgdev = $var = 0; 39 | foreach $_ (@values) { 40 | $var += ($_ - $median) ** 2; 41 | $tmp = $_ - $median; 42 | $avgdev += $tmp > 0 ? $tmp : -$tmp; 43 | } 44 | $var /= $n - 1; 45 | $stddev = sqrt($var); 46 | $avgdev /= $n; 47 | #printf("%8s %8s %8s %8s %8s %4s %8s\n", "Min", "Max", "Average", "Median", "Std Dev", "%", "Avg Dev"); 48 | #printf "%8.2f %8.2f %8.2f %8.2f %8.2f %4.1f%% %8.2f\n", $min, $max, $avg, $median, $stddev, $stddev/$median*100, $avgdev; 49 | printf "%4.1f%%\n", $stddev/$median*100; 50 | exit 0; 51 | -------------------------------------------------------------------------------- /scripts/synchronize: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # %W% %@% Copyright (c) 1998 Larry McVoy. 4 | # 5 | # Usage: SYNC_PID=3 SYNC_MAX=20 synchronize /tmp/sync_dir 6 | # 7 | # Used to sync up a bunch of processes so that they can operate in lockstep 8 | # as much as possible. 9 | # 10 | # The first process to try and sync will mkdir(pathname) and create a named 11 | # pipe in the directory. It also creates a file, pathname/$PID where pid 12 | # is not the process id, it is the process number. The group of processes 13 | # must be numbered from 1..N and they must each know their number. The Nth 14 | # process is the master. Whereas all the other processes block, opening the 15 | # pipe, the master spins in a loop, waiting for pathname/1 .. pathname/N-1 16 | # to show up in the directory. When they are all there, the master opens 17 | # the pipe for writing and all the other processes get woken up and leave. 18 | # 19 | # It is outside of this program, but the directory must not exist before the 20 | # synchronization. So you typically rm -rf it well before trying to sync. 21 | 22 | if [ X$1 = X ]; then echo "Usage: $0 pathname"; exit 1; fi 23 | if [ X$SYNC_PID = X ]; then echo "Must set SYNC_PID"; exit 1; fi 24 | if [ X$SYNC_MAX = X ]; then echo "Must set SYNC_MAX"; exit 1; fi 25 | 26 | DIR=$1 27 | mkdir -p $DIR 2>/dev/null 28 | if [ ! -e $DIR/fifo ] 29 | then mkfifo $DIR/fifo 2>/dev/null 30 | chmod 666 $DIR/fifo 2>/dev/null 31 | fi 32 | 33 | # slaves just read the pipe 34 | if [ $SYNC_PID != $SYNC_MAX ] 35 | then touch $DIR/$SYNC_PID 36 | read x < $DIR/fifo 37 | exit 0 38 | fi 39 | 40 | # Master waits for all the other processes to get there 41 | PIDS="" 42 | I=1 43 | while [ $I -lt $SYNC_MAX ] 44 | do PIDS=" $I$PIDS" 45 | I=`expr $I + 1` 46 | done 47 | while true 48 | do GO=Y 49 | for s in $PIDS 50 | do if [ ! -e $DIR/$s ] 51 | then GO=N 52 | fi 53 | done 54 | if [ $GO = Y ] 55 | then # This assumes that all the processes will 56 | echo sleep 2 > $DIR/fifo & 57 | exit 0 58 | fi 59 | msleep 250 60 | done 61 | -------------------------------------------------------------------------------- /scripts/target: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Figure out the OS name if possible. 4 | # 5 | # Hacked into existence by Larry McVoy (lm@sun.com now lm@sgi.com). 6 | # Copyright (c) 1994 Larry McVoy. GPLed software. 7 | # $Id$ 8 | case `uname -s` in 9 | *HP-UX*) echo hpux;; 10 | *Linux*) echo linux;; 11 | *IRIX*) echo irix;; 12 | *AIX*) echo aix;; 13 | BSD/OS) echo bsdi;; 14 | *BSD*) echo bsd;; 15 | *OSF1*) echo osf1;; 16 | *ULTRIX*) echo ultrix;; 17 | *SunOS*) case `uname -r` in 18 | 4*) echo sunos;; 19 | 5*) echo solaris;; 20 | *) echo unknown;; 21 | esac;; 22 | *) echo unknown;; 23 | esac 24 | exit 0 25 | -------------------------------------------------------------------------------- /scripts/version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # %W% %@% 4 | 5 | F="no_such_file" 6 | VERSION="3.0-`date '+%Y%m%d'`" 7 | for f in version.h ../src/version.h src/version.h 8 | do 9 | if [ $F = "no_such_file" -a -f $f ] 10 | then 11 | F=$f 12 | fi 13 | done 14 | if [ -f $F ] 15 | then VERSION=`awk '/MAJOR/ { major = $3; } /MINOR/ { minor=$3;} END { if (minor < 0) printf("%d.0-a%d", major, -minor); else printf("%d.%d", major, minor);}' $F` 16 | fi 17 | echo $VERSION 18 | -------------------------------------------------------------------------------- /scripts/xroff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # X previewer like groff/nroff scripts. 4 | groff -P -filename -P "| groff -Z -X -Tps $*" -X -Tps "$@" 5 | exit 0 6 | -------------------------------------------------------------------------------- /src/busy.c: -------------------------------------------------------------------------------- 1 | volatile int i; 2 | 3 | main() 4 | { 5 | 6 | nice(10); 7 | for (;;) getppid(); 8 | //for (;;) i++; 9 | exit(i); 10 | } 11 | -------------------------------------------------------------------------------- /src/clock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * clock.c 3 | * 4 | * calculate the minimum timing loop length that gives us significant results 5 | */ 6 | #include "bench.h" 7 | 8 | char *id = "$Id$"; 9 | char *revision = "$Revision$"; 10 | 11 | main() 12 | { 13 | uint64 enough; 14 | double t_overhead, l_overhead; 15 | 16 | enough = compute_enough(15); 17 | printf("ENOUGH=%lu\n", (unsigned long)enough); fflush(stdout); 18 | t_overhead = timing_overhead(enough); 19 | printf("TIMING_OVERHEAD=%f\n", t_overhead); fflush(stdout); 20 | l_overhead = loop_overhead(enough, t_overhead); 21 | printf("LOOP_OVERHEAD=%f\n", l_overhead); 22 | printf("# version [%s]\n", revision); 23 | exit(0); 24 | } 25 | -------------------------------------------------------------------------------- /src/enough.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern int get_enough(int); 5 | 6 | int 7 | main() 8 | { 9 | putenv("LOOP_O=0.0"); 10 | putenv("TIMING_O=0.0"); 11 | printf("%u\n", get_enough(0)); 12 | return (0); 13 | } 14 | -------------------------------------------------------------------------------- /src/flushdisk.c: -------------------------------------------------------------------------------- 1 | #ifdef linux 2 | /* 3 | * flushdisk() - linux block cache clearing 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | int 15 | flushdisk(int fd) 16 | { 17 | int ret = ioctl(fd, BLKFLSBUF, 0); 18 | usleep(100000); 19 | return (ret); 20 | } 21 | 22 | #endif 23 | 24 | #ifdef MAIN 25 | int 26 | main(int ac, char **av) 27 | { 28 | #ifdef linux 29 | int fd; 30 | int i; 31 | 32 | for (i = 1; i < ac; ++i) { 33 | fd = open(av[i], 0); 34 | if (flushdisk(fd)) { 35 | exit(1); 36 | } 37 | close(fd); 38 | } 39 | #endif 40 | return(0); 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /src/getopt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 L.W.McVoy 3 | * 4 | * SGI's fucking getopt doesn't follow GNU's reset policy. Isn't having 5 | * N versions of Unix a great thing for the world? I'm gonna move to NT 6 | * if these assholes don't get their act together. 7 | * 8 | * This version handles 9 | * 10 | * - (leaves it and returns) 11 | * -a 12 | * -abcd 13 | * -r 14 | * -r 15 | * -abcr 16 | * -abcr 17 | * -r -R, etc. 18 | * 19 | * A special form is "d|" instead of "d:". This means the arg has to be 20 | * right next to the option. 21 | * Another special form is "d;". This means the option must be right next 22 | * to the option letter and can not be blank. 23 | */ 24 | #include "bench.h" 25 | static char *id = "%@%"; 26 | 27 | int optopt; /* option that is in error, if we return an error */ 28 | int optind; /* next arg in argv we process */ 29 | char *optarg; /* argument to an option */ 30 | static int n; 31 | 32 | int 33 | getopt(int ac, char **av, char *opts) 34 | { 35 | char *t; 36 | 37 | if (!optind) { 38 | optind = 1; 39 | n = 1; 40 | } 41 | debug((stderr, "GETOPT ind=%d n=%d arg=%s av[%d]='%s'\n", 42 | optind, n, optarg ? optarg : "", optind, av[optind])); 43 | 44 | if ((optind >= ac) || (av[optind][0] != '-') || !av[optind][1]) { 45 | return (EOF); 46 | } 47 | 48 | assert(av[optind][n]); 49 | for (t = (char *)opts; *t; t++) { 50 | if (*t == av[optind][n]) { 51 | break; 52 | } 53 | } 54 | if (!*t) { 55 | optopt = av[optind][n]; 56 | debug((stderr, "\tran out of option letters\n")); 57 | return ('?'); 58 | } 59 | 60 | /* OK, we found a legit option, let's see what to do with it. 61 | * If it isn't one that takes an option, just advance and return. 62 | */ 63 | if (t[1] != ':' && t[1] != '|' && t[1] != ';') { 64 | if (!av[optind][n+1]) { 65 | optind++; 66 | n = 1; 67 | } else { 68 | n++; 69 | } 70 | debug((stderr, "\tLegit singleton %c\n", *t)); 71 | return (*t); 72 | } 73 | 74 | /* got one with an option, see if it is cozied up to the flag */ 75 | if (av[optind][n+1]) { 76 | if (av[optind][n+1]) { 77 | optarg = &av[optind][n+1]; 78 | } else { 79 | optarg = 0; 80 | } 81 | optind++; 82 | n = 1; 83 | debug((stderr, "\t%c with %s\n", *t, optarg)); 84 | return (*t); 85 | } 86 | 87 | /* If it was not there, and it is optional, OK */ 88 | if (t[1] == '|') { 89 | optarg = 0; 90 | optind++; 91 | n = 1; 92 | debug((stderr, "\t%c without arg\n", *t)); 93 | return (*t); 94 | } 95 | 96 | /* was it supposed to be there? */ 97 | if (t[1] == ';') { 98 | optarg = 0; 99 | optind++; 100 | optopt = *t; 101 | debug((stderr, "\twanted another word\n")); 102 | return ('?'); 103 | } 104 | 105 | /* Nope, there had better be another word. */ 106 | if ((optind + 1 == ac) || (av[optind+1][0] == '-')) { 107 | optopt = av[optind][n]; 108 | debug((stderr, "\twanted another word\n")); 109 | return ('?'); 110 | } 111 | optarg = av[optind+1]; 112 | optind += 2; 113 | n = 1; 114 | debug((stderr, "\t%c with arg %s\n", *t, optarg)); 115 | return (*t); 116 | } 117 | 118 | #ifdef TEST 119 | 120 | /* XXX a.out -y file */ 121 | main(int ac, char **av) 122 | { 123 | extern char *optarg; 124 | extern int optind; 125 | char *comment = 0; 126 | int c; 127 | 128 | while ((c = getopt(ac, av, "fnpsx:y|")) != -1) { 129 | switch (c) { 130 | case 'f': 131 | case 'n': 132 | case 'p': 133 | case 's': 134 | printf("Got option %c\n", c); 135 | break; 136 | case 'x': 137 | case 'y': 138 | comment = optarg; 139 | printf("Got optarg %s with -%c\n", comment, c); 140 | break; 141 | case '?': 142 | fprintf(stderr, "bad option %c\n", optopt); 143 | break; 144 | default: 145 | fprintf(stderr, "unknown ret %c\n", c); 146 | break; 147 | } 148 | } 149 | while (av[optind]) { 150 | printf("av[%d] = %s\n", optind, av[optind++]); 151 | } 152 | exit(0); 153 | } 154 | #endif 155 | -------------------------------------------------------------------------------- /src/hello.c: -------------------------------------------------------------------------------- 1 | #include "bench.h" 2 | 3 | int 4 | main() 5 | { 6 | write(1, "Hello world\n", 12); 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /src/lat_cmd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_cmd.c - time to complete a given command line 3 | * 4 | * usage: lat_cmd [-P ] [-W ] [-N ] cmd... 5 | * 6 | * Copyright (c) 2004 Carl Staelin. Distributed under the FSF GPL with 7 | * additional restriction that results may published only if 8 | * (1) the benchmark is unmodified, and 9 | * (2) the version in the sccsid below is included in the report. 10 | * Support for this development by Sun Microsystems is gratefully acknowledged. 11 | */ 12 | char *id = "$Id$\n"; 13 | 14 | #include "bench.h" 15 | 16 | void bench(iter_t iterations, void *cookie); 17 | void cleanup(iter_t iterations, void *cookie); 18 | 19 | typedef struct _state { 20 | char** argv; 21 | pid_t pid; 22 | } state_t; 23 | 24 | int 25 | main(int ac, char **av) 26 | { 27 | int c; 28 | int i; 29 | int parallel = 1; 30 | int warmup = 0; 31 | int repetitions = -1; 32 | state_t state; 33 | char* usage = "[-P ] [-W ] [-N ] cmdline...\n"; 34 | 35 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 36 | switch(c) { 37 | case 'P': 38 | parallel = atoi(optarg); 39 | if (parallel <= 0) lmbench_usage(ac, av, usage); 40 | break; 41 | case 'W': 42 | warmup = atoi(optarg); 43 | break; 44 | case 'N': 45 | repetitions = atoi(optarg); 46 | break; 47 | default: 48 | lmbench_usage(ac, av, usage); 49 | break; 50 | } 51 | } 52 | if (optind >= ac) { 53 | lmbench_usage(ac, av, usage); 54 | } 55 | state.argv = (char**)malloc((ac - optind + 1) * sizeof(char*)); 56 | if (!state.argv) { 57 | perror("malloc"); 58 | exit(1); 59 | } 60 | state.pid = 0; 61 | for (i = 0; i < ac - optind; ++i) { 62 | state.argv[i] = av[optind + i]; 63 | } 64 | state.argv[i] = NULL; 65 | 66 | benchmp(NULL, bench, NULL, 0, parallel, warmup, repetitions, &state); 67 | micro("lat_cmd", get_n()); 68 | return (0); 69 | } 70 | 71 | void 72 | cleanup(iter_t iterations, void* cookie) 73 | { 74 | state_t* state = (state_t*)cookie; 75 | 76 | if (iterations) return; 77 | 78 | if (state->pid) { 79 | kill(state->pid, SIGKILL); 80 | waitpid(state->pid, NULL, 0); 81 | state->pid = 0; 82 | } 83 | } 84 | 85 | void 86 | bench(register iter_t iterations, void *cookie) 87 | { 88 | state_t *state = (state_t *) cookie; 89 | 90 | signal(SIGCHLD, SIG_DFL); 91 | while (iterations-- > 0) { 92 | switch (state->pid = fork()) { 93 | case '0': 94 | execvp(state->argv[0], state->argv); 95 | /*NOTREACHED*/ 96 | default: 97 | break; 98 | } 99 | waitpid(state->pid, NULL, 0); 100 | state->pid = 0; 101 | } 102 | } 103 | 104 | -------------------------------------------------------------------------------- /src/lat_connect.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_connect.c - simple TCP connection latency test 3 | * 4 | * Three programs in one - 5 | * server usage: lat_connect -s 6 | * client usage: lat_connect [-N ] hostname 7 | * shutdown: lat_connect -hostname 8 | * 9 | * lat_connect may not be parallelized because of idiosyncracies 10 | * with TCP connection creation. Basically, if the client tries 11 | * to create too many connections too quickly, the system fills 12 | * up the set of available connections with TIME_WAIT connections. 13 | * We can only measure the TCP connection cost accurately if we 14 | * do just a few connections. Since the parallel harness needs 15 | * each child to run for a second, this guarantees that the 16 | * parallel version will generate inaccurate results. 17 | * 18 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 19 | * additional restriction that results may published only if 20 | * (1) the benchmark is unmodified, and 21 | * (2) the version in the sccsid below is included in the report. 22 | * Support for this development by Sun Microsystems is gratefully acknowledged. 23 | */ 24 | char *id = "$Id$\n"; 25 | #include "bench.h" 26 | 27 | typedef struct _state { 28 | char *server; 29 | } state_t; 30 | 31 | void doclient(iter_t iterations, void * cookie); 32 | void server_main(); 33 | 34 | int 35 | main(int ac, char **av) 36 | { 37 | state_t state; 38 | int repetitions = -1; 39 | int c; 40 | char buf[256]; 41 | char *usage = "-s\n OR [-S] [-N ] server\n"; 42 | 43 | while (( c = getopt(ac, av, "sSP:W:N:")) != EOF) { 44 | switch(c) { 45 | case 's': /* Server */ 46 | if (fork() == 0) { 47 | server_main(); 48 | } 49 | exit(0); 50 | case 'S': /* shutdown serverhost */ 51 | { 52 | int sock = tcp_connect(av[optind], 53 | TCP_CONNECT, 54 | SOCKOPT_NONE); 55 | write(sock, "0", 1); 56 | close(sock); 57 | exit(0); 58 | } 59 | case 'N': 60 | repetitions = atoi(optarg); 61 | break; 62 | default: 63 | lmbench_usage(ac, av, usage); 64 | break; 65 | } 66 | } 67 | 68 | if (optind + 1 != ac) { 69 | lmbench_usage(ac, av, usage); 70 | } 71 | 72 | state.server = av[optind]; 73 | benchmp(NULL, doclient, NULL, 0, 1, 0, repetitions, &state); 74 | 75 | sprintf(buf, "TCP/IP connection cost to %s", state.server); 76 | micro(buf, get_n()); 77 | exit(0); 78 | } 79 | 80 | void 81 | doclient(iter_t iterations, void *cookie) 82 | { 83 | state_t *state = (state_t *) cookie; 84 | register char *server = state->server; 85 | register int sock; 86 | 87 | while (iterations-- > 0) { 88 | sock = tcp_connect(server, TCP_CONNECT, SOCKOPT_REUSE); 89 | close(sock); 90 | } 91 | } 92 | 93 | void 94 | server_main() 95 | { 96 | int newsock, sock; 97 | char c ='1'; 98 | 99 | GO_AWAY; 100 | sock = tcp_server(TCP_CONNECT, SOCKOPT_NONE|SOCKOPT_REUSE); 101 | for (;;) { 102 | newsock = tcp_accept(sock, SOCKOPT_NONE); 103 | if (read(newsock, &c, 1) > 0) { 104 | tcp_done(TCP_CONNECT); 105 | exit(0); 106 | } 107 | close(newsock); 108 | } 109 | /* NOTREACHED */ 110 | } 111 | -------------------------------------------------------------------------------- /src/lat_fifo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_fifo.c - named pipe transaction test 3 | * 4 | * usage: lat_fifo [-P ] [-W ] [-N ] 5 | * 6 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 7 | * additional restriction that results may published only if 8 | * (1) the benchmark is unmodified, and 9 | * (2) the version in the sccsid below is included in the report. 10 | */ 11 | char *id = "$Id$\n"; 12 | 13 | #include "bench.h" 14 | 15 | #define F1 "/tmp/lmbench_f1.%d" 16 | #define F2 "/tmp/lmbench_f2.%d" 17 | 18 | void initialize(iter_t iterations, void *cookie); 19 | void cleanup(iter_t iterations, void *cookie); 20 | void doit(iter_t iterations, void *cookie); 21 | void writer(int wr, int rd); 22 | 23 | typedef struct _state { 24 | char filename1[256]; 25 | char filename2[256]; 26 | int pid; 27 | int wr; 28 | int rd; 29 | } state_t; 30 | 31 | int 32 | main(int ac, char **av) 33 | { 34 | state_t state; 35 | int parallel = 1; 36 | int warmup = 0; 37 | int repetitions = -1; 38 | int c; 39 | char* usage = "[-P ] [-W ] [-N ]\n"; 40 | 41 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 42 | switch(c) { 43 | case 'P': 44 | parallel = atoi(optarg); 45 | if (parallel <= 0) lmbench_usage(ac, av, usage); 46 | break; 47 | case 'W': 48 | warmup = atoi(optarg); 49 | break; 50 | case 'N': 51 | repetitions = atoi(optarg); 52 | break; 53 | default: 54 | lmbench_usage(ac, av, usage); 55 | break; 56 | } 57 | } 58 | if (optind < ac) { 59 | lmbench_usage(ac, av, usage); 60 | } 61 | 62 | state.pid = 0; 63 | 64 | benchmp(initialize, doit, cleanup, SHORT, parallel, 65 | warmup, repetitions, &state); 66 | micro("Fifo latency", get_n()); 67 | return (0); 68 | } 69 | 70 | void 71 | initialize(iter_t iterations, void *cookie) 72 | { 73 | char c; 74 | state_t * state = (state_t *)cookie; 75 | 76 | if (iterations) return; 77 | 78 | state->pid = 0; 79 | sprintf(state->filename1,F1,getpid()); 80 | sprintf(state->filename2,F2,getpid()); 81 | 82 | unlink(state->filename1); unlink(state->filename2); 83 | if (mknod(state->filename1, S_IFIFO|0664, 0) || 84 | mknod(state->filename2, S_IFIFO|0664, 0)) { 85 | perror("mknod"); 86 | exit(1); 87 | } 88 | handle_scheduler(benchmp_childid(), 0, 1); 89 | switch (state->pid = fork()) { 90 | case 0: 91 | handle_scheduler(benchmp_childid(), 1, 1); 92 | state->rd = open(state->filename1, O_RDONLY); 93 | state->wr = open(state->filename2, O_WRONLY); 94 | writer(state->wr, state->rd); 95 | return; 96 | 97 | case -1: 98 | perror("fork"); 99 | return; 100 | 101 | default: 102 | state->wr = open(state->filename1, O_WRONLY); 103 | state->rd = open(state->filename2, O_RDONLY); 104 | break; 105 | } 106 | 107 | /* 108 | * One time around to make sure both processes are started. 109 | */ 110 | if (write(state->wr, &c, 1) != 1 || read(state->rd, &c, 1) != 1) { 111 | perror("(i) read/write on pipe"); 112 | exit(1); 113 | } 114 | } 115 | 116 | void 117 | cleanup(iter_t iterations, void * cookie) 118 | { 119 | state_t * state = (state_t *)cookie; 120 | 121 | if (iterations) return; 122 | 123 | unlink(state->filename1); 124 | unlink(state->filename2); 125 | close(state->wr); 126 | close(state->rd); 127 | 128 | if (state->pid > 0) { 129 | kill(state->pid, 15); 130 | waitpid(state->pid, NULL, 0); 131 | state->pid = 0; 132 | } 133 | } 134 | 135 | void 136 | doit(register iter_t iterations, void *cookie) 137 | { 138 | state_t *state = (state_t *) cookie; 139 | char c; 140 | register int w = state->wr; 141 | register int r = state->rd; 142 | register char *cptr = &c; 143 | 144 | while (iterations-- > 0) { 145 | if (write(w, cptr, 1) != 1 || 146 | read(r, cptr, 1) != 1) { 147 | perror("(r) read/write on pipe"); 148 | exit(1); 149 | } 150 | } 151 | } 152 | 153 | void 154 | writer(register int w, register int r) 155 | { 156 | char c; 157 | register char *cptr = &c; 158 | 159 | for ( ;; ) { 160 | if (read(r, cptr, 1) != 1 || 161 | write(w, cptr, 1) != 1) { 162 | perror("(w) read/write on pipe"); 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/lat_http.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_http.c - simple HTTP transaction latency test 3 | * 4 | * usage: lat_http hostname [port] < filelist 5 | * 6 | * Copyright (c) 1994-6 Larry McVoy. Distributed under the FSF GPL with 7 | * additional restriction that results may published only if 8 | * (1) the benchmark is unmodified, and 9 | * (2) the version in the sccsid below is included in the report. 10 | * Support for this development by Sun Microsystems is gratefully acknowledged. 11 | */ 12 | char *id = "$Id$\n"; 13 | 14 | #include "bench.h" 15 | 16 | char *buf; 17 | int debug; 18 | int echo; 19 | 20 | int 21 | http(char *server, char *file, int prog) 22 | { 23 | int sock; 24 | int n; 25 | int b = 0; 26 | 27 | sock = tcp_connect(server, prog, SOCKOPT_REUSE); 28 | sprintf(buf, "GET /%s HTTP/1.0\r\n\r\n\n", file); 29 | if (debug) { 30 | printf(buf); 31 | } 32 | write(sock, buf, strlen(buf)); 33 | while ((n = read(sock, buf, XFERSIZE)) > 0) { 34 | b += n; 35 | if (echo) { 36 | write(1, buf, n); 37 | } 38 | } 39 | close(sock); 40 | if (debug) { 41 | printf("Got %d\n", b); 42 | } 43 | return (b); 44 | } 45 | 46 | void 47 | killhttp(char *server, int prog) 48 | { 49 | int sock; 50 | 51 | sock = tcp_connect(server, prog, SOCKOPT_REUSE); 52 | write(sock, "EXIT", 4); 53 | close(sock); 54 | } 55 | 56 | void chop(register char *s) { while (*s && *s != '\n') s++; *s = 0; } 57 | 58 | int 59 | main(int ac, char **av) 60 | { 61 | char *server; 62 | int i, prog; 63 | int c; 64 | int shutdown = 0; 65 | uint64 total = 0; 66 | uint64 usecs = 0; 67 | double avg; 68 | char *name = av[0]; 69 | char file[1024]; 70 | char *usage = "[-d] [-e] [-S] serverhost [port] < list\n"; 71 | 72 | while (( c = getopt(ac, av, "deS")) != EOF) { 73 | switch(c) { 74 | case 'd': 75 | debug++; 76 | break; 77 | case 'e': 78 | echo++; 79 | break; 80 | case 'S': /* shutdown serverhost */ 81 | shutdown = 1; 82 | break; 83 | default: 84 | lmbench_usage(ac, av, usage); 85 | break; 86 | } 87 | } 88 | 89 | if (optind >= ac || optind < ac - 2) { 90 | lmbench_usage(ac, av, usage); 91 | exit(0); 92 | } 93 | server = av[optind++]; 94 | 95 | if (optind < ac && atoi(av[optind]) != 0) { 96 | prog = -atoi(av[optind]); 97 | } else { 98 | prog = -80; 99 | } 100 | 101 | if (shutdown) { 102 | killhttp(server, prog); 103 | exit(0); 104 | } 105 | 106 | i = 0; 107 | buf = valloc(XFERSIZE); 108 | if (!buf) { 109 | perror("valloc"); 110 | exit(1); 111 | } 112 | bzero(buf, XFERSIZE); 113 | while (fgets(file, sizeof(file), stdin)) { 114 | chop(file); 115 | start(0); 116 | total += http(server, file, prog); 117 | usecs += stop(0,0); 118 | i++; 119 | } 120 | avg = total; 121 | avg /= (i - 1); 122 | if (avg > 1000) { 123 | avg /= 1000; 124 | fprintf(stderr, "Avg xfer: %.1fKB, ", avg); 125 | } else { 126 | fprintf(stderr, "Avg xfer %d, ", (int)avg); 127 | } 128 | settime(usecs); 129 | latency((uint64)1, total); 130 | exit(0); 131 | } 132 | 133 | -------------------------------------------------------------------------------- /src/lat_pipe.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_pipe.c - pipe transaction test 3 | * 4 | * usage: lat_pipe [-P ] [-W ] [-N ] 5 | * 6 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 7 | * additional restriction that results may published only if 8 | * (1) the benchmark is unmodified, and 9 | * (2) the version in the sccsid below is included in the report. 10 | * Support for this development by Sun Microsystems is gratefully acknowledged. 11 | */ 12 | char *id = "$Id$\n"; 13 | 14 | #include "bench.h" 15 | 16 | void initialize(iter_t iterations, void *cookie); 17 | void cleanup(iter_t iterations, void *cookie); 18 | void doit(iter_t iterations, void *cookie); 19 | void writer(int w, int r); 20 | 21 | typedef struct _state { 22 | int pid; 23 | int p1[2]; 24 | int p2[2]; 25 | } state_t; 26 | 27 | int 28 | main(int ac, char **av) 29 | { 30 | state_t state; 31 | int parallel = 1; 32 | int warmup = 0; 33 | int repetitions = -1; 34 | int c; 35 | char* usage = "[-P ] [-W ] [-N ]\n"; 36 | 37 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 38 | switch(c) { 39 | case 'P': 40 | parallel = atoi(optarg); 41 | if (parallel <= 0) lmbench_usage(ac, av, usage); 42 | break; 43 | case 'W': 44 | warmup = atoi(optarg); 45 | break; 46 | case 'N': 47 | repetitions = atoi(optarg); 48 | break; 49 | default: 50 | lmbench_usage(ac, av, usage); 51 | break; 52 | } 53 | } 54 | if (optind < ac) { 55 | lmbench_usage(ac, av, usage); 56 | } 57 | 58 | state.pid = 0; 59 | 60 | benchmp(initialize, doit, cleanup, SHORT, parallel, 61 | warmup, repetitions, &state); 62 | micro("Pipe latency", get_n()); 63 | return (0); 64 | } 65 | 66 | void 67 | initialize(iter_t iterations, void* cookie) 68 | { 69 | char c; 70 | state_t * state = (state_t *)cookie; 71 | 72 | if (iterations) return; 73 | 74 | if (pipe(state->p1) == -1) { 75 | perror("pipe"); 76 | exit(1); 77 | } 78 | if (pipe(state->p2) == -1) { 79 | perror("pipe"); 80 | exit(1); 81 | } 82 | handle_scheduler(benchmp_childid(), 0, 1); 83 | switch (state->pid = fork()) { 84 | case 0: 85 | handle_scheduler(benchmp_childid(), 1, 1); 86 | signal(SIGTERM, exit); 87 | close(state->p1[1]); 88 | close(state->p2[0]); 89 | writer(state->p2[1], state->p1[0]); 90 | return; 91 | 92 | case -1: 93 | perror("fork"); 94 | return; 95 | 96 | default: 97 | close(state->p1[0]); 98 | close(state->p2[1]); 99 | break; 100 | } 101 | 102 | /* 103 | * One time around to make sure both processes are started. 104 | */ 105 | if (write(state->p1[1], &c, 1) != 1 || read(state->p2[0], &c, 1) != 1){ 106 | perror("(i) read/write on pipe"); 107 | exit(1); 108 | } 109 | } 110 | 111 | void 112 | cleanup(iter_t iterations, void* cookie) 113 | { 114 | state_t * state = (state_t *)cookie; 115 | 116 | if (iterations) return; 117 | 118 | if (state->pid) { 119 | kill(state->pid, SIGKILL); 120 | waitpid(state->pid, NULL, 0); 121 | state->pid = 0; 122 | } 123 | } 124 | 125 | void 126 | doit(register iter_t iterations, void *cookie) 127 | { 128 | state_t *state = (state_t *) cookie; 129 | char c; 130 | register int w = state->p1[1]; 131 | register int r = state->p2[0]; 132 | register char *cptr = &c; 133 | 134 | while (iterations-- > 0) { 135 | if (write(w, cptr, 1) != 1 || 136 | read(r, cptr, 1) != 1) { 137 | perror("(r) read/write on pipe"); 138 | exit(1); 139 | } 140 | } 141 | } 142 | 143 | void 144 | writer(register int w, register int r) 145 | { 146 | char c; 147 | register char *cptr = &c; 148 | 149 | for ( ;; ) { 150 | if (read(r, cptr, 1) != 1 || 151 | write(w, cptr, 1) != 1) { 152 | perror("(w) read/write on pipe"); 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /src/lat_rand.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_rand.c - random number generation 3 | * 4 | * usage: lat_rand [-P ] [-W ] [-N ] 5 | * 6 | * Copyright (c) 2002 Carl Staelin. Distributed under the FSF GPL with 7 | * additional restriction that results may published only if 8 | * (1) the benchmark is unmodified, and 9 | * (2) the version in the sccsid below is included in the report. 10 | * Support for this development by Hewlett-Packard is gratefully acknowledged. 11 | */ 12 | char *id = "$Id$\n"; 13 | 14 | #include "bench.h" 15 | 16 | #ifdef HAVE_DRAND48 17 | void bench_drand48(iter_t iterations, void *cookie); 18 | void bench_lrand48(iter_t iterations, void *cookie); 19 | #endif 20 | #ifdef HAVE_RAND 21 | void bench_rand(iter_t iterations, void *cookie); 22 | #endif 23 | #ifdef HAVE_RANDOM 24 | void bench_random(iter_t iterations, void *cookie); 25 | #endif 26 | int 27 | main(int ac, char **av) 28 | { 29 | int parallel = 1; 30 | int warmup = 0; 31 | int repetitions = -1; 32 | int c; 33 | char* usage = "[-P ] [-W ] [-N ]\n"; 34 | 35 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 36 | switch(c) { 37 | case 'P': 38 | parallel = atoi(optarg); 39 | if (parallel <= 0) lmbench_usage(ac, av, usage); 40 | break; 41 | case 'W': 42 | warmup = atoi(optarg); 43 | break; 44 | case 'N': 45 | repetitions = atoi(optarg); 46 | break; 47 | default: 48 | lmbench_usage(ac, av, usage); 49 | break; 50 | } 51 | } 52 | if (optind < ac) { 53 | lmbench_usage(ac, av, usage); 54 | } 55 | 56 | #ifdef HAVE_DRAND48 57 | benchmp(NULL, bench_drand48, NULL, 58 | 0, parallel, warmup, repetitions, NULL); 59 | nano("drand48 latency", get_n()); 60 | 61 | benchmp(NULL, bench_lrand48, NULL, 62 | 0, parallel, warmup, repetitions, NULL); 63 | nano("lrand48 latency", get_n()); 64 | #endif 65 | #ifdef HAVE_RAND 66 | benchmp(NULL, bench_rand, NULL, 67 | 0, parallel, warmup, repetitions, NULL); 68 | nano("rand latency", get_n()); 69 | #endif 70 | #ifdef HAVE_RANDOM 71 | benchmp(NULL, bench_random, NULL, 72 | 0, parallel, warmup, repetitions, NULL); 73 | nano("random latency", get_n()); 74 | #endif 75 | return (0); 76 | } 77 | 78 | #ifdef HAVE_DRAND48 79 | void 80 | bench_drand48(register iter_t iterations, void *cookie) 81 | { 82 | register double v = 0.0; 83 | while (iterations-- > 0) { 84 | v += drand48(); 85 | } 86 | use_int((int)v); 87 | } 88 | 89 | void 90 | bench_lrand48(register iter_t iterations, void *cookie) 91 | { 92 | register long v = 0.0; 93 | while (iterations-- > 0) { 94 | v += lrand48(); 95 | } 96 | use_int((int)v); 97 | } 98 | #endif /* HAVE_DRAND48 */ 99 | #ifdef HAVE_RAND 100 | void 101 | bench_rand(register iter_t iterations, void *cookie) 102 | { 103 | register int v = 0.0; 104 | while (iterations-- > 0) { 105 | v += rand(); 106 | } 107 | use_int((int)v); 108 | } 109 | #endif /* HAVE_RAND */ 110 | #ifdef HAVE_RANDOM 111 | void 112 | bench_random(register iter_t iterations, void *cookie) 113 | { 114 | register int v = 0.0; 115 | while (iterations-- > 0) { 116 | v += random(); 117 | } 118 | use_int((int)v); 119 | } 120 | #endif /* HAVE_RANDOM */ 121 | -------------------------------------------------------------------------------- /src/lat_sem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_sem.c - semaphore test 3 | * 4 | * usage: lat_sem [-P ] [-W ] [-N ] 5 | * 6 | * Copyright (c) 2000 Carl Staelin. 7 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 8 | * additional restriction that results may published only if 9 | * (1) the benchmark is unmodified, and 10 | * (2) the version in the sccsid below is included in the report. 11 | * Support for this development by Sun Microsystems is gratefully acknowledged. 12 | */ 13 | char *id = "$Id$\n"; 14 | 15 | #include "bench.h" 16 | #include 17 | 18 | void initialize(iter_t iterations, void *cookie); 19 | void cleanup(iter_t iterations, void *cookie); 20 | void doit(iter_t iterations, void *cookie); 21 | void writer(int sid); 22 | 23 | typedef struct _state { 24 | int pid; 25 | int semid; 26 | } state_t; 27 | 28 | int 29 | main(int ac, char **av) 30 | { 31 | state_t state; 32 | int parallel = 1; 33 | int warmup = 0; 34 | int repetitions = -1; 35 | int c; 36 | char* usage = "[-P ] [-W ] [-N ]\n"; 37 | 38 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 39 | switch(c) { 40 | case 'P': 41 | parallel = atoi(optarg); 42 | if (parallel <= 0) lmbench_usage(ac, av, usage); 43 | break; 44 | case 'W': 45 | warmup = atoi(optarg); 46 | break; 47 | case 'N': 48 | repetitions = atoi(optarg); 49 | break; 50 | default: 51 | lmbench_usage(ac, av, usage); 52 | break; 53 | } 54 | } 55 | if (optind < ac) { 56 | lmbench_usage(ac, av, usage); 57 | } 58 | 59 | state.pid = 0; 60 | 61 | benchmp(initialize, doit, cleanup, SHORT, parallel, 62 | warmup, repetitions, &state); 63 | micro("Semaphore latency", get_n() * 2); 64 | return (0); 65 | } 66 | 67 | void 68 | initialize(iter_t iterations, void* cookie) 69 | { 70 | char c; 71 | state_t * state = (state_t *)cookie; 72 | 73 | if (iterations) return; 74 | 75 | state->semid = semget(IPC_PRIVATE, 2, IPC_CREAT | IPC_EXCL | 0600); 76 | semctl(state->semid, 0, SETVAL, 0); 77 | semctl(state->semid, 1, SETVAL, 0); 78 | 79 | handle_scheduler(benchmp_childid(), 0, 1); 80 | switch (state->pid = fork()) { 81 | case 0: 82 | signal(SIGTERM, exit); 83 | handle_scheduler(benchmp_childid(), 1, 1); 84 | writer(state->semid); 85 | return; 86 | 87 | case -1: 88 | perror("fork"); 89 | return; 90 | 91 | default: 92 | break; 93 | } 94 | } 95 | 96 | void 97 | cleanup(iter_t iterations, void* cookie) 98 | { 99 | state_t * state = (state_t *)cookie; 100 | 101 | if (iterations) return; 102 | 103 | if (state->pid) { 104 | kill(state->pid, SIGKILL); 105 | waitpid(state->pid, NULL, 0); 106 | state->pid = 0; 107 | } 108 | /* free the semaphores */ 109 | semctl(state->semid, 0, IPC_RMID); 110 | } 111 | 112 | void 113 | doit(register iter_t iterations, void *cookie) 114 | { 115 | state_t *state = (state_t *) cookie; 116 | struct sembuf sop[2]; 117 | 118 | sop[0].sem_num = 1; 119 | sop[0].sem_op = -1; 120 | sop[0].sem_flg = 0; 121 | 122 | sop[1].sem_num = 0; 123 | sop[1].sem_op = 1; 124 | sop[1].sem_flg = 0; 125 | 126 | while (iterations-- > 0) { 127 | if (semop(state->semid, sop, 2) < 0) { 128 | perror("(r) error on semaphore"); 129 | exit(1); 130 | } 131 | } 132 | } 133 | 134 | void 135 | writer(register int sid) 136 | { 137 | struct sembuf sop[2]; 138 | 139 | sop[0].sem_num = 1; 140 | sop[0].sem_op = 1; 141 | sop[0].sem_flg = 0; 142 | 143 | if (semop(sid, sop, 1) < 0) { 144 | perror("(w) error on initial semaphore"); 145 | exit(1); 146 | } 147 | 148 | sop[0].sem_num = 0; 149 | sop[0].sem_op = -1; 150 | sop[0].sem_flg = 0; 151 | 152 | sop[1].sem_num = 1; 153 | sop[1].sem_op = 1; 154 | sop[1].sem_flg = 0; 155 | 156 | for ( ;; ) { 157 | if (semop(sid, sop, 2) < 0) { 158 | perror("(w) error on semaphore"); 159 | exit(1); 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /src/lat_unix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tcp_unix.c - simple UNIX socket transaction latency test 3 | * 4 | * lat_unix [-P ] [-W ] [-N ] 5 | * 6 | * Copyright (c) 1994-2000 Carl Staelin and Larry McVoy. 7 | * Distributed under the FSF GPL with additional restriction that 8 | * results may published only if 9 | * (1) the benchmark is unmodified, and 10 | * (2) the version in the sccsid below is included in the report. 11 | * Support for this development by Sun Microsystems is gratefully acknowledged. 12 | */ 13 | char *id = "$Id$\n"; 14 | #include "bench.h" 15 | 16 | struct _state { 17 | int sv[2]; 18 | int pid; 19 | int msize; 20 | char* buf; 21 | }; 22 | void initialize(iter_t iterations, void* cookie); 23 | void benchmark(iter_t iterations, void* cookie); 24 | void cleanup(iter_t iterations, void* cookie); 25 | 26 | int 27 | main(int ac, char **av) 28 | { 29 | int parallel = 1; 30 | int warmup = 0; 31 | int repetitions = -1; 32 | struct _state state; 33 | int c; 34 | char* usage = "[-m ] [-P ] [-W ] [-N ]\n"; 35 | 36 | state.msize = 1; 37 | state.pid = 0; 38 | 39 | while (( c = getopt(ac, av, "m:P:W:N:")) != EOF) { 40 | switch(c) { 41 | case 'm': 42 | state.msize = atoi(optarg); 43 | break; 44 | case 'P': 45 | parallel = atoi(optarg); 46 | if (parallel <= 0) lmbench_usage(ac, av, usage); 47 | break; 48 | case 'W': 49 | warmup = atoi(optarg); 50 | break; 51 | case 'N': 52 | repetitions = atoi(optarg); 53 | break; 54 | default: 55 | lmbench_usage(ac, av, usage); 56 | break; 57 | } 58 | } 59 | if (optind < ac) { 60 | lmbench_usage(ac, av, usage); 61 | } 62 | 63 | benchmp(initialize, benchmark, cleanup, 0, parallel, 64 | warmup, repetitions, &state); 65 | 66 | micro("AF_UNIX sock stream latency", get_n()); 67 | return(0); 68 | } 69 | 70 | void 71 | initialize(iter_t iterations, void* cookie) 72 | { 73 | struct _state* pState = (struct _state*)cookie; 74 | 75 | if (iterations) return; 76 | 77 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, pState->sv) == -1) { 78 | perror("socketpair"); 79 | } 80 | 81 | pState->buf = malloc(pState->msize); 82 | if (pState->buf == NULL) { 83 | fprintf(stderr, "buffer allocation\n"); 84 | exit(1); 85 | } 86 | handle_scheduler(benchmp_childid(), 0, 1); 87 | 88 | if (pState->pid = fork()) 89 | return; 90 | 91 | handle_scheduler(benchmp_childid(), 1, 1); 92 | 93 | /* Child sits and ping-pongs packets back to parent */ 94 | signal(SIGTERM, exit); 95 | while (read(pState->sv[0], pState->buf, pState->msize) == pState->msize) { 96 | write(pState->sv[0], pState->buf, pState->msize); 97 | } 98 | exit(0); 99 | } 100 | 101 | void 102 | benchmark(iter_t iterations, void* cookie) 103 | { 104 | struct _state* pState = (struct _state*)cookie; 105 | 106 | while (iterations-- > 0) { 107 | if (write(pState->sv[1], pState->buf, pState->msize) != pState->msize 108 | || read(pState->sv[1], pState->buf, pState->msize) != pState->msize) { 109 | /* error handling: how do we signal failure? */ 110 | cleanup(0, cookie); 111 | exit(0); 112 | } 113 | } 114 | } 115 | 116 | void 117 | cleanup(iter_t iterations, void* cookie) 118 | { 119 | struct _state* pState = (struct _state*)cookie; 120 | 121 | if (iterations) return; 122 | 123 | if (pState->pid) { 124 | kill(pState->pid, SIGKILL); 125 | waitpid(pState->pid, NULL, 0); 126 | pState->pid = 0; 127 | } 128 | } 129 | 130 | -------------------------------------------------------------------------------- /src/lat_unix_connect.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lat_unix_connect.c - simple UNIX connection latency test 3 | * 4 | * Three programs in one - 5 | * server usage: lat_connect -s 6 | * client usage: lat_connect [-P ] [-W ] [-N ] 7 | * shutdown: lat_connect -q 8 | * 9 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 10 | * additional restriction that results may published only if 11 | * (1) the benchmark is unmodified, and 12 | * (2) the version in the sccsid below is included in the report. 13 | * Support for this development by Sun Microsystems is gratefully acknowledged. 14 | */ 15 | char *id = "$Id$\n"; 16 | #include "bench.h" 17 | 18 | #define CONNAME "/tmp/af_unix" 19 | 20 | void server_main(void); 21 | 22 | void benchmark(iter_t iterations, void* cookie) 23 | { 24 | while (iterations-- > 0) { 25 | int sock = unix_connect(CONNAME); 26 | if (sock <= 0) 27 | printf("error on iteration %lu\n",iterations); 28 | close(sock); 29 | } 30 | } 31 | 32 | int main(int ac, char **av) 33 | { 34 | int parallel = 1; 35 | int warmup = 0; 36 | int repetitions = -1; 37 | char *usage = "-s\n OR [-P ] [-W ] [-N ]\n OR -S\n"; 38 | int c; 39 | 40 | /* Start the server "-s" or Shut down the server "-S" */ 41 | if (ac == 2) { 42 | if (!strcmp(av[1], "-s")) { 43 | if (fork() == 0) { 44 | server_main(); 45 | } 46 | exit(0); 47 | } 48 | if (!strcmp(av[1], "-S")) { 49 | int sock = unix_connect(CONNAME); 50 | write(sock, "0", 1); 51 | close(sock); 52 | exit(0); 53 | } 54 | } 55 | 56 | /* 57 | * Rest is client 58 | */ 59 | while (( c = getopt(ac, av, "P:W:N:")) != EOF) { 60 | switch(c) { 61 | case 'P': 62 | parallel = atoi(optarg); 63 | if (parallel <= 0) lmbench_usage(ac, av, usage); 64 | break; 65 | case 'W': 66 | warmup = atoi(optarg); 67 | break; 68 | case 'N': 69 | repetitions = atoi(optarg); 70 | break; 71 | default: 72 | lmbench_usage(ac, av, usage); 73 | break; 74 | } 75 | } 76 | 77 | if (optind != ac) { 78 | lmbench_usage(ac, av, usage); 79 | } 80 | 81 | benchmp(NULL, benchmark, NULL, 0, parallel, warmup, repetitions, NULL); 82 | micro("UNIX connection cost", get_n()); 83 | } 84 | 85 | void server_main(void) 86 | { 87 | int newsock, sock; 88 | char c; 89 | 90 | GO_AWAY; 91 | sock = unix_server(CONNAME); 92 | for (;;) { 93 | newsock = unix_accept(sock); 94 | c = 0; 95 | read(newsock, &c, 1); 96 | if (c && c == '0') { 97 | unix_done(sock, CONNAME); 98 | exit(0); 99 | } 100 | close(newsock); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/lib_debug.c: -------------------------------------------------------------------------------- 1 | #include "bench.h" 2 | #include "lib_debug.h" 3 | 4 | /* 5 | * return micro-seconds / iteration at the the fraction point. 6 | * 7 | * some examples: 8 | * min = percent_point(values, size, 0.0) 9 | * 1st quartile = percent_point(values, size, 0.25) 10 | * median = percent_point(values, size, 0.5) 11 | * 3rd quartile = percent_point(values, size, 0.75) 12 | * max = percent_point(values, size, 1.0) 13 | * 14 | * the data points in the results structure are sorted from 15 | * largest to smallest, so we adjust the fraction accordingly. 16 | */ 17 | double 18 | percent_point(double fraction) 19 | { 20 | double t, r; 21 | result_t* results = get_results(); 22 | 23 | t = (1.0 - fraction) * (results->N - 1); 24 | if (t == floor(t)) { 25 | /* no interpolation */ 26 | r = results->v[(int)t].u / (double)results->v[(int)t].n; 27 | } else { 28 | /* percent point falls between two points, interpolate */ 29 | r = results->v[(int)t].u / (double)results->v[(int)t].n; 30 | r += results->v[(int)t+1].u / (double)results->v[(int)t+1].n; 31 | r /= 2.0; 32 | } 33 | 34 | return r; 35 | } 36 | 37 | void 38 | print_results(int details) 39 | { 40 | int i; 41 | result_t* results = get_results(); 42 | 43 | fprintf(stderr, "N=%d, t={", results->N); 44 | for (i = 0; i < results->N; ++i) { 45 | fprintf(stderr, "%.2f", (double)results->v[i].u/results->v[i].n); 46 | if (i < results->N - 1) 47 | fprintf(stderr, ", "); 48 | } 49 | fprintf(stderr, "}\n"); 50 | if (details) { 51 | fprintf(stderr, "\t/* %d {", results->N); 52 | for (i = 0; i < results->N; ++i) { 53 | fprintf(stderr, 54 | "%llu/%llu", results->v[i].u, results->v[i].n); 55 | if (i < results->N - 1) 56 | fprintf(stderr, ", "); 57 | } 58 | fprintf(stderr, "} */\n"); 59 | } 60 | 61 | } 62 | 63 | /* 64 | * Prints bandwidth (MB/s) quartile information 65 | * 66 | * bytes - bytes per iteration 67 | */ 68 | void 69 | bw_quartile(uint64 bytes) 70 | { 71 | fprintf(stderr, "%lu\t%e\t%e\t%e\t%e\t%e\n", 72 | (unsigned long)get_n(), 73 | (double)bytes / (1000000. * percent_point(0.00)), 74 | (double)bytes / (1000000. * percent_point(0.25)), 75 | (double)bytes / (1000000. * percent_point(0.50)), 76 | (double)bytes / (1000000. * percent_point(0.75)), 77 | (double)bytes / (1000000. * percent_point(1.00))); 78 | } 79 | 80 | /* 81 | * Prints latency (nano-seconds) quartile information 82 | * 83 | * n - number of operations per iteration 84 | */ 85 | void 86 | nano_quartile(uint64 n) 87 | { 88 | fprintf(stderr, "%lu\t%e\t%e\t%e\t%e\t%e\n", 89 | (unsigned long)get_n(), 90 | percent_point(0.00) * 1000. / (double)n, 91 | percent_point(0.25) * 1000. / (double)n, 92 | percent_point(0.50) * 1000. / (double)n, 93 | percent_point(0.75) * 1000. / (double)n, 94 | percent_point(1.00) * 1000. / (double)n); 95 | } 96 | 97 | /* 98 | * print the page|line|word offset for each link in the pointer chain. 99 | */ 100 | void 101 | print_mem(char* addr, size_t size, size_t line) 102 | { 103 | char* p; 104 | uint64 base, off; 105 | size_t pagesize = getpagesize(); 106 | 107 | base = (uint64)addr; 108 | for (p = addr; *(char**)p != addr; p = *(char**)p) { 109 | off = (uint64)p - base; 110 | fprintf(stderr, "\t%lu\t%lu\t%lu\n", 111 | (unsigned long)(off / pagesize), 112 | (unsigned long)((off % pagesize) / line), 113 | (unsigned long)((off % line) / sizeof(char*))); 114 | } 115 | } 116 | 117 | void 118 | check_mem(char* addr, size_t size) 119 | { 120 | char* p; 121 | size_t i; 122 | size_t max = size / sizeof(char*) + 1; 123 | 124 | for (p=addr, i=0; *(char**)p != addr && i < max; p = *(char**)p, i++) { 125 | if (p < addr || addr + size <= p) { 126 | fprintf(stderr, "check_mem: pointer out of range!\n"); 127 | } 128 | } 129 | if (*(char**)p != addr) { 130 | fprintf(stderr, "check_mem: pointer chain doesn't loop\n"); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/lib_debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_DEBUG_H 2 | #define _LIB_DEBUG_H 3 | 4 | void print_results(int details); 5 | void bw_quartile(uint64 bytes); 6 | void nano_quartile(uint64 n); 7 | void print_mem(char* addr, size_t size, size_t line); 8 | void check_mem(char* addr, size_t size); 9 | 10 | #endif /* _LIB_DEBUG_H */ 11 | -------------------------------------------------------------------------------- /src/lib_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef LMBENCH_MEM_H 2 | #define LMBENCH_MEM_H 3 | 4 | 5 | #define MAX_MEM_PARALLELISM 16 6 | #define MEM_BENCHMARK_DECL(N) \ 7 | void mem_benchmark_##N(iter_t iterations, void* cookie); 8 | 9 | #define REPEAT_0(m) m(0) 10 | #define REPEAT_1(m) REPEAT_0(m) m(1) 11 | #define REPEAT_2(m) REPEAT_1(m) m(2) 12 | #define REPEAT_3(m) REPEAT_2(m) m(3) 13 | #define REPEAT_4(m) REPEAT_3(m) m(4) 14 | #define REPEAT_5(m) REPEAT_4(m) m(5) 15 | #define REPEAT_6(m) REPEAT_5(m) m(6) 16 | #define REPEAT_7(m) REPEAT_6(m) m(7) 17 | #define REPEAT_8(m) REPEAT_7(m) m(8) 18 | #define REPEAT_9(m) REPEAT_8(m) m(9) 19 | #define REPEAT_10(m) REPEAT_9(m) m(10) 20 | #define REPEAT_11(m) REPEAT_10(m) m(11) 21 | #define REPEAT_12(m) REPEAT_11(m) m(12) 22 | #define REPEAT_13(m) REPEAT_12(m) m(13) 23 | #define REPEAT_14(m) REPEAT_13(m) m(14) 24 | #define REPEAT_15(m) REPEAT_14(m) m(15) 25 | 26 | struct mem_state { 27 | char* addr; /* raw pointer returned by malloc */ 28 | char* base; /* page-aligned pointer */ 29 | char* p[MAX_MEM_PARALLELISM]; 30 | int initialized; 31 | int width; 32 | size_t len; 33 | size_t maxlen; 34 | size_t line; 35 | size_t pagesize; 36 | size_t nlines; 37 | size_t npages; 38 | size_t nwords; 39 | size_t* pages; 40 | size_t* lines; 41 | size_t* words; 42 | }; 43 | 44 | void stride_initialize(iter_t iterations, void* cookie); 45 | void thrash_initialize(iter_t iterations, void* cookie); 46 | void mem_initialize(iter_t iterations, void* cookie); 47 | void line_initialize(iter_t iterations, void* cookie); 48 | void tlb_initialize(iter_t iterations, void* cookie); 49 | void mem_cleanup(iter_t iterations, void* cookie); 50 | void tlb_cleanup(iter_t iterations, void* cookie); 51 | 52 | REPEAT_15(MEM_BENCHMARK_DECL) 53 | extern benchmp_f mem_benchmarks[]; 54 | 55 | ssize_t line_find(size_t l, int warmup, int repetitions, struct mem_state* state); 56 | double line_test(size_t l, int warmup, int repetitions, struct mem_state* state); 57 | double par_mem(size_t l, int warmup, int repetitions, struct mem_state* state); 58 | 59 | #endif /* LMBENCH_MEM_H */ 60 | 61 | -------------------------------------------------------------------------------- /src/lib_tcp.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int tcp_server(int prog, int rdwr); 8 | int tcp_done(int prog); 9 | int tcp_accept(int sock, int rdwr); 10 | int tcp_connect(char *host, int prog, int rdwr); 11 | void sock_optimize(int sock, int rdwr); 12 | int sockport(int s); 13 | -------------------------------------------------------------------------------- /src/lib_udp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * udp_lib.c - routines for managing UDP connections 3 | * 4 | * %W% %G% 5 | * 6 | * Copyright (c) 1994 Larry McVoy. 7 | */ 8 | #define _LIB /* bench.h needs this */ 9 | #include "bench.h" 10 | 11 | /* 12 | * Get a UDP socket, bind it, figure out the port, 13 | * and advertise the port as program "prog". 14 | * 15 | * XXX - it would be nice if you could advertise ascii strings. 16 | */ 17 | int 18 | udp_server(u_long prog, int rdwr) 19 | { 20 | int sock; 21 | struct sockaddr_in s; 22 | 23 | if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { 24 | perror("socket"); 25 | exit(1); 26 | } 27 | sock_optimize(sock, rdwr); 28 | bzero((void*)&s, sizeof(s)); 29 | s.sin_family = AF_INET; 30 | #ifdef NO_PORTMAPPER 31 | s.sin_port = htons(prog); 32 | #endif 33 | if (bind(sock, (struct sockaddr*)&s, sizeof(s)) < 0) { 34 | perror("bind"); 35 | exit(2); 36 | } 37 | #ifdef PORTMAP 38 | (void)pmap_unset(prog, (u_long)1); 39 | if (!pmap_set(prog, (u_long)1, (u_long)IPPROTO_UDP, 40 | (unsigned short)sockport(sock))) { 41 | perror("pmap_set"); 42 | exit(5); 43 | } 44 | #endif 45 | return (sock); 46 | } 47 | 48 | /* 49 | * Unadvertise the socket 50 | */ 51 | void 52 | udp_done(u_long prog) 53 | { 54 | #ifdef PORTMAP 55 | (void)pmap_unset(prog, (u_long)1); 56 | #endif 57 | } 58 | 59 | /* 60 | * "Connect" to the UCP socket advertised as "prog" on "host" and 61 | * return the connected socket. 62 | */ 63 | int 64 | udp_connect(char *host, u_long prog, int rdwr) 65 | { 66 | struct hostent *h; 67 | struct sockaddr_in sin; 68 | int sock; 69 | #ifndef NO_PORTMAPPER 70 | u_short port; 71 | #endif 72 | 73 | if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { 74 | perror("socket"); 75 | exit(1); 76 | } 77 | sock_optimize(sock, rdwr); 78 | if (!(h = gethostbyname(host))) { 79 | perror(host); 80 | exit(2); 81 | } 82 | bzero((void *) &sin, sizeof(sin)); 83 | sin.sin_family = AF_INET; 84 | bcopy((void*)h->h_addr, (void *) &sin.sin_addr, h->h_length); 85 | #ifndef PORTMAP 86 | sin.sin_port = htons(prog); 87 | #else 88 | port = pmap_getport(&sin, prog, (u_long)1, IPPROTO_UDP); 89 | if (!port) { 90 | perror("lib UDP: No port found"); 91 | exit(3); 92 | } 93 | sin.sin_port = htons(port); 94 | #endif 95 | if (connect(sock, (struct sockaddr*)&sin, sizeof(sin)) < 0) { 96 | perror("connect"); 97 | exit(4); 98 | } 99 | return (sock); 100 | } 101 | -------------------------------------------------------------------------------- /src/lib_udp.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int udp_server(u_long prog, int rdwr); 8 | void udp_done(u_long prog); 9 | int udp_connect(char *host, u_long prog, int rdwr); 10 | void sock_optimize(int sock, int rdwr); 11 | int sockport(int); 12 | 13 | -------------------------------------------------------------------------------- /src/lib_unix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * unix_lib.c - routines for managing UNIX connections. 3 | * 4 | * Positive port/program numbers are RPC ports, negative ones are UNIX ports. 5 | * 6 | * Copyright (c) 1994-1996 Larry McVoy. 7 | */ 8 | #define _LIB /* bench.h needs this */ 9 | #include "bench.h" 10 | 11 | /* 12 | * Get a UNIX socket, bind it. 13 | */ 14 | int 15 | unix_server(char *path) 16 | { 17 | int sock; 18 | struct sockaddr_un s; 19 | 20 | #ifdef LIBUNIX_VERBOSE 21 | fprintf(stderr, "unix_server(%s, %u)\n", prog, rdwr); 22 | #endif 23 | if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { 24 | perror("socket"); 25 | exit(1); 26 | } 27 | bzero((void*)&s, sizeof(s)); 28 | s.sun_family = AF_UNIX; 29 | strcpy(s.sun_path, path); 30 | if (bind(sock, (struct sockaddr*)&s, sizeof(s)) < 0) { 31 | perror("bind"); 32 | exit(2); 33 | } 34 | if (listen(sock, 100) < 0) { 35 | perror("listen"); 36 | exit(4); 37 | } 38 | return (sock); 39 | } 40 | 41 | /* 42 | * Unadvertise the socket 43 | */ 44 | int 45 | unix_done(int sock, char *path) 46 | { 47 | close(sock); 48 | unlink(path); 49 | return (0); 50 | } 51 | 52 | /* 53 | * Accept a connection and return it 54 | */ 55 | int 56 | unix_accept(int sock) 57 | { 58 | struct sockaddr_un s; 59 | int newsock; 60 | socklen_t namelen; 61 | 62 | namelen = sizeof(s); 63 | bzero((void*)&s, namelen); 64 | 65 | retry: 66 | if ((newsock = accept(sock, (struct sockaddr*)&s, &namelen)) < 0) { 67 | if (errno == EINTR) 68 | goto retry; 69 | perror("accept"); 70 | exit(6); 71 | } 72 | return (newsock); 73 | } 74 | 75 | /* 76 | * Connect to the UNIX socket advertised as "path" and 77 | * return the connected socket. 78 | */ 79 | int 80 | unix_connect(char *path) 81 | { 82 | struct sockaddr_un s; 83 | int sock; 84 | 85 | if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { 86 | perror("socket"); 87 | exit(1); 88 | } 89 | bzero((void*)&s, sizeof(s)); 90 | s.sun_family = AF_UNIX; 91 | strcpy(s.sun_path, path); 92 | if (connect(sock, (struct sockaddr*)&s, sizeof(s)) < 0) { 93 | perror("connect"); 94 | exit(4); 95 | } 96 | return (sock); 97 | } 98 | 99 | -------------------------------------------------------------------------------- /src/lib_unix.h: -------------------------------------------------------------------------------- 1 | /* lib_unix.c */ 2 | #ifndef _LIB_UNIX_H_ 3 | #define _LIB_UNIX_H_ 4 | int unix_server(char *path); 5 | int unix_done(int sock, char *path); 6 | int unix_accept(int sock); 7 | int unix_connect(char *path); 8 | #endif 9 | -------------------------------------------------------------------------------- /src/line.c: -------------------------------------------------------------------------------- 1 | /* 2 | * line.c - guess the cache line size 3 | * 4 | * usage: line 5 | * 6 | * Copyright (c) 2000 Carl Staelin. 7 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 8 | * additional restriction that results may published only if 9 | * (1) the benchmark is unmodified, and 10 | * (2) the version in the sccsid below is included in the report. 11 | * Support for this development by Sun Microsystems is gratefully acknowledged. 12 | */ 13 | char *id = "$Id$\n"; 14 | 15 | #include "bench.h" 16 | 17 | /* 18 | * Assumptions: 19 | * 20 | * 1) Cache lines are a multiple of pointer-size words 21 | * 2) Cache lines are no larger than 1/4 a page size 22 | * 3) Pages are an even multiple of cache lines 23 | */ 24 | int 25 | main(int ac, char **av) 26 | { 27 | int l; 28 | int verbose = 0; 29 | int warmup = 0; 30 | int repetitions = (1000000 <= get_enough(0) ? 1 : TRIES); 31 | int c; 32 | size_t maxlen = 64 * 1024 * 1024; 33 | struct mem_state state; 34 | char *usage = "[-v] [-W ] [-N ][-M len[K|M]]\n"; 35 | 36 | state.line = sizeof(char*); 37 | state.pagesize = getpagesize(); 38 | 39 | while (( c = getopt(ac, av, "avM:W:N:")) != EOF) { 40 | switch(c) { 41 | case 'v': 42 | verbose = 1; 43 | break; 44 | case 'M': 45 | maxlen = bytes(optarg); 46 | break; 47 | case 'W': 48 | warmup = atoi(optarg); 49 | break; 50 | case 'N': 51 | repetitions = atoi(optarg); 52 | break; 53 | default: 54 | lmbench_usage(ac, av, usage); 55 | break; 56 | } 57 | } 58 | 59 | if ((l = line_find(maxlen, warmup, repetitions, &state)) > 0) { 60 | if (verbose) { 61 | printf("cache line size: %d bytes\n", l); 62 | } else { 63 | printf("%d\n", l); 64 | } 65 | } 66 | 67 | return (0); 68 | } 69 | -------------------------------------------------------------------------------- /src/lmdd.1: -------------------------------------------------------------------------------- 1 | .\" %W% %G% 2 | .TH LMDD 1 3 | .SH NAME 4 | lmdd \- move io for performance and debugging tests 5 | .SH SYNOPSIS 6 | .B lmdd 7 | [ 8 | .IB option = value 9 | ] .\|.\|. 10 | .SH DESCRIPTION 11 | .B lmdd 12 | copies a specified input file to a specified output with possible 13 | conversions. This program is primarily useful for timing I/O since it 14 | prints out the timing statistics after completing. 15 | .SH OPTIONS 16 | .TP 15 17 | .BI if= name 18 | Input file is taken from 19 | .IR name ; 20 | .I internal 21 | is the default. 22 | .I internal 23 | is a special file that acts like Sun's 24 | .IR /dev/zero , 25 | i.e., it provides a buffer of zeros without doing a system call to get them. 26 | .TP 27 | .BI of= name 28 | Output file is taken from 29 | .IR name ; 30 | .I internal 31 | is the default. 32 | .I internal 33 | is a special file that acts like 34 | .IR /dev/null , 35 | without doing a system call to get rid of the data. 36 | .TP 37 | .BI bs= n 38 | Input and output block size 39 | .I n 40 | bytes (default 8192). Note that this is different from dd(1), it has 41 | a 512 byte default. Also note that the block size can be followed 42 | by 'k' or 'm' to indicate kilo bytes (*1024) or megabytes (*1024*1024), 43 | respectively. 44 | .TP 45 | .BI ipat= n 46 | If 47 | .B n 48 | is non zero, expect a known pattern in the file (see opat). Mismatches 49 | will be displayed as "ERROR: off=%d want=%x got=%x". The pattern is 50 | a sequence of 4 byte integers with the first 0, second 1, and so on. 51 | The default is not to check for the pattern. 52 | .TP 53 | .BI opat= n 54 | If 55 | .B n 56 | is non zero, generate a known pattern on the output stream. Used for 57 | debugging file system correctness. 58 | The default is not to generate the pattern. 59 | .TP 60 | .BI mismatch= n 61 | If 62 | .B n 63 | is non zero, stop at the first mismatched value. Used with ipat. 64 | .TP 65 | .BI skip= n 66 | Skip 67 | .IR n "" 68 | input blocks before starting copy. 69 | .TP 70 | .BI fsync= n 71 | If 72 | .I n 73 | is non-zero, call fsync(2) on the output file before exiting or printing 74 | timing statistics. 75 | .TP 76 | .BI sync= n 77 | If 78 | .I n 79 | is non-zero, call sync(2) before exiting or printing 80 | timing statistics. 81 | .TP 82 | .BI rand= n 83 | This argument, by default off, turns on random behavior. The argument is 84 | not a flag, it is a size, that size is used as the upper bound for the 85 | seeks. 86 | Also note that the block size can be followed 87 | by 'k' or 'm' to indicate kilo bytes (*1024) or megabytes (*1024*1024), 88 | .TP 89 | .BI flush= n 90 | If 91 | .I n 92 | is non-zero and mmap(2) is available, call msync(2) to invalidate the 93 | output file. This flushes the file to disk so that you don't have 94 | unmount/mount. It is not as good as mount/unmount because it just 95 | flushes file pages - it misses the indirect blocks which are still 96 | cached. Not supported on all systems, compile time option. 97 | .TP 98 | .BI rusage= n 99 | If 100 | .I n 101 | is non-zero, print rusage statistics as well as timing statistics. 102 | Not supported on all systems, compile time option. 103 | .TP 104 | .BI count= n 105 | Copy only 106 | .IR n "" 107 | input records. 108 | .SH EXAMPLES 109 | .LP 110 | This is the most common usage, the intent is to measure disk performance. 111 | The disk is a spare partition mounted on /spare. 112 | .sp 113 | .nf 114 | .in +4 115 | # mount /spare 116 | # lmdd if=internal of=/spare/XXX count=1000 fsync=1 117 | 7.81 MB in 3.78 seconds (2.0676 MB/sec) 118 | 119 | : Flush cache 120 | # umount /spare 121 | # mount /spare 122 | 123 | # lmdd if=/spare/XXX of=internal 124 | 7.81 MB in 2.83 seconds (2.7611 MB/sec) 125 | .in 126 | .sp 127 | .fi 128 | .SH AUTHOR 129 | Larry McVoy, lm@sun.com 130 | .br 131 | Not copyrighted. 132 | -------------------------------------------------------------------------------- /src/loop_o.c: -------------------------------------------------------------------------------- 1 | #include "bench.h" 2 | 3 | int 4 | main() 5 | { 6 | printf("%.8f\n", l_overhead()); 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /src/msleep.c: -------------------------------------------------------------------------------- 1 | #include "bench.h" 2 | 3 | int 4 | main(int ac, char **av) 5 | { 6 | #if defined(sgi) || defined(sun) || defined(linux) 7 | usleep(atoi(av[1]) * 1000); 8 | return (0); 9 | #else 10 | fd_set set; 11 | int fd; 12 | struct timeval tv; 13 | 14 | tv.tv_sec = 0; 15 | tv.tv_usec = atoi(av[1]) * 1000; 16 | FD_ZERO(&set); 17 | FD_SET(0, &set); 18 | select(1, &set, 0, 0, &tv); 19 | return (0); 20 | #endif 21 | } 22 | -------------------------------------------------------------------------------- /src/par_mem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * par_mem.c - determine the memory hierarchy parallelism 3 | * 4 | * usage: par_mem [-L ] [-M len[K|M]] [-W ] [-N ] 5 | * 6 | * Copyright (c) 2000 Carl Staelin. 7 | * Copyright (c) 1994 Larry McVoy. Distributed under the FSF GPL with 8 | * additional restriction that results may published only if 9 | * (1) the benchmark is unmodified, and 10 | * (2) the version in the sccsid below is included in the report. 11 | * Support for this development by Sun Microsystems is gratefully acknowledged. 12 | */ 13 | char *id = "$Id$\n"; 14 | 15 | #include "bench.h" 16 | 17 | void compute_times(struct mem_state* state, double* tlb_time, double* cache_time); 18 | 19 | 20 | /* 21 | * Assumptions: 22 | * 23 | * 1) Cache lines are a multiple of pointer-size words 24 | * 2) Cache lines are no larger than 1/8 of a page (typically 512 bytes) 25 | * 3) Pages are an even multiple of cache lines 26 | */ 27 | int 28 | main(int ac, char **av) 29 | { 30 | int i; 31 | int c; 32 | int warmup = 0; 33 | int repetitions = (1000000 <= get_enough(0) ? 1 : TRIES); 34 | size_t maxlen = 64 * 1024 * 1024; 35 | double par; 36 | struct mem_state state; 37 | char *usage = "[-L ] [-M len[K|M]] [-W ] [-N ]\n"; 38 | 39 | state.line = getpagesize() / 16; 40 | state.pagesize = getpagesize(); 41 | 42 | while (( c = getopt(ac, av, "L:M:W:N:")) != EOF) { 43 | switch(c) { 44 | case 'L': 45 | state.line = atoi(optarg); 46 | if (state.line < sizeof(char*)) 47 | state.line = sizeof(char*); 48 | break; 49 | case 'M': 50 | maxlen = bytes(optarg); 51 | break; 52 | case 'W': 53 | warmup = atoi(optarg); 54 | break; 55 | case 'N': 56 | repetitions = atoi(optarg); 57 | break; 58 | default: 59 | lmbench_usage(ac, av, usage); 60 | break; 61 | } 62 | } 63 | 64 | for (i = MAX_MEM_PARALLELISM * state.line; i <= maxlen; i<<=1) { 65 | par = par_mem(i, warmup, repetitions, &state); 66 | 67 | if (par > 0.) { 68 | fprintf(stderr, "%.6f %.2f\n", 69 | i / (1000. * 1000.), par); 70 | } 71 | } 72 | 73 | exit(0); 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/rhttp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rhttp.c - simple HTTP transaction latency test 3 | * 4 | * usage: rhttp hostname [port] remote-clients -p file file 5 | * 6 | * This turns into a bunch of 7 | * rsh remote http hostname file file file [port] 8 | * with the results aggragated and reported. 9 | * 10 | * The program "http" must be in your path on the remote machine. 11 | * 12 | * XXX - the way this should work is like so: 13 | * parent process reading file names from stdin 14 | * multiple child processes connected to the parent process 15 | * while more file names 16 | * wait for a child process to be idle 17 | * feed it ~10 filenames 18 | * the child processes need to be able to tell the parent that they 19 | * want more work. They also need to pass back the results. 20 | * 21 | * Copyright (c) 1994-1997 Larry McVoy. Distributed under the FSF GPL with 22 | * additional restriction that results may published only if 23 | * (1) the benchmark is unmodified, and 24 | * (2) the version in the sccsid below is included in the report. 25 | * Support for this development by Silicon Graphics is gratefully acknowledged. 26 | */ 27 | char *id = "$Id$\n"; 28 | 29 | #include "bench.h" 30 | 31 | int 32 | main(int ac, char **av) 33 | { 34 | char *name = av[0], *server, *prog; 35 | int i, j; 36 | uint64 total = 0; 37 | uint64 usecs = 0; 38 | char *args[1024]; 39 | 40 | if (ac < 5) { 41 | usage: fprintf(stderr, 42 | "Usage: %s hostname [port] remote-clients -p file ...\n", 43 | name); 44 | exit(1); 45 | } 46 | server = av[1]; 47 | av++, ac--; /* eat server */ 48 | if (atoi(av[1]) != 0) { 49 | prog = av[1]; 50 | av++, ac--; /* eat port */ 51 | } else { 52 | prog = "80"; /* http */ 53 | } 54 | for (i = 1; i < ac; ++i) { 55 | if (!strcmp("-p", av[i])) { 56 | i++; 57 | break; 58 | } 59 | } 60 | args[0] = "rsh"; 61 | args[2] = "http"; 62 | args[3] = server; 63 | j = 4; 64 | while (i < ac) { 65 | args[j++] = av[i++]; 66 | } 67 | args[j++] = prog; 68 | args[j] = 0; 69 | for (i = 1; i < ac; ++i) { 70 | if (!strcmp("-p", av[i])) { 71 | break; 72 | } 73 | args[1] = av[i]; 74 | for (j = 0; args[j]; j++) { 75 | printf("%s ", args[j]); 76 | } 77 | printf("\n"); 78 | if (fork() == 0) { 79 | char name[30]; 80 | 81 | sprintf(name, "/tmp/rhttp%d", i); 82 | creat(name, 0666); 83 | close(2); 84 | dup(1); 85 | execvp(args[0], args); 86 | perror(args[0]); 87 | exit(1); 88 | } 89 | } 90 | for (i = 1; i < ac; ++i) { 91 | if (!strcmp("-p", av[i])) { 92 | break; 93 | } 94 | wait(0); 95 | } 96 | system("cat /tmp/rhttp*; rm /tmp/rhttp*"); 97 | exit(1); 98 | for (i = 1; i < ac; ++i) { 99 | int fd, n, m = 0; 100 | float f1 = 0, f2 = 0; 101 | char buf[30]; 102 | 103 | if (!strcmp("-p", av[i])) { 104 | break; 105 | } 106 | sprintf(buf, "/tmp/http%d", i); 107 | fd = open(buf, 0); 108 | unlink(buf); 109 | /* 110 | * Avg xfer: 3.9KB, 235.0KB in 2038 millisecs, 115.31 KB/sec 111 | */ 112 | n = read(fd, buf, XFERSIZE); 113 | buf[n] = 0; 114 | sscanf(buf, "Avg xfer: %fKB, %fKB in %d millisecs,", 115 | &f1, &f2, &m); 116 | if (m > usecs) { 117 | usecs = m; 118 | } 119 | total += f2; 120 | } 121 | total <<= 10; 122 | usecs *= 1000; 123 | settime(usecs); 124 | latency((uint64)1, total); 125 | } 126 | -------------------------------------------------------------------------------- /src/seek.c: -------------------------------------------------------------------------------- 1 | char *id = "$Id$\n"; 2 | /* 3 | * Seek - calculate seeks as a function of distance. 4 | * 5 | * Usage: seek file size 6 | * 7 | * Copyright (c) 1994,1995,1996 Larry McVoy. All rights reserved. 8 | */ 9 | 10 | #include "bench.h" 11 | 12 | #define STRIDE 1024*1024 13 | 14 | main(ac, av) 15 | int ac; 16 | char *av[]; 17 | { 18 | char buf[512]; 19 | int disk; 20 | off64_t size; 21 | off64_t begin, end; 22 | int usecs; 23 | 24 | if (ac != 3) { 25 | exit(1); 26 | } 27 | if ((disk = open(av[1], 0)) == -1) { 28 | exit(1); 29 | } 30 | size = bytes(av[2]); 31 | 32 | /* 33 | * We flip back and forth, in strides of 1MB. 34 | * If we have a 100MB disk, that means we do 35 | * 1, 99, 2, 98, etc. 36 | */ 37 | end = size; 38 | begin = 0; 39 | seekto(disk, begin, SEEK_SET); 40 | read(disk, buf, sizeof(buf)); 41 | while (end > begin) { 42 | end -= STRIDE; 43 | start(); 44 | seekto(disk, end, SEEK_SET); 45 | read(disk, buf, sizeof(buf)); 46 | usecs = stop(); 47 | printf("%.04f %.04f\n", (end - begin) / 1000000., usecs/1000.); 48 | 49 | begin += STRIDE; 50 | start(); 51 | seekto(disk, begin, SEEK_SET); 52 | read(disk, buf, sizeof(buf)); 53 | usecs = stop(); 54 | printf("%.04f %.04f\n", (end - begin) / 1000000., usecs/1000.); 55 | } 56 | exit(0); 57 | } 58 | -------------------------------------------------------------------------------- /src/stats.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATS_H 2 | #define _STATS_H 3 | 4 | #include "bench.h" 5 | #include "timing.h" 6 | 7 | #define ABS(x) ((x) < 0 ? -(x) : (x)) 8 | 9 | int int_compare(const void *a, const void *b); 10 | int uint64_compare(const void *a, const void *b); 11 | int double_compare(const void *a, const void *b); 12 | 13 | typedef int (*int_stat)(int *values, int size); 14 | typedef uint64 (*uint64_stat)(uint64 *values, int size); 15 | typedef double (*double_stat)(double *values, int size); 16 | 17 | int int_median(int *values, int size); 18 | uint64 uint64_median(uint64 *values, int size); 19 | double double_median(double *values, int size); 20 | 21 | int int_mean(int *values, int size); 22 | uint64 uint64_mean(uint64 *values, int size); 23 | double double_mean(double *values, int size); 24 | 25 | int int_min(int *values, int size); 26 | uint64 uint64_min(uint64 *values, int size); 27 | double double_min(double *values, int size); 28 | 29 | int int_max(int *values, int size); 30 | uint64 uint64_max(uint64 *values, int size); 31 | double double_max(double *values, int size); 32 | 33 | double int_variance(int *values, int size); 34 | double uint64_variance(uint64 *values, int size); 35 | double double_variance(double *values, int size); 36 | 37 | double int_moment(int moment, int *values, int size); 38 | double uint64_moment(int moment, uint64 *values, int size); 39 | double double_moment(int moment, double *values, int size); 40 | 41 | double int_stderr(int *values, int size); 42 | double uint64_stderr(uint64 *values, int size); 43 | double double_stderr(double *values, int size); 44 | 45 | double int_skew(int *values, int size); 46 | double uint64_skew(uint64 *values, int size); 47 | double double_skew(double *values, int size); 48 | 49 | double int_kurtosis(int *values, int size); 50 | double uint64_kurtosis(uint64 *values, int size); 51 | double double_kurtosis(double *values, int size); 52 | 53 | double int_bootstrap_stderr(int *values, int size, int_stat f); 54 | double uint64_bootstrap_stderr(uint64 *values, int size, uint64_stat f); 55 | double double_bootstrap_stderr(double *values, int size, double_stat f); 56 | 57 | void regression(double *x, double *y, double *sig, int n, 58 | double *a, double *b, double *sig_a, double *sig_b, 59 | double *chi2); 60 | 61 | #endif /* _STATS_H */ 62 | -------------------------------------------------------------------------------- /src/timing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | #ifndef _TIMING_H 5 | #define _TIMING_H 6 | 7 | char *p64(uint64 big); 8 | char *p64sz(uint64 big); 9 | double Delta(void); 10 | double Now(void); 11 | void adjust(int usec); 12 | void bandwidth(uint64 bytes, uint64 times, int verbose); 13 | uint64 bytes(char *s); 14 | void context(uint64 xfers); 15 | uint64 delta(void); 16 | int get_enough(int); 17 | uint64 get_n(void); 18 | void kb(uint64 bytes); 19 | double l_overhead(void); 20 | char last(char *s); 21 | void latency(uint64 xfers, uint64 size); 22 | void mb(uint64 bytes); 23 | void micro(char *s, uint64 n); 24 | void micromb(uint64 mb, uint64 n); 25 | void milli(char *s, uint64 n); 26 | void morefds(void); 27 | void nano(char *s, uint64 n); 28 | uint64 now(void); 29 | void ptime(uint64 n); 30 | void rusage(void); 31 | void save_n(uint64); 32 | void settime(uint64 usecs); 33 | void start(struct timeval *tv); 34 | uint64 stop(struct timeval *begin, struct timeval *end); 35 | uint64 t_overhead(void); 36 | double timespent(void); 37 | void timing(FILE *out); 38 | uint64 tvdelta(struct timeval *, struct timeval *); 39 | void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0); 40 | void use_int(int result); 41 | void use_pointer(void *result); 42 | uint64 usecs_spent(void); 43 | void touch(char *buf, size_t size); 44 | size_t* permutation(size_t max, size_t scale); 45 | int cp(char* src, char* dst, mode_t mode); 46 | long bread(void* src, long count); 47 | 48 | #if defined(hpux) || defined(__hpux) 49 | int getpagesize(); 50 | #endif 51 | 52 | #endif /* _TIMING_H */ 53 | -------------------------------------------------------------------------------- /src/timing_o.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "bench.h" 3 | 4 | int 5 | main() 6 | { 7 | putenv("LOOP_O=0.0"); 8 | printf("%lu\n", (unsigned long)t_overhead()); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #define MAJOR 3 2 | #define MINOR -9 /* negative is alpha, it "increases" */ 3 | -------------------------------------------------------------------------------- /src/webpage-lm.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foss-for-synopsys-dwc-arc-processors/lmbench/670e2013157340ebcb20a04c174765b666f3bc13/src/webpage-lm.tar --------------------------------------------------------------------------------