diff options
author | Matt Turner <mattst88@gmail.com> | 2008-11-14 22:05:13 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2008-11-14 22:05:13 +0000 |
commit | 8ea0b224c71e3ebb18b8aa61102c3da79bc668a0 (patch) | |
tree | 813c913fc87aacc08fd6c5d6c42767707633711e | |
parent | 0c8398d4b960967e65418885708a096eb489a8e8 (diff) |
-- Remove useless request_secs from structs
-- Replace useless global variables global_min_ticks and global_seconds with MINIMUM_TICKS and MINIMUM_SECONDS respectively
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@41 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r-- | assignment.c | 4 | ||||
-rw-r--r-- | bitfield.c | 4 | ||||
-rw-r--r-- | cleanbench.c | 30 | ||||
-rw-r--r-- | cleanbench.h | 8 | ||||
-rw-r--r-- | fourier.c | 4 | ||||
-rw-r--r-- | fpemulation.c | 4 | ||||
-rw-r--r-- | huffman.c | 4 | ||||
-rw-r--r-- | idea.c | 4 | ||||
-rw-r--r-- | linear.c | 4 | ||||
-rw-r--r-- | neural.c | 4 | ||||
-rw-r--r-- | nmglobal.h | 9 | ||||
-rw-r--r-- | numsort.c | 4 | ||||
-rw-r--r-- | stringsort.c | 4 |
13 files changed, 20 insertions, 67 deletions
diff --git a/assignment.c b/assignment.c index 2f0956c..745bbb5 100644 --- a/assignment.c +++ b/assignment.c @@ -100,7 +100,7 @@ DoAssign(void) ** minimum, then allocate for more arrays and ** try again. */ - if (DoAssignIteration(arraybase, locassignstruct->numarrays) > global_min_ticks) { + if (DoAssignIteration(arraybase, locassignstruct->numarrays) > MINIMUM_TICKS) { break; } @@ -117,7 +117,7 @@ DoAssign(void) do { total_time += DoAssignIteration(arraybase, locassignstruct->numarrays); ++iterations; - } while (total_time < locassignstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(arraybase); @@ -74,7 +74,7 @@ DoBitops(void) ** minimum, then de-allocate the array, reallocate a ** larger version, and try again. */ - if(DoBitfieldIteration(bitarraybase, bitoparraybase, locbitopstruct->bitoparraysize, &nbitops) > global_min_ticks) { + if(DoBitfieldIteration(bitarraybase, bitoparraybase, locbitopstruct->bitoparraysize, &nbitops) > MINIMUM_TICKS) { break; } @@ -106,7 +106,7 @@ DoBitops(void) do { total_time += DoBitfieldIteration(bitarraybase, bitoparraybase, locbitopstruct->bitoparraysize,&nbitops); iterations += nbitops; - } while (total_time < locbitopstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); /* ** Clean up, calculate results, and go home. diff --git a/cleanbench.c b/cleanbench.c index b4f8ef2..2d8ed12 100644 --- a/cleanbench.c +++ b/cleanbench.c @@ -66,12 +66,6 @@ unsigned long bnumrun; /* # of runs */ int i; /* Index */ /* -** Set global parameters to default. -*/ -global_min_ticks=MINIMUM_TICKS; -global_min_seconds=MINIMUM_SECONDS; - -/* ** We presume all tests will be run unless told ** otherwise */ @@ -83,7 +77,6 @@ for (i = 0; i < NUMTESTS; i++) { ** Initialize test data structures to default ** values. */ -set_request_secs(); /* Set all request_secs fields */ global_numsortstruct.adjust=0; global_numsortstruct.arraysize=NUMARRAYSIZE; @@ -174,29 +167,6 @@ puts("* Trademarks are property of their respective holder."); return 0; } -/********************* -** set_request_secs ** -********************** -** Set everyone's "request_secs" entry to whatever -** value is in global_min_secs. This is done -** at the beginning, and possibly later if the -** user redefines global_min_secs in the command file. -*/ -static void set_request_secs(void) -{ -global_numsortstruct.request_secs=global_min_seconds; -global_strsortstruct.request_secs=global_min_seconds; -global_bitopstruct.request_secs=global_min_seconds; -global_emfloatstruct.request_secs=global_min_seconds; -global_fourierstruct.request_secs=global_min_seconds; -global_assignstruct.request_secs=global_min_seconds; -global_ideastruct.request_secs=global_min_seconds; -global_huffstruct.request_secs=global_min_seconds; -global_nnetstruct.request_secs=global_min_seconds; -global_lustruct.request_secs=global_min_seconds; -} - - /************************** ** bench_with_confidence ** *************************** diff --git a/cleanbench.h b/cleanbench.h index 842b0da..040e733 100644 --- a/cleanbench.h +++ b/cleanbench.h @@ -207,13 +207,6 @@ char *paramnames[]= { char buffer[BUF_SIZ]; /* -** Global parameters. -*/ -unsigned long global_min_ticks; /* Minimum ticks */ -unsigned long global_min_seconds; /* Minimum seconds tests run */ -char global_ofile_name[BUF_SIZ];/* Output file name */ - -/* ** Following are global structures, one built for ** each of the tests. */ @@ -249,7 +242,6 @@ void *global_fstruct[] = /* ** PROTOTYPES */ -static void set_request_secs(void); static int bench_with_confidence(int fid, double *mean, double *stdev, unsigned long *numtries); static int calc_confidence(double scores[], @@ -71,7 +71,7 @@ DoFourier(void) ** larger arrays and try again. */ - if (DoFPUTransIteration(abase,bbase, locfourierstruct->arraysize) > global_min_ticks) { + if (DoFPUTransIteration(abase,bbase, locfourierstruct->arraysize) > MINIMUM_TICKS) { break; } @@ -102,7 +102,7 @@ DoFourier(void) do { total_time += DoFPUTransIteration(abase,bbase,locfourierstruct->arraysize); iterations += locfourierstruct->arraysize * 2 - 1; - } while (total_time < locfourierstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(abase); free(bbase); diff --git a/fpemulation.c b/fpemulation.c index 755dc32..2fca455 100644 --- a/fpemulation.c +++ b/fpemulation.c @@ -73,7 +73,7 @@ DoEmFloat(void) ** again. */ for (; loops < CPUEMFLOATLOOPMAX; loops += loops) { - if (DoEmFloatIteration(abase, bbase, cbase, locemfloatstruct->arraysize, loops) > global_min_ticks) { + if (DoEmFloatIteration(abase, bbase, cbase, locemfloatstruct->arraysize, loops) > MINIMUM_TICKS) { locemfloatstruct->loops = loops; break; } @@ -100,7 +100,7 @@ DoEmFloat(void) do { total_time += DoEmFloatIteration(abase, bbase, cbase, locemfloatstruct->arraysize, locemfloatstruct->loops); ++iterations; - } while (total_time < locemfloatstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(abase); free(bbase); @@ -135,7 +135,7 @@ DoHuffman(void) ** get a number of loops that we can use. */ for (lochuffstruct->loops = 100; lochuffstruct->loops < MAXHUFFLOOPS; lochuffstruct->loops += 10) { - if (DoHuffIteration(plaintext, comparray, decomparray, lochuffstruct->arraysize, lochuffstruct->loops, hufftree) > global_min_ticks) { + if (DoHuffIteration(plaintext, comparray, decomparray, lochuffstruct->arraysize, lochuffstruct->loops, hufftree) > MINIMUM_TICKS) { break; } } @@ -144,7 +144,7 @@ DoHuffman(void) do { total_time += DoHuffIteration(plaintext, comparray, decomparray, lochuffstruct->arraysize, lochuffstruct->loops, hufftree); iterations += lochuffstruct->loops; - } while (total_time < lochuffstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(plaintext); free(comparray); @@ -137,7 +137,7 @@ DoIDEA(void) ** get a number of loops that we can use. */ for (locideastruct->loops = 100; locideastruct->loops < MAXIDEALOOPS; locideastruct->loops += 10) { - if (DoIDEAIteration(plain1, crypt1, plain2, locideastruct->arraysize, locideastruct->loops, Z, DK) > global_min_ticks) { + if (DoIDEAIteration(plain1, crypt1, plain2, locideastruct->arraysize, locideastruct->loops, Z, DK) > MINIMUM_TICKS) { break; } } @@ -150,7 +150,7 @@ DoIDEA(void) do { total_time += DoIDEAIteration(plain1, crypt1, plain2, locideastruct->arraysize, locideastruct->loops, Z, DK); iterations += locideastruct->loops; - } while (total_time < locideastruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(plain1); free(crypt1); @@ -131,7 +131,7 @@ DoLU(void) free(LUtempvv); exit(1); } - if(DoLUIteration(a,b,abase,bbase,i)>global_min_ticks) + if(DoLUIteration(a,b,abase,bbase,i)>MINIMUM_TICKS) { loclustruct->numarrays=i; break; } @@ -176,7 +176,7 @@ DoLU(void) do { total_time += DoLUIteration(a, b, abase, bbase, loclustruct->numarrays); iterations += loclustruct->numarrays; - } while(total_time < loclustruct->request_secs * CLOCKS_PER_SEC); + } while(total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(a); free(b); @@ -153,7 +153,7 @@ DoNNET(void) */ for (locnnetstruct->loops = 1; locnnetstruct->loops < MAXNNETLOOPS; locnnetstruct->loops++) { randnum((int32_t)3); - if(DoNNetIteration(locnnetstruct->loops) > global_min_ticks) { + if(DoNNetIteration(locnnetstruct->loops) > MINIMUM_TICKS) { break; } } @@ -163,7 +163,7 @@ DoNNET(void) randnum((int32_t)3); /* Gotta do this for Neural Net */ total_time += DoNNetIteration(locnnetstruct->loops); iterations += locnnetstruct->loops; - } while (total_time < locnnetstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); locnnetstruct->results = (double)(iterations * CLOCKS_PER_SEC) / total_time; } @@ -102,7 +102,6 @@ */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* # of seconds requested */ double results; /* # of sort iterations per sec */ unsigned short numarrays; /* # of arrays */ unsigned long arraysize; /* # of elements in array */ @@ -150,7 +149,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* # of seconds requested */ double results; /* # of bitfield ops per sec */ unsigned long bitoparraysize; /* Total # of bitfield ops */ unsigned long bitfieldarraysize; /* Bit field array size */ @@ -184,7 +182,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* # of seconds requested */ unsigned long arraysize; /* Size of array */ unsigned long loops; /* Loops per iterations */ double results; /* Results */ @@ -199,7 +196,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* # of requested seconds */ unsigned long arraysize; /* Size of coeff. arrays */ double results; /* Results */ } FourierStruct; @@ -213,7 +209,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* Requested # of seconds */ unsigned long numarrays; /* # of arrays */ double results; /* Results */ } AssignStruct; @@ -243,7 +238,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* Requested # of seconds */ unsigned long arraysize; /* Size of array */ unsigned long loops; /* # of times to convert */ double results; /* Results */ @@ -281,7 +275,6 @@ typedef struct { typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* Requested # of seconds */ unsigned long arraysize; /* Size of array */ unsigned long loops; /* # of times to compress/decompress */ double results; /* Results */ @@ -307,7 +300,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* Requested # of seconds */ unsigned long loops; /* # of times to learn */ double results; /* Results */ } NNetStruct; @@ -333,7 +325,6 @@ typedef struct { */ typedef struct { int adjust; /* Set adjust code */ - unsigned long request_secs; /* Requested # of seconds */ unsigned long numarrays; /* # of arrays */ double results; /* Results */ } LUStruct; @@ -62,7 +62,7 @@ DoNumSort (void) ** minimum, then allocate for more arrays and ** try again. */ - if (DoNumSortIteration(arraybase, numsortstruct->arraysize, numsortstruct->numarrays) > global_min_ticks) { + if (DoNumSortIteration(arraybase, numsortstruct->arraysize, numsortstruct->numarrays) > MINIMUM_TICKS) { break; } @@ -87,7 +87,7 @@ DoNumSort (void) do { total_time += DoNumSortIteration(arraybase, numsortstruct->arraysize, numsortstruct->numarrays); ++iterations; - } while (total_time < numsortstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(arraybase); diff --git a/stringsort.c b/stringsort.c index f6d214b..57a18d5 100644 --- a/stringsort.c +++ b/stringsort.c @@ -77,7 +77,7 @@ void DoStringSort(void) ** minimum, then de-allocate the array, reallocate a ** an additional array, and try again. */ - if (DoStringSortIteration(arraybase, strsortstruct->numarrays, strsortstruct->arraysize) > global_min_ticks) { + if (DoStringSortIteration(arraybase, strsortstruct->numarrays, strsortstruct->arraysize) > MINIMUM_TICKS) { break; } @@ -98,7 +98,7 @@ void DoStringSort(void) do { total_time += DoStringSortIteration(arraybase, strsortstruct->numarrays, strsortstruct->arraysize); iterations += strsortstruct->numarrays; - } while (total_time < strsortstruct->request_secs * CLOCKS_PER_SEC); + } while (total_time < MINIMUM_SECONDS * CLOCKS_PER_SEC); free(arraybase); |