NeXT Drive-Benchmark

Platform:

Was an Intel-Next, a Laptop, original NeXT, really any kind of computer, but NeXT-OS. What is depicted in the following picture is the drive bandwidth compared to different types like IBM, Western Digital, Samsung, etc.

© Dr. Henry Koplien

Everyone is able to verify the data, even on their own machines, so no magic! You can do the stuff with a simple C-program like I did:

#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <errno.h>

#define MAX_SIZE (512 * 1024 * 1024)
#define SECONDS  1
#define DISK	 "/dev/rsd0h"

static int           alarmflg, fd;
unsigned static char buf[MAX_SIZE];

static void signal_handler(int sig) {
/***********************************/
  switch (sig) {
    case SIGALRM: alarmflg = 1;
                  alarm(0);
                  break;

    default     : fprintf(stderr, "Got Suspect Signal %d\n", sig);
                  exit (-1);
  };
};

void f(int blk) {
/***************/
  read(fd, &buf, blk);
};

void g(int blk) {
/***************/
};

int main(int argc, char **argv) {
/*******************************/
unsigned long  i, j, k;
double         execution;
struct timeval start_time, exec_time, all_time;
char           *device = DISK;
                     
  if (argc > 1)
    device = argv[1];

  if ((fd = open(device, O_RDONLY)) < 0) {
    printf("Unable to open drive (%s).\n", device);
    return -1;
  };

  fprintf(stderr, "Verifying %s...\n", device);

  (void) signal(SIGALRM, signal_handler);
  (void) siginterrupt(SIGALRM, 1);

  for (i = 1; i <= MAX_SIZE; i *= 2) {
    alarmflg = 0;
    alarm(1);

    j = 0;
    while (!alarmflg) {
      f(i);
      j++;
    };
    j *= SECONDS;

    gettimeofday(&start_time, NULL);
    for(k = 0; k < j; k++)
      f(i);
    gettimeofday(&exec_time, NULL);
    for(k = 0; k < j; k++)
      g(i);
    gettimeofday(&all_time, NULL);

    execution = 2.0 * exec_time.tv_sec + 0.000002 * exec_time.tv_usec - all_time.tv_sec - 0.000001 * all_time.tv_usec - start_time.tv_sec - 0.000001 * start_time.tv_usec;

    printf("%d\t%4.2f\n", i, (double)(i)*j / execution / 0x100000);
    fprintf(stderr, "time for reading %d bytes %d times: %fs -> %4.2f Mbytes/s\n", i, j, execution, (double)(i)*j / execution / 0x100000);
  };

  close(fd);

  return 0;
};

© Dr. Henry Koplien