Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!husc6!yale!decvax!bellcore!whuxcc!lcuxlm!whuxl!whuxp!picuxa!perry From: perry@picuxa.UUCP (Perry S. Kivolowitz) Newsgroups: net.micro.amiga Subject: Memory Speed Test Program Message-ID: <134@picuxa.UUCP> Date: Wed, 23-Jul-86 11:29:32 EDT Article-I.D.: picuxa.134 Posted: Wed Jul 23 11:29:32 1986 Date-Received: Thu, 24-Jul-86 08:19:52 EDT Distribution: net Organization: AT&T Information Systems, Parsippany N.J. Lines: 148 The following program will measure raw memory speed. The program is to be compiled under Manx C and run from the CLI with no other programs running. This will compare your internal memory (when it isn't being used to refresh a HIRES or 5 bit plane image) to the external memory. I will post results for the Alegra memory board soon. Perry S. Kivolowitz ----------------------------------------------------------------------- #include #include #include /* ** ram-speed ** ** Times memory performance. To be compiled under MANX. ** ** Author: Perry S. Kivolowitz ** */ extern char *AllocMem(); extern struct IntuitionBase *OpenLibrary(); struct IntuitionBase *IntuitionBase; char *source , *destination; long EndingSeconds , EndingMicroSeconds; long StartingSeconds , StartingMicroSeconds; #define BSIZE (1L << 17) /* ** FreeAll ** ** Return any allocated memory back to the system for reuse. ** */ FreeAll() { if (source) FreeMem(source , BSIZE); if (destination) FreeMem(destination , BSIZE); } /* ** AllocAll ** ** Given a type of memory specified by ``bits'' allocate BSIZE ** bytes for a source area and a destination area. ** */ AllocAll(bits) long bits; { destination = AllocMem(BSIZE , bits); source = AllocMem(BSIZE , bits); if (!source || !destination) { printf("Allocation of Memory Failed\n"); Leave(); } } /* ** Leave ** ** Clean up routine. Release memory and close Intuition. ** */ Leave() { FreeAll(); CloseLibrary(IntuitionBase); exit(0); } OpenIntuition() { IntuitionBase = OpenLibrary("intuition.library" , 0L); if (!IntuitionBase) { printf("Could Not Open Intuition\n"); exit(0); } } long PrintTime() { long temp1 , temp2; temp2 = 1000000 * EndingSeconds + EndingMicroSeconds; temp1 = 1000000 * StartingSeconds + StartingMicroSeconds; temp2 = temp2 - temp1; printf("Elapsed Time (microseconds): %ld\n" , temp2); return(temp2); } long TimeRam(bits) long bits; { AllocAll(bits); CurrentTime(&StartingSeconds , &StartingMicroSeconds); CopyRam(); CurrentTime(&EndingSeconds , &EndingMicroSeconds); FreeAll(); return(PrintTime()); } main() { int i; long fast , chip; OpenIntuition(); printf("Timing CHIP Memory\n"); chip = TimeRam(MEMF_CHIP); printf("Timing FAST Memory\n"); fast = TimeRam(MEMF_FAST); printf("Difference (microseconds): %ld\n" , fast - chip); Leave(); } CopyRam() { register long *src , *dst; register short i , j; for (j = 0; j < 256; j++) { src = (long *) source; dst = (long *) destination; i = BSIZE / 32; while (--i) { #asm move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ move.l (a2)+,(a3)+ #endasm } } }