[comp.arch] Small Benchmark

bs@gauss.mitre.org (Robert D. Silverman) (05/18/91)

I would like to present the following (small) benchmark code for Unix
systems. A co-worker has dubbed this 'bobstones'.

This program very seriously tests memory and data cacheing effects. It is
quite simple. 

I would like to ask that people out there try this out and report the results
back to this forum. It only takes a few seconds to run.
 
This code is taken from a real application that spends 50% of its time 
in the loop given below.

#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
char sieve[3000000];			/* sieve array: 3 megabytes	*/
 
main()
{
int i,j,k;
int loc;
struct rusage ru;
double tots,totu;

for (i=0; i<20000; i++)	 {		/* for 20,000 different strides	*/
   j = 10*i + 1;		/* compute length of this stride	*/
   loc = 3;			/* starting location in the array	*/
   while (loc < 3000000)	/* starting at 'loc', add 1 to every	*/
	{			/* j'th location in the array		*/
	sieve[loc] += 1;
	loc += j;
	}
   }
   getrusage(RUSAGE_SELF,&ru);
   totu = ru.ru_utime.tv_sec + ((double) ru.ru_utime.tv_usec / 1000000.);
   tots = ru.ru_stime.tv_sec + ((double) ru.ru_stime.tv_usec / 1000000.);
   printf("Total time (sys+user)       :\t%.2lf  (bobstones)\n", totu + tots);
   printf("Page faults (min/maj)       :\t%d/%d\n",ru.ru_minflt,ru.ru_majflt);
   printf("Blocks in input/output      :\t%d/%d\n",ru.ru_inblock,ru.ru_oublock);
   printf("Context switches (vol/invol):\t%d/%d\n",ru.ru_nvcsw,ru.ru_nivcsw);
}

--
Bob Silverman
#include <std.disclaimer>
Mitre Corporation, Bedford, MA 01730
"You can lead a horse's ass to knowledge, but you can't make him think"

mahmoud@karazm.math.uh.edu (Ahmed Mahmoud) (05/18/91)

In article <1991May17.181628.19207@linus.mitre.org> bs@gauss.mitre.org (Robert D. Silverman) writes:
>I would like to present the following (small) benchmark code for Unix
>systems. A co-worker has dubbed this 'bobstones'.
>
>This program very seriously tests memory and data cacheing effects. It is
>quite simple. 
>
>I would like to ask that people out there try this out and report the results
>back to this forum. It only takes a few seconds to run.
> 
I ran this benchmark on a NeXTstation 25mhz 68040 8 megs of ram. I had a few
things running at the time...( kermit,edit and a terminal emulator) here
are the results
localhost> cc -o bench bench.c
localhost> bench
Total time (sys+user)       :   11.98  (bobstones)
Page faults (min/maj)       :   0/0
Blocks in input/output      :   2459/0
Context switches (vol/invol):   2533/348
localhost> 

ahmed

mahmoud@karazm.math.uh.edu (Ahmed Mahmoud) (05/18/91)

In article <1991May18.155143.5741@menudo.uh.edu> mahmoud@karazm.math.uh.edu (Ahmed Mahmoud) writes:
>In article <1991May17.181628.19207@linus.mitre.org> bs@gauss.mitre.org (Robert D. Silverman) writes:
>>I would like to present the following (small) benchmark code for Unix
>>systems. A co-worker has dubbed this 'bobstones'.
>>
>>This program very seriously tests memory and data cacheing effects. It is
>>quite simple. 
>>
>>I would like to ask that people out there try this out and report the results
>>back to this forum. It only takes a few seconds to run.
>> 
>I ran this benchmark on a NeXTstation 25mhz 68040 8 megs of ram. I had a few
>things running at the time...( kermit,edit and a terminal emulator) here
>are the results
>localhost> cc -o bench bench.c
>localhost> bench
>Total time (sys+user)       :   11.98  (bobstones)
>Page faults (min/maj)       :   0/0
>Blocks in input/output      :   2459/0
>Context switches (vol/invol):   2533/348
>localhost> 
>
>ahmed
>


sorry for the above results here is a better compiling
localhost> cc -o bench -O bench.c
localhost> bench
Total time (sys+user)       :   4.95  (bobstones)
Page faults (min/maj)       :   0/0
Blocks in input/output      :   1/0
Context switches (vol/invol):   1/123
localhost> bench
Total time (sys+user)       :   4.86  (bobstones)
Page faults (min/maj)       :   0/0
Blocks in input/output      :   7/0
Context switches (vol/invol):   7/112
localhost> bench
Total time (sys+user)       :   4.84  (bobstones)
Page faults (min/maj)       :   0/0
Blocks in input/output      :   0/0
Context switches (vol/invol):   0/114
localhost> 
ahmed

wedeck@snoopy.informatik.uni-tuebingen.de (Joerg Wedeck) (05/21/91)

here is a result for sparcstation 2 with 32 MBytes of memory:

snoopy% cc -O4 test2.c
snoopy% a.out
Total time (sys+user)       :   3.93  (bobstones)
Page faults (min/maj)       :   39/0
Blocks in input/output      :   0/0
Context switches (vol/invol):   13/72
snoopy% a.out
Total time (sys+user)       :   3.83  (bobstones)
Page faults (min/maj)       :   40/0
Blocks in input/output      :   0/0
Context switches (vol/invol):   11/73
snoopy% a.out
Total time (sys+user)       :   3.81  (bobstones)
Page faults (min/maj)       :   40/0
Blocks in input/output      :   0/0
Context switches (vol/invol):   11/62

--------------------------------+-------------------------------------
Joerg Wedeck			| E-Mail: wedeck@peanuts.informatik\
Universitaet Tuebingen		|		.uni-tuebingen.de
Lehrstuhl fuer Techn. Informatik|
Sand 13				|
7400 Tuebingen			|
Germany				|
--------------------------------+-------------------------------------

dhinds@elaine18.Stanford.EDU (David Hinds) (05/21/91)

Results for an SGI Iris 4D/240 (4x25MHz MIPS R3000) with 16MB memory:

cb-iris:~> cc -O3 -o bench bench.c
cb-iris:~> bench
Total time (sys+user)       :	10.20  (bobstones)
Page faults (min/maj)       :	0/0
Blocks in input/output      :	0/0
Context switches (vol/invol):	0/0
cb-iris:~> bench
Total time (sys+user)       :	10.22  (bobstones)
Page faults (min/maj)       :	0/0
Blocks in input/output      :	0/0
Context switches (vol/invol):	0/0

 -David Hinds
  dhinds@cb-iris.stanford.edu

clc5q@hemlock.cs.Virginia.EDU (Clark L. Coleman) (05/22/91)

On a VAX 8600 running BSD 4.2 Unix, without optimization ("cc"):

Total time (sys+user)       :	21.71  (bobstones)
Page faults (min/maj)       :	0/2
Blocks in input/output      :	6/1
Context switches (vol/invol):	21/374

With optimization ("cc - O"):

Total time (sys+user)       :	20.42  (bobstones)
Page faults (min/maj)       :	0/2
Blocks in input/output      :	6/1
Context switches (vol/invol):	21/277

-----------------------------------------------------------------------------
"The use of COBOL cripples the mind; its teaching should, therefore, be 
regarded as a criminal offence." E.W.Dijkstra, 18th June 1975.
|||  clc5q@virginia.edu (Clark L. Coleman)

gottlieb@allan.ultra.nyu.edu (Allan Gottlieb) (05/23/91)

Here are the results for my decstation (MIPS R3000 25MHz).
Ultrix 4.1  cc -O -- 16MB memory

Total time (sys+user)       :	4.79  (bobstones)
Page faults (min/maj)       :	344/0
Blocks in input/output      :	0/0
Context switches (vol/invol):	26/32

dhinds@elaine18.Stanford.EDU (David Hinds) (05/23/91)

So, now that I've seen a lot of the "Bobstone" results, I have a comp.arch
question: why should my SGI Iris 4D-240 do so poorly?  This is a 4-processor
shared-memory 25MHz MIPS R3000 system.  My results were:

cb-iris> time bench
Total time (sys+user)       :   10.18  (bobstones)
Page faults (min/maj)       :   0/0
Blocks in input/output      :   0/0
Context switches (vol/invol):   0/0
9.900u 0.290s 0:10.20 99.9% 0+0k 0+0io 0pf+0w

This is on an unloaded system, 32 MB main memory, 64K instruction cache,
64K data cache.  I can't remember now if there is a secondary cache as
well.  When I use the "pixie" execution profiler, I find that only 1.7 sec
of user time are accounted for in the profile.  "pixie" says it assumes a
perfect memory model.  Does that mean that like 85% of the run time is
occupied by cache misses ?!?  This seems extraordinarily high.  How large
are the caches on the other MIPS systems tested - I've seen much faster
times posted here.

 -David Hinds
  dhinds@cb-iris.stanford.edu

wolfe@vw.ece.cmu.edu (Andrew Wolfe) (06/06/91)

For my Decstation 3100 - 24Mb RAM (16MHz R2000)

Total time (sys+user)       :	7.43  (bobstones)
Page faults (min/maj)       :	29/0
Blocks in input/output      :	0/0
Context switches (vol/invol):	0/133



(Note that the number of page faults goes down each time I run it)