diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | assignment.c | 13 | ||||
-rw-r--r-- | bitfield.c | 13 | ||||
-rw-r--r-- | cleanbench.c | 131 | ||||
-rw-r--r-- | cleanbench.h | 175 | ||||
-rw-r--r-- | emfloat.c | 3 | ||||
-rw-r--r-- | fourier.c | 13 | ||||
-rw-r--r-- | fpemulation.c | 15 | ||||
-rw-r--r-- | huffman.c | 13 | ||||
-rw-r--r-- | idea.c | 13 | ||||
-rw-r--r-- | linear.c | 13 | ||||
-rw-r--r-- | neural.c | 82 | ||||
-rw-r--r-- | nmglobal.h | 86 | ||||
-rw-r--r-- | numsort.c | 13 | ||||
-rw-r--r-- | stringsort.c | 13 |
15 files changed, 230 insertions, 370 deletions
@@ -25,10 +25,10 @@ sysinfo.c: Makefile hardware.o: hardware.c hardware.h Makefile $(GCC) $(GCCFLAGS) -c hardware.c -cleanbench.o: cleanbench.h cleanbench.c nmglobal.h hardware.h Makefile sysinfo.c sysinfoc.c +cleanbench.o: cleanbench.h cleanbench.c hardware.h Makefile sysinfo.c sysinfoc.c $(GCC) $(GCCFLAGS) -c cleanbench.c -emfloat.o: emfloat.h emfloat.c nmglobal.h Makefile +emfloat.o: emfloat.h emfloat.c Makefile $(GCC) $(GCCFLAGS) -c emfloat.c randnum.o: randnum.c Makefile diff --git a/assignment.c b/assignment.c index 78be3fa..2fe8b8d 100644 --- a/assignment.c +++ b/assignment.c @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -48,6 +48,8 @@ static int first_assignments(long tableau[][ASSIGNCOLS], static void second_assignments(long tableau[][ASSIGNCOLS], short assignedtableau[][ASSIGNCOLS]); +static double results; + /************* ** DoAssign ** ************** @@ -70,7 +72,6 @@ void DoAssign(void) { const char* context = "CPU:Assignment"; - AssignStruct* locassignstruct = &global_assignstruct; /* Local structure ptr */ long* array = NULL; clock_t total_time = 0; int iterations = 0; @@ -119,7 +120,7 @@ DoAssign(void) free(array); - locassignstruct->results = (double)(iterations * CLOCKS_PER_SEC *num_arrays) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC *num_arrays) / (double)total_time; } @@ -521,3 +522,9 @@ for(i=0;i<ASSIGNROWS;i++) return; } + +inline double +getAssignmentScore(void) +{ + return results; +} @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -32,6 +32,8 @@ static void FlipBitRun(unsigned long *bitmap, unsigned long bit_addr, unsigned long nbits); +static double results; + /************* ** DoBitops ** ************** @@ -42,7 +44,6 @@ void DoBitops(void) { const char* context = "CPU:Bitfields"; - BitOpStruct* locbitopstruct = &global_bitopstruct; unsigned long* bitarray = NULL; unsigned long* bitoparray = NULL; clock_t total_time = 0; @@ -116,7 +117,7 @@ DoBitops(void) free(bitarray); free(bitoparray); - locbitopstruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /************************ @@ -253,3 +254,9 @@ void ToggleBitRun(unsigned long *bitmap, /* Bitmap */ } } } + +inline double +getBitfieldScore(void) +{ + return results; +} 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])(); } diff --git a/cleanbench.h b/cleanbench.h index 189242e..ef36aaf 100644 --- a/cleanbench.h +++ b/cleanbench.h @@ -1,148 +1,27 @@ -/* -** cleanbench.h -** Header for cleanbench.c -** BYTEmark (tm) -** BYTE's Native Mode Benchmarks -** Rick Grehan, BYTE Magazine -** -** Creation: -** Revision: 3/95;10/95 -** 10/95 - Added memory array & alignment -- 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. -*/ - -/* -** Following should be modified accordingly per each -** compilation. -*/ -char *sysname="You can enter your system description in cleanbench.h"; -char *compilername="It then will be printed here after you recompile"; -char *compilerversion="Have a nice day"; - -/* 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 */ - -/* -** Following are global structures, one built for -** each of the tests. -*/ -SortStruct global_numsortstruct; /* For numeric sort */ -SortStruct global_strsortstruct; /* For string sort */ -BitOpStruct global_bitopstruct; /* For bitfield operations */ -EmFloatStruct global_emfloatstruct; /* For emul. float. point */ -FourierStruct global_fourierstruct; /* For fourier test */ -AssignStruct global_assignstruct; /* For assignment algorithm */ -IDEAStruct global_ideastruct; /* For IDEA encryption */ -HuffStruct global_huffstruct; /* For Huffman compression */ -NNetStruct global_nnetstruct; /* For Neural Net */ -LUStruct global_lustruct; /* For LU decomposition */ - -/* -** EXTERNAL PROTOTYPES -*/ -extern void DoNumSort(void); -extern void DoStringSort(void); -extern void DoBitops(void); -extern void DoEmFloat(void); -extern void DoFourier(void); -extern void DoAssign(void); -extern void DoIDEA(void); -extern void DoHuffman(void); -extern void DoNNET(void); -extern void DoLU(void); - -/* -** Array of pointers to the benchmark functions. -*/ -void (*funcpointer[])(void) = -{ DoNumSort, - DoStringSort, - DoBitops, - DoEmFloat, - DoFourier, - DoAssign, - DoIDEA, - DoHuffman, - DoNNET, - DoLU }; +#define TRUE 1 +#define FALSE 0 + +#define MINIMUM_TICKS 60 +#define MINIMUM_SECONDS 5 /* Minimum number of seconds to run each test */ + +void DoNumSort(void); +void DoStringSort(void); +void DoBitops(void); +void DoEmFloat(void); +void DoFourier(void); +void DoAssign(void); +void DoIDEA(void); +void DoHuffman(void); +void DoNNET(void); +void DoLU(void); + +double getNumSortScore(void); +double getStringSortScore(void); +double getBitfieldScore(void); +double getEmFloatScore(void); +double getFourierScore(void); +double getAssignmentScore(void); +double getIDEAScore(void); +double getHuffmanScore(void); +double getNNETScore(void); +double getLinearScore(void); @@ -26,7 +26,8 @@ #include <stdio.h> #include <string.h> -#include "nmglobal.h" + +#include "cleanbench.h" #include "randnum.h" #include "emfloat.h" @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -26,6 +26,8 @@ static double thefunction(double x, double omega_n, int select); +static double results; + /************** ** DoFourier ** *************** @@ -38,7 +40,6 @@ void DoFourier(void) { const char* context = "FPU:Transcendental"; - FourierStruct* locfourierstruct = &global_fourierstruct; double* abase = NULL; double* bbase = NULL; clock_t total_time = 0; @@ -105,7 +106,7 @@ DoFourier(void) free(abase); free(bbase); - locfourierstruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /************************ @@ -239,3 +240,9 @@ switch(select) */ return(0.0); } + +inline double +getFourierScore(void) +{ + return results; +} diff --git a/fpemulation.c b/fpemulation.c index b0c5459..3536d77 100644 --- a/fpemulation.c +++ b/fpemulation.c @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" #include "emfloat.h" @@ -24,12 +24,14 @@ */ #define LOOP_MAX 500000L -#define ARRAY_SIZE 3000L +#define ARRAY_SIZE 3000 static clock_t DoEmFloatIteration(InternalFPF *abase, InternalFPF *bbase, InternalFPF *cbase, unsigned long loops); static void SetupCPUEmFloatArrays(InternalFPF *abase, InternalFPF *bbase); +static double results; + /************** ** DoEmFloat ** *************** @@ -40,7 +42,6 @@ void DoEmFloat(void) { const char* context = "CPU:Floating Emulation"; - EmFloatStruct* locemfloatstruct = &global_emfloatstruct; InternalFPF* abase = NULL; InternalFPF* bbase = NULL; InternalFPF* cbase = NULL; @@ -117,7 +118,7 @@ DoEmFloat(void) free(bbase); free(cbase); - locemfloatstruct->results = (double)(iterations * loops * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * loops * CLOCKS_PER_SEC) / (double)total_time; } /*********************** @@ -205,3 +206,9 @@ SetupCPUEmFloatArrays(InternalFPF *abase, InternalFPF *bbase) DivideInternalFPF(&locFPF1,&locFPF2,bbase+i); } } + +inline double +getEmFloatScore(void) +{ + return results; +} @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -51,6 +51,8 @@ static clock_t DoHuffIteration(char *plaintext, char *comparray, char *decomparr static void SetCompBit(uint8_t *comparray, uint32_t bitoffset, char bitchar); static int GetCompBit(uint8_t *comparray, uint32_t bitoffset); +static double results; + /************** ** DoHuffman ** *************** @@ -64,7 +66,6 @@ void DoHuffman(void) { const char* context = "CPU:Huffman"; - HuffStruct* lochuffstruct = &global_huffstruct; char* comparray = NULL; char* decomparray = NULL; char* plaintext = NULL; @@ -155,7 +156,7 @@ DoHuffman(void) free(decomparray); free(hufftree); - lochuffstruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /********************* @@ -499,3 +500,9 @@ bitnumb=bitoffset % 8; */ return((1<<bitnumb) & comparray[byteoffset] ); } + +inline double +getHuffmanScore(void) +{ + return results; +} @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -52,6 +52,8 @@ static void en_key_idea(uint16_t userkey[8], IDEAkey Z); static void de_key_idea(IDEAkey Z, IDEAkey DK); static void cipher_idea(uint16_t in[4], uint16_t out[4], IDEAkey Z); +static double results; + /*********** ** DoIDEA ** ************ @@ -62,7 +64,6 @@ void DoIDEA(void) { const char* context = "CPU:IDEA"; - IDEAStruct* locideastruct=&global_ideastruct; /* Loc pointer to global structure */ unsigned char* plain1 = NULL; /* First plaintext buffer */ unsigned char* crypt1 = NULL; /* Encryption buffer */ unsigned char* plain2 = NULL; /* Second plaintext buffer */ @@ -157,7 +158,7 @@ DoIDEA(void) free(crypt1); free(plain2); - locideastruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /******************** @@ -379,3 +380,9 @@ MUL(x4,*Z); *out=x4; return; } + +inline double +getIDEAScore(void) +{ + return results; +} @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -56,6 +56,8 @@ static void lubksb(double a[][LUARRAYCOLS], static int lusolve(double a[][LUARRAYCOLS], int n, double b[LUARRAYROWS]); +static double results; + /********* ** DoLU ** ********** @@ -65,7 +67,6 @@ void DoLU(void) { const char* context = "FPU:LU"; - LUStruct* loclustruct = &global_lustruct; clock_t total_time = 0; int iterations = 0; double* a = NULL; @@ -182,7 +183,7 @@ DoLU(void) free(bbase); free(LUtempvv); - loclustruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /****************** @@ -540,3 +541,9 @@ printf("\n"); return(1); } + +inline double +getLinearScore(void) +{ + return results; +} @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -104,7 +104,8 @@ static int check_out_error(); static void zero_changes(); static void randomize_wts(); static int read_data_file(); -/* static int initialize_net(); */ + +static double results; /*********** ** DoNNet ** @@ -119,7 +120,6 @@ void DoNNET(void) { /* const char* context="CPU:NNET"; */ /* Since we never fprintf errors here, we don't need this */ - NNetStruct* locnnetstruct = &global_nnetstruct; clock_t total_time = 0; int iterations = 0; static int is_adjusted = FALSE; @@ -168,7 +168,7 @@ DoNNET(void) iterations += loops; } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); - locnnetstruct->results = (double)(iterations * CLOCKS_PER_SEC) / total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / total_time; } /******************** @@ -778,80 +778,12 @@ for (patt=0; patt<numpats; patt++) out_pats[patt][element] = (double) val8; element++; } -/* printf("\n Closing the input file now. "); */ - fclose(infile); return(0); } -/********************* -** initialize_net() ** -********************** -** Do all the initialization stuff before beginning -*/ -/* -static int initialize_net() -{ -int err_code; - -randomize_wts(); -zero_changes(); -err_code = read_data_file(); -iteration_count = 1; -return(err_code); -} -*/ - -/********************** -** display_mid_wts() ** -*********************** -** Display the weights on the middle layer neurodes -** NOTE: This routine is not used in the benchmark -** test -- RG -**/ -/* static void display_mid_wts() -{ -int neurode, weight, row, col; - -fprintf(outfile,"\n Weights of Middle Layer neurodes:"); - -for (neurode=0; neurode<MID_SIZE; neurode++) -{ - fprintf(outfile,"\n Mid Neurode # %d",neurode); - for (row=0; row<IN_Y_SIZE; row++) - { - fprintf(outfile,"\n "); - for (col=0; col<IN_X_SIZE; col++) - { - weight = IN_X_SIZE * row + col; - fprintf(outfile," %8.3f ", mid_wts[neurode][weight]); - } - } -} -return; -} -*/ -/********************** -** display_out_wts() ** -*********************** -** Display the weights on the output layer neurodes -** NOTE: This code is not used in the benchmark -** test -- RG -*/ -/* void display_out_wts() +inline double +getNNETScore(void) { -int neurode, weight; - - fprintf(outfile,"\n Weights of Output Layer neurodes:"); - - for (neurode=0; neurode<OUT_SIZE; neurode++) - { - fprintf(outfile,"\n Out Neurode # %d \n",neurode); - for (weight=0; weight<MID_SIZE; weight++) - { - fprintf(outfile," %8.3f ", out_wts[neurode][weight]); - } - } - return; + return results; } -*/ diff --git a/nmglobal.h b/nmglobal.h deleted file mode 100644 index bc5b36e..0000000 --- a/nmglobal.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -** nmglobal.h -** Global definitions for native mode benchmarks. -** -** BYTEmark (tm) -** BYTE's Native Mode Benchmarks -** Rick Grehan, BYTE Magazine -** -** Creation: -** Revision: 3/95;10/95 -** 10/95 - Added memory array & alignment -- 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. -*/ - -/* -** SYSTEM DEFINES -*/ -#include <stdint.h> -#define TRUE 1 -#define FALSE 0 - -#define MINIMUM_TICKS 60 -#define MINIMUM_SECONDS 5 /* Minimum number of seconds to run each test */ - -typedef struct { - double results; /* # of sort iterations per sec */ -} SortStruct; - -typedef struct { - double results; /* # of bitfield ops per sec */ -} BitOpStruct; - -/* -** TYPEDEFS -*/ -typedef struct { - double results; /* Results */ -} EmFloatStruct; - -typedef struct { - double results; /* Results */ -} FourierStruct; - -typedef struct { - double results; /* Results */ -} AssignStruct; - -typedef struct { - double results; /* Results */ -} IDEAStruct; - -typedef struct { - double results; /* Results */ -} HuffStruct; - -typedef struct { - double results; /* Results */ -} NNetStruct; - -typedef struct { - double results; /* Results */ -} LUStruct; - -extern SortStruct global_numsortstruct; -extern SortStruct global_strsortstruct; -extern BitOpStruct global_bitopstruct; -extern EmFloatStruct global_emfloatstruct; -extern FourierStruct global_fourierstruct; -extern AssignStruct global_assignstruct; -extern IDEAStruct global_ideastruct; -extern HuffStruct global_huffstruct; -extern NNetStruct global_nnetstruct; -extern LUStruct global_lustruct; @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -28,6 +28,8 @@ static void LoadNumArrayWithRand(long *array, unsigned int num_arrays); static inline void NumHeapSort(long *array, unsigned long bottom, unsigned long top); static inline void NumSift(long *array, unsigned long min, unsigned long max); +static double results; + /************** ** DoNumSort ** *************** @@ -38,7 +40,6 @@ void DoNumSort (void) { const char* context = "CPU:Numeric Sort"; - SortStruct* numsortstruct = &global_numsortstruct; long* array = NULL; clock_t total_time = 0; int iterations = 0; @@ -93,7 +94,7 @@ DoNumSort (void) free(array); - numsortstruct->results = (double)(iterations * num_arrays * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * num_arrays * CLOCKS_PER_SEC) / (double)total_time; } /*********************** @@ -219,3 +220,9 @@ NumSift(long *array, unsigned long min, unsigned long max) } } } + +inline double +getNumSortScore(void) +{ + return results; +} diff --git a/stringsort.c b/stringsort.c index 71e6045..b1659b3 100644 --- a/stringsort.c +++ b/stringsort.c @@ -6,7 +6,7 @@ #include <limits.h> #include <time.h> -#include "nmglobal.h" +#include "cleanbench.h" #include "randnum.h" @@ -47,13 +47,14 @@ static void strsift(unsigned long *optrarray, unsigned long i, unsigned long j); +static double results; + /***************** ** DoStringSort ** *****************/ void DoStringSort(void) { const char* context = "CPU:String Sort"; - SortStruct* strsortstruct = &global_strsortstruct; unsigned char* array = NULL; clock_t total_time = 0; int iterations = 0; @@ -108,7 +109,7 @@ void DoStringSort(void) free(array); - strsortstruct->results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; + results = (double)(iterations * CLOCKS_PER_SEC) / (double)total_time; } /************************** @@ -507,3 +508,9 @@ while((i+i)<=j) i=j+1; } } + +inline double +getStringSortScore(void) +{ + return results; +} |