/* ** cleanbench.c */ /******************************************* ** BYTEmark (tm) ** ** BYTE MAGAZINE'S NATIVE MODE BENCHMARKS ** ** FOR CPU/FPU ** ** ver 2.0 ** ** Rick Grehan, BYTE Magazine ** ******************************************** ** REVISION HISTORY FOR BENCHMARKS ** 9/94 -- First beta. --RG ** 12/94 -- Bug discovered in some of the integer routines ** (IDEA, Huffman,...). Routines were not accurately counting ** the number of loops. Fixed. --RG (Thanks to Steve A.) ** 12/94 -- Added routines to calculate and display index ** values. Indexes based on DELL XPS 90 (90 MHz Pentium). ** 1/95 -- Added Mac time manager routines for more accurate ** timing on Macintosh (said to be good to 20 usecs) -- RG ** 1/95 -- Re-did all the #defines so they made more ** sense. See NMGLOBAL.H -- RG ** 3/95 -- Fixed memory leak in LU decomposition. Did not ** invalidate previous results, just made it easier to run.--RG ** 3/95 -- Added TOOLHELP.DLL timing routine to Windows timer. --RG ** 10/95 -- Added memory array & alignment; moved memory ** allocation out of LU Decomposition -- RG ** ** DISCLAIMER ** The source, executable, and documentation files that comprise ** the BYTEmark benchmarks are made available on an "as is" basis. ** This means that we at BYTE Magazine have made every reasonable ** effort to verify that the there are no errors in the source and ** executable code. We cannot, however, guarantee that the programs ** are error-free. Consequently, McGraw-HIll and BYTE Magazine make ** no claims in regard to the fitness of the source code, executable ** code, and documentation of the BYTEmark. ** Furthermore, BYTE Magazine, McGraw-Hill, and all employees ** of McGraw-Hill cannot be held responsible for any damages resulting ** from the use of this code or the results obtained from using ** this code. */ #include #include #include #include #include #include "cleanbench.h" #include "hardware.h" static int bench_with_confidence(int fid, double *mean, double *stdev, unsigned long *numtries); static int calc_confidence(double scores[], int num_scores, double *c_half_interval,double *smean, double *sdev); static double getscore(int fid); /* Tests-to-do flags...must coincide with test. */ enum { NUMSORT, STRINGSORT, BITFIELD, FPEMULATION, FOURIER, ASSIGNMENT, IDEA, HUFFMAN, NEURAL, LINEAR } tests_t; #define NUMTESTS 10 /* ** Following array is a collection of flags indicating which ** tests to perform. */ int tests_to_do[NUMTESTS]; /* ** Test names */ char *ftestnames[] = { "NUMERIC SORT ", "STRING SORT ", "BITFIELD ", "FP EMULATION ", "FOURIER ", "ASSIGNMENT ", "IDEA ", "HUFFMAN ", "NEURAL NET ", "LU DECOMPOSITION" }; /* ** Indexes -- Baseline is DELL Pentium XP90 ** 11/28/94 */ double bindex[] = { 38.993, /* Numeric sort */ 2.238, /* String sort */ 5829704, /* Bitfield */ 2.084, /* FP Emulation */ 879.278, /* Fourier */ .2628, /* Assignment */ 65.382, /* IDEA */ 36.062, /* Huffman */ .6225, /* Neural Net */ 19.3031 }; /* LU Decomposition */ /* ** Indices -- Baseline is a AMD K6-233, 32MB RAM (60ns SDRAM),512k L2 cache, ** Linux kernel 2.0.32, libc-5.4.38, gcc-2.7.2.3) ** Nov/30/97 */ double lx_bindex[] = { 118.73, /* Numeric sort */ 14.459, /* String sort */ 27910000, /* Bitfield */ 9.0314, /* FP Emulation */ 1565.5, /* Fourier */ 1.0132, /* Assignment */ 220.21, /* IDEA */ 112.93, /* Huffman */ 1.4799, /* Neural Net */ 26.732}; /* LU Decomposition */ void (*funcpointer[])(void) = { DoNumSort, DoStringSort, DoBitops, DoEmFloat, DoFourier, DoAssign, DoIDEA, DoHuffman, DoNNET, DoLU }; /************* **** main **** *************/ int main(int argc, char *argv[]) { double bmean; /* Benchmark mean */ double bstdev; /* Benchmark stdev */ double lx_memindex = 1.0; /* Linux memory index (mainly integer operations)*/ double lx_intindex = 1.0; /* Linux integer index */ double lx_fpindex = 1.0; /* Linux floating-point index */ double intindex = 1.0; /* Integer index */ double fpindex = 1.0; /* Floating-point index */ unsigned long bnumrun; /* # of runs */ int i; /* Index */ /* ** We presume all tests will be run unless told ** otherwise */ for (i = 0; i < NUMTESTS; i++) { tests_to_do[i] = TRUE; } puts("BYTEmark* Native Mode Benchmark ver. 2 (10/95)"); puts("Index-split by Andrew D. Balsa (11/97)"); puts("Linux/Unix* port by Uwe F. Mayer (12/96,11/97)"); puts("\nTEST : Iterations/sec. : Old Index : New Index"); puts(" : : Pentium 90* : AMD K6/233*"); puts("--------------------:------------------:-------------:------------"); for(i=NUMSORT;i30)) { puts("Internal error: calc_confidence called with an illegal number of scores"); return(-1); } /* ** First calculate mean. */ *smean=(double)0.0; for(i=0;i