diff options
Diffstat (limited to 'cleanbench.c')
-rw-r--r-- | cleanbench.c | 131 |
1 files changed, 101 insertions, 30 deletions
diff --git a/cleanbench.c b/cleanbench.c index bb73b6a..f50b10a 100644 --- a/cleanbench.c +++ b/cleanbench.c @@ -47,7 +47,7 @@ #include <ctype.h> #include <string.h> #include <math.h> -#include "nmglobal.h" + #include "cleanbench.h" #include "hardware.h" @@ -55,6 +55,90 @@ static int bench_with_confidence(int fid, double *mean, double *stdev, unsigned 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 **** *************/ @@ -84,7 +168,7 @@ puts("\nTEST : Iterations/sec. : Old Index : New Index"); puts(" : : Pentium 90* : AMD K6/233*"); puts("--------------------:------------------:-------------:------------"); -for(i=LINEAR;i<NUMTESTS;i++) +for(i=NUMSORT;i<NUMTESTS;i++) { if(tests_to_do[i]) { printf("%s :",ftestnames[i]); @@ -277,32 +361,19 @@ return(0); ************** ** Return the score for a particular benchmark. */ -static double getscore(int fid) { - /* - ** Fid tells us the function. This is really a matter of - ** doing the proper coercion. - */ - switch(fid) { - case NUMSORT: - return(global_numsortstruct.results); - case STRINGSORT: - return(global_strsortstruct.results); - case BITFIELD: - return(global_bitopstruct.results); - case FPEMULATION: - return(global_emfloatstruct.results); - case FOURIER: - return(global_fourierstruct.results); - case ASSIGNMENT: - return(global_assignstruct.results); - case IDEA: - return(global_ideastruct.results); - case HUFFMAN: - return(global_huffstruct.results); - case NEURAL: - return(global_nnetstruct.results); - case LINEAR: - return(global_lustruct.results); - } - return 0.0; +static double getscore(int benchmark) { + double (*getScore[])(void) = { + getNumSortScore, + getStringSortScore, + getBitfieldScore, + getEmFloatScore, + getFourierScore, + getAssignmentScore, + getIDEAScore, + getHuffmanScore, + getNNETScore, + getLinearScore + }; + + return (*getScore[benchmark])(); } |