From: matth@extro.ucc.su.OZ.AU (Matthew Hannigan) Subject: memtest.c (was Re: Specmarks for Linux ?) Date: Wed, 1 Sep 1993 02:07:57 GMT
austin@eecom.gatech.edu (Mark D. Austin) writes:
>Greetings,
>Of course it depends on the machine, but has anyone heard of
>any benchmarks for Linux ? Someone was telling that with the
>right hardware, it is almost as fast as a Sun Sparc II. Is this
>right?
Try much fast than a sparc2, for some things at least.
I wrote a little program to test memory copies, which copies
a 4Mb chunk 64 times. It takes 54s on a mildly loaded sparc2
and about 10s on a very lightly loaded linux dx2/66.
i.e. a $4000 machine way outperforming a $25000 machine :-)
Of course, all benchmarks are lies and this program particularly
so.
Here's the source.
Invoke as:
time ./memtest 4194304 64
Please email me comments on this program if any.
It's from an idea of Piercarlo Grandi's;
I've reproduced some mail from him on this subject:
/*
Subject: Re: EISA/VLB Motherboards
To: matth@extro.ucc.su.OZ.AU (Matthew Hannigan)
Date: Wed, 4 Aug 1993 14:16:10 +0100 (WET DST)
From: pcg@aberystwyth.ac.uk (Piercarlo Grandi)
Now I'll have to track a mem test program down and also some standard
figures for my machine (dx2/66, 16Mb ram, 256k cache). Presumably
they're available for dos on the net somewhere, I might knock one up
myself for Linux.
Just a simple loop (define two 2-4MB arrays; memcpy between them 64 times)
will do. I get 256MB copied in 14 seconds with my 486DX@33, which is more
or less equivalent to a SUN SS-10 or a DEC 5000/200, in other words rather
satisfactory. I would surmise that you should get about the same; after all
clock doubling does not affect the speed of the memory subsystem. Tip:
enabling write back caching helps...
*/
#include <stdio.h>
main(argc, argv)
int argc;
char *argv[];
{
char *m1, *m2;
int sz, no, i;
if ( argc !=3 )
{
fprintf(stderr,
"Usage: %s : array-size no-of-memcpys\n",
argv[0]);
exit(1);
}
sz = atoi(argv[1]);
no = atoi(argv[2]);
if ((m1 = (char*)malloc(sz)) != 0 &&
(m2 = (char*)malloc(sz)) != 0)
{
for(i=0; i < no; i++)
{
1 && fprintf(stderr, "loop %d of %d\n", i, no);
memcpy(m1, m2, sz);
}
}
else
{
fprintf(stderr, "malloc failed\n");
return 1;
}
return 0;
}