[comp.sys.amiga] Transfer rates with FFS

AXDRW%ALASKA.BITNET@cunyvm.cuny.edu (Don R. Withey) (10/20/88)

Well someone asked on the net about transfer speed for the FFS, it got me
to wonder about how fast my system might go under the FFS.  I have the
following configuration: Amiga 2000, A2052 2meg memory board, A2090A hard
disk controller, Seagate ST277N hard disk.  I wrote a simple program to
allocate a buffer of some size and then write it a number of times to
a file, and then read it back into the same buffer.  I was fairly amazed
at the speeds that I was able to get.  The results shown below were generated
with an iteration count of 10.  Just for grins I provided the program also.
It is writtin in Lattice C 4.0 (I can't wait until I get my hands on 5.0 ;-)

Your milage may vary, the average seek time for a ST277N is 40ms by the
way.

        Don

block           read            write
size            k/sec           k/sec
--------------------------------------
32k             320.0           216.22
64k             383.23          261.22
128k            414.24          287.64
256k            414.91          304.76
512k            425.25          316.44


----#cut here#--------------------------#cut here#----
#include <stdio.h>
#include <dos.h>
#include <exec/memory.h>
#include <proto/dos.h>
#include <proto/exec.h>

void main()
{
long f;
char *buff, t1[8], t2[8];
long time1, time2, i, iter, size;
double ksec;

  printf("Enter block size in Kbytes->"); /* get buffer size for io */
  scanf("%ld\n", &size);
  size = size * 1024;
  printf("Enter number of iterations ->"); /* get number of iterations */
  scanf("%ld\n", &iter);                   /* to use buffer per operation */
  printf("Block size, interations = %ld, %ld\n", size, iter);
  buff = (char *)AllocMem(size, MEMF_CLEAR);
  if (buff == 0) {              /* alloc failed so exit */
    printf("Not enough contigious memory; block size = %ld\n", size);
    exit();
  }

  f = Open("test.file", MODE_NEWFILE);

  getclk(t1);  /* get system time */
  for (i = 0; i < iter; i++)
    Write(f, buff, size);
  getclk(t2);

/* the getclk call returns an char array[8], where array[5] is minutes,
   array[6] is seconds, and array[7] is hundredths of seconds */
  time1 = t1[5] * 6000 + t1[6] * 100 + t1[7];
  time2 = t2[5] * 6000 + t2[6] * 100 + t2[7];
  ksec = (double)(((double)(size * iter) / (double)(time2 - time1))
    * 100.0) / 1024.0; /* convert elapsed time to k/second */
  printf("elapsed time for write = %ld, K/sec = %10.4f\n",
     (time2 - time1), ksec);
  Close(f);

  Delay(100);  /* give file system time to settle before next test */
               /* didn't know if I needed this, but just in case */

  f = Open("test.file", MODE_OLDFILE);

  getclk(t1);
  for (i = 0; i < iter; i++)
    Read(f, buff, size);
  getclk(t2);

  time1 = t1[5] * 6000 + t1[6] * 100 + t1[7];
  time2 = t2[5] * 6000 + t2[6] * 100 + t2[7];
  ksec = (double)(((double)(size * iter) / (double)(time2 - time1))
    * 100.0) / 1024.0;  /* convert elapsed time to k/second */
  printf("elapsed time for read = %ld, K/sec = %10.4f\n",
     (time2 - time1), ksec);
  Close(f);
  DeleteFile("test.file");  /* get rid of the temp file */
  FreeMem(buff, size);
}
----------------------------------------------------------------
Don R Withey                    BITNET: AXDRW@ALASKA.BITNET
University of Alaska            BIX:    dwithey
3211 U.A.A. Drive
Anchorage, Alaska  99508
907-786-1074 (work) 907-277-9063 (home) 907-274-6378 (other home)
-----------------------------------------------------------------
Any expressed opinion is my own and in no way represent those of my employer,
the University of Alaska.