Subject: Re: scsi adaptor speeds etc
To: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
From: Justin T. Gibbs <gibbs@freefall.freebsd.org>
List: port-i386
Date: 04/01/1996 18:02:23
>
>
>>As a data point:
>>ncr810, p100, netbsd-current
>>4338793 bytes/sec
>>with both scsiII drives I have.
>
>Using what test? ;-)
>
>What would be more useful (to me, at least) would be if you could
>provide iozone and/or Bonnie results.  I can make both binaries
>available if you don't want to build your own.

I would also suggest using this little program from Bruce Evans.
It attempts to measure the combined controller and disk command
overhead:

#include <sys/types.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

#define ITERATIONS	1000

static int syserror(const char *where);
static long timeit(int fd, char *buf, unsigned blocksize);

int main(int argc, char **argv)
{
    char buf[2 * 4096];
    int fd;
    long time_4096;
    long time_8192;

    if (argc != 2)
    {
	fprintf(stderr, "usage: %s device\n", argv[0]);
	exit(1);
    }
    fd = open(argv[1], O_RDONLY);
    if (fd == -1)
	syserror("open");
    time_4096 = timeit(fd, buf, 4096);
    time_8192 = timeit(fd, buf, 8192);
    printf("Command overhead is %ld usec (time_4096 = %ld, time_8192 = %ld)\n",
	   (time_4096 - (time_8192 - time_4096)) / ITERATIONS,
	   time_4096 / ITERATIONS, time_8192 / ITERATIONS);
    printf("transfer speed is %g bytes/sec\n",
	   4096 * ITERATIONS * 1000000.0 / (time_8192 - time_4096));
    exit(0);
}

static int syserror(const char *where)
{
    perror(where);
    exit(1);
}

static long timeit(int fd, char *buf, unsigned blocksize)
{
    struct timeval finish;
    int i;
    struct timeval start;

    if (read(fd, buf, blocksize) != blocksize)
	syserror("read");
    if (gettimeofday(&start, (struct timezone *)NULL) != 0)
	syserror("gettimeofday(start)");
    for (i = 0; i < ITERATIONS; ++i)
    {
	if (lseek(fd, (off_t)0, SEEK_SET) == -1)
	    syserror("lseek");
	if (read(fd, buf, blocksize) != blocksize)
	    syserror("read");
    }
    if (gettimeofday(&finish, (struct timezone *)NULL) != 0)
	syserror("gettimeofday(finish)");
    return (finish.tv_sec - start.tv_sec) * 1000000
	    + finish.tv_usec - start.tv_usec;
}

>-----------------------------------------------------------------------------
>  Michael L. VanLoon                                 michaelv@HeadCandy.com
>       --<  Free your mind and your machine -- NetBSD free un*x  >--
>     NetBSD working ports: 386+PC, Mac 68k, Amiga, HP300, Sun3, Sun4,
>                           DEC PMAX (MIPS), DEC Alpha, PC532
>     NetBSD ports in progress: VAX, Atari 68k, others...
>-----------------------------------------------------------------------------

--
Justin T. Gibbs
===========================================
  FreeBSD: Turning PCs into workstations
===========================================