[mod.computers.ridge] benchmark for the ridge

info-ridge@ucbvax.UUCP (12/14/85)

A while ago I posted a message requesting the 'general opinion from
the user community' on the Ridge, our problem here being to choose
between Ridge and Sun-3. I have received several answers, and I am still
receiving some, so I will delay the posting of the digest for a while.

The comments I have gathered so far roughly boil down to this:

  1/ ROS is not a true 4.2, and it's not very reliable

  2/ the hardware is very fast, and is well suited for CPU-intensive tasks

  3/ the Ridge has very poor multi-user performance


On the third point, it has been noted at least in one message that even with
large amounts of memory, response time with several users working was very
poor. If paging is not responsible, I would tentatively say that
context-switching may be at fault (e.g. too slow). I wrote a little
benchmark to measure context-switching times on Unix machines, and I ran
it on several systems (VAX, Sun, Apollo, PC-AT, and French-made machines
you've never heard of !). The idea is to have two processes writing and
reading a single character off a pipe, with the character (acting as a token)
passing control from one process to another.

The results obtained so far are the following:
 (per context-switch, in millisecs)

Bit-slice Apollo:  2.4
PC-AT (Xenix)   :  4.8
VAX 780 (4.2)   :  2.6
Sun-2           :  2.7
Sun-3           :  0.3

Following is the source for the benchmark; would people
on the net would run it on their Ridge(s) and send me their results,
along with the configuration of their host (memory size, etc.) ?
I'll post everything back on the net along with the digest.

usage: source in 'foo.c', 'cc -o foo foo.c', 'foo 2000 > result'

a typical output should look like this:
(beware, it might take up to 30 secs to run !)

 execution times (ms): 

 FATHER.... user: 540
          system: 10420
 SON....    user: 200
          system: 10380

 total system time: 20800

 i.e. 5.20 ms per context-switch 



here's the source:

Didier.
===================================


#include <stdio.h>

int n0;                  
int pidChild;
long t;
long buffer[4], buffer0[4];


report()
{
 int n;

 times (buffer);
 for (n=0; n<4; ++n) buffer[n] = (buffer[n]-buffer0[n])*(long)20;
 printf ("\n execution times (ms): \n\n");
 printf (" FATHER.... user: %ld\n", buffer[0]);
 printf ("          system: %ld\n", buffer[1]);
 printf (" SON....    user: %ld\n", buffer[2]);
 printf ("          system: %ld\n", buffer[3]);
 printf ("\n total system time: %ld\n", t=(buffer[1] + buffer[3]));
 printf ("\n i.e. %.2f ms per context-switch \n\n", (float)t/(float)(2*n0));
}


main (argc, argv)
int argc;
char *argv[];

{
int n;
int FtoS[2], StoF[2];
char c;

if (argc!=2) { printf ("I need one argument...\n"); exit ();}
sscanf(argv[1], "%d", &n0);
pipe(FtoS);
pipe(StoF);
pidChild = fork ();

if (pidChild!=0)     
 { 
   close(FtoS[0]);     /* father process */
   close(StoF[1]);
   c = 'x';
   times (buffer0);
   for (n=0; n<n0; ++n)
   {
    write(FtoS[1], &c, 1);
    read(StoF[0], &c, 1);
   }
   wait (&n);
   report ();
 }
else  
    {
      close (FtoS[1]);     /* child process */
      close (StoF[0]);
      for (n=0; n<n0; ++n)   
      {
       read(FtoS[0], &c, 1);
       write(StoF[1], &c, 1);
      }
    }
}