Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!emory!jdyx!shawn From: shawn@jdyx.UUCP (Shawn Hayes) Newsgroups: comp.unix.sysv386 Subject: Disk benchmark (long) Message-ID: <1990Oct9.015948.551@jdyx.UUCP> Date: 9 Oct 90 01:59:48 GMT Distribution: usa Organization: JDyx Enterprises (Atlanta GA) Lines: 394 The company I work for is looking for a 386 based Unix for a new product. One of the requirements for any system we use is that it have very good disk access capabilites. To judge the capabilites of AIX 1.2 and OS/2 (our first candidates) a benchmark was written that does random and sequential reads and writes to a file. I'd like for anyone who has a 386 based Unix system to run the included benchmark and post(or email) the results so we have some basis for comparison with any other Unixes. The benchmark is very short. The only requirement is that you have a C compiler and a little over two megabytes of disk space as the file that's used will be 2 megabytes in size. To compile the benchmark: cc -o disktest disktest.c sm0run.c and to run the benchmark: touch DISKTST ;create the test file time disktest SYNC ;run the benchmark and force all writes to ; disk then record the results If you wish you can remove the DISKTST file, recreate it and rerun the benchmark in NOSYNC mode which will result in all writes being postponed until the OS is ready to post them. (time disktest NOSYNC) The results that we recieved from AIX 1.2 were 1.11 minutes for the SYNC test and about 20 seconds for OS/2 using the same hardware. ------------------------cut here---------------------------------- #!/bin/sh # This is c, a shell archive (shar 3.32) # made 10/08/1990 15:19 UTC by root@amber # Source directory /u/shar/disktest # # existing files WILL be overwritten # This format requires very little intelligence at unshar time. # "echo" and "sed" will be needed. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 2623 -rw-r--r-- disktest.c # 3506 -rw-r--r-- sm0run.c # 1665 -rw-r--r-- sm0run.h # # ============= disktest.c ============== echo "x - extracting disktest.c (Text)" sed 's/^X//' << 'SHAR_EOF' > disktest.c && X X#include "sm0run.h" X Xchar *FileName = "DISKTST"; Xchar Record[70] = { "123456789012345678901234567890123456789012345678901234567890123456789" }; Xchar BlankRecord[4096]; Xunsigned long next = 1; X X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int i; X int j; X int Read; X int Wrote; X int Display; X int SyncMode; X int NumLoops = 50; X char Buf[100]; X FileType Handle; X X Display = TRUE; X SyncMode = SYNC; X if( argc >=2 ) X { X if( strncmp("NO",argv[1],2) == 0 ) X SyncMode = NOSYNC; X if( strncmp("no",argv[1],2) == 0 ) X SyncMode = NOSYNC; X } X if( argc >=3 ) X NumLoops = atoi(argv[2]); X if( argc >=4 ) X Display = FALSE; X X printf("Using %s mode.\n", SyncMode==SYNC ? "SYNC" : "NOSYNC" ); X X Handle = GenericOpen( FileName, SyncMode ); X X /*******************/ X /* Create File */ X /*******************/ X printf("Creating file\n"); X GenericSeek( Handle, 0L ); X for( i=0; i<560; i++ ) X { X Wrote = GenericWrite(Handle, (void *) BlankRecord, X 4096, SyncMode ); X if (Wrote != 4096) X { X printf("\nError writing to file\n"); X exit(0); X } X if( (i%100)==0 ) X if( Display ) X printf("%d\n",i); X } X X /****************************/ X /* Perform Random Reads */ X /****************************/ X printf("Performing Random Reads\n"); X for( i=0; i sm0run.c && X/* X************************************************************************* X* sm0run.c * X************************************************************************* X* * X* Description: This module deals with queue calls, hopefully * X* generically between unix and os/2. * X* * X* COPYRIGHT 1990 SCIENTIFIC-ATLANTA, INC. * X* ALL RIGHTS RESERVED * X************************************************************************* X* Rev Date Author Change Description * X* ----- -------- ------ --------------------------------------- * X* 1.0 03/21/90 Original Release * X************************************************************************* X*/ X X#include X#include X#include "sm0run.h" X X#define Q_PERM_ALL 00666 X#define BAD_VALUE -1 X#define GOOD_VALUE 0 X X X X X X X X/* X*********************************** X* * X* Generic routines * X* * X*********************************** X*/ X#if 0 X XFileType GenericOpen(FileName) X char *FileName; X{ X return(fopen(FileName, "r+b")); X} X X Xint GenericFailure(Handle) X FileType Handle; X{ X return(Handle == NULL); X} X X Xvoid GenericClose(Handle) X FileType Handle; X{ X fclose(Handle); X} X X Xint GenericRead(Handle, Buffer, BufLen) X FileType Handle; X void *Buffer; X int BufLen; X{ X return(fread(Buffer, 1, BufLen, Handle)); X} X X Xint GenericWrite(Handle, Buffer, BufLen) X FileType Handle; X void *Buffer; X int BufLen; X{ X return(fwrite(Buffer, 1, BufLen, Handle)); X} X X Xvoid GenericSeek(Handle, Position) X FileType Handle; X long Position; X{ X int err ; X X err = fseek(Handle, Position, 0); X if (err) printf("fseek err=%d; Position=%ld\n", err, Position ) ; X} X Xvoid GenericFlush( File1, File2, File3 ) X FileType File1, File2, File3; X{ X fflush( File1 ); X fflush( File2 ); X fflush( File3 ); X} X X#else X X#include X#define O_BINARY 0 X XFileType GenericOpen( FileName, SyncMode ) X char *FileName; X int SyncMode; X{ X if( SyncMode == NOSYNC ) X return(open(FileName, O_RDWR | O_BINARY )); X else X return(open(FileName, O_RDWR | O_BINARY | O_SYNC )); X} X X Xint GenericFailure(Handle) X FileType Handle; X{ X return(Handle <= 0); X} X X Xvoid GenericClose(Handle) X FileType Handle; X{ X close(Handle); X} X X Xint GenericRead(Handle, Buffer, BufLen) X FileType Handle; X void *Buffer; X int BufLen; X{ X return(read(Handle, Buffer, BufLen)); X} X X Xint GenericWrite(Handle, Buffer, BufLen, SyncMode) X FileType Handle; X void *Buffer; X int BufLen; X int SyncMode; X{ X return(write(Handle, Buffer, BufLen)); X} X X Xvoid GenericSeek(Handle, Position) X FileType Handle; X long Position; X{ X long err ; X X err = lseek(Handle, Position, 0); X if (err==-1L) printf("lseek err=%ld; Position=%ld\n", err, Position ) ; X} X Xvoid GenericFlush( File1, File2, File3 ) X FileType File1, File2, File3; X{ X/* fsync( File1 ); X fsync( File2 ); X fsync( File3 ); X*/} X X#endif X X X/* end of file */ SHAR_EOF # ============= sm0run.h ============== echo "x - extracting sm0run.h (Text)" sed 's/^X//' << 'SHAR_EOF' > sm0run.h && X/* File: sm0run.h for the IBM-6000 Model 320 */ X X#include X#include X#include /* needed for OS/2 and AIX */ X X/* #define TRUE 1 */ X/* #define FALSE 0 */ X#define forever 1 X Xtypedef unsigned char BYTE ; Xtypedef unsigned short BOOL ; Xtypedef unsigned long ULONG ; Xtypedef int logical ; Xtypedef int FileType; X X#define DONTWAIT 0L X#define WAITFOREVER -1L X#define MAXQUEUES 10 X#define EMPTY 0 X#define FULL 100 X#define MAXBUFFERS 600 X#define MAXBUFSIZ 70 X X#define SYNC -1 X#define NOSYNC 0 X Xint Comm_Read_String(); /* (char *StrBuffer, char Terminator, X int MaxLength, long TimeOut, int PortID); */ Xint Comm_Write_String (char *StrBuffer, int MaxLength, int PortID); X Xint Read_Queue (int WhoAmI, int *WhoIsMsgFrom, char *Buffer, X int *Length, long TimeOut); Xint Write_Queue (int WhoAmI, int WhoIsMsgTo, char *Buffer, X int Length); X Xvoid Timer_Reset (); Xlong Timer_Now (); Xvoid sleep (long Time); X XFileType GenericOpen (); XBOOL GerericFailed (); Xvoid GenericClose (); Xint GenericRead (); Xint GenericWrite (); Xvoid GenericSeek (); Xvoid GenericFlush (); X X/* end of file */ SHAR_EOF exit 0 Please post your results. Thanks. Shawn Hayes