diff options
-rw-r--r-- | emfloat.c | 43 | ||||
-rw-r--r-- | fpemulation.c | 1 | ||||
-rw-r--r-- | hardware.c | 26 | ||||
-rw-r--r-- | nbench0.c | 503 | ||||
-rw-r--r-- | nbench0.h | 1 | ||||
-rw-r--r-- | sysinfo.c.example | 15 | ||||
-rw-r--r-- | sysinfo.c.template | 15 | ||||
-rw-r--r-- | sysinfoc.c.example | 6 | ||||
-rw-r--r-- | sysinfoc.c.template | 6 |
9 files changed, 120 insertions, 496 deletions
@@ -103,9 +103,6 @@ int number_of_loops; ** Begin timing */ elapsed=StartStopwatch(); -#ifdef DEBUG -number_of_loops=loops-1; /* the index of the first loop we run */ -#endif /* ** Each pass through the array performs operations in @@ -139,44 +136,8 @@ while(loops--) cbase+i); break; } -#ifdef DEBUG -{ - unsigned long j[8]; /* we test 8 entries */ - int k; - unsigned long i; - char buffer[1024]; - if (number_of_loops==loops) /* the first loop */ - { - j[0]=(unsigned long)2; - j[1]=(unsigned long)6; - j[2]=(unsigned long)10; - j[3]=(unsigned long)14; - j[4]=(unsigned long)(arraysize-14); - j[5]=(unsigned long)(arraysize-10); - j[6]=(unsigned long)(arraysize-6); - j[7]=(unsigned long)(arraysize-2); - for(k=0;k<8;k++){ - i=j[k]; - InternalFPFToString(buffer,abase+i); - printf("%6ld: (%s) ",i,buffer); - switch(jtable[i % 16]) - { - case 0: strcpy(buffer,"+"); break; - case 1: strcpy(buffer,"-"); break; - case 2: strcpy(buffer,"*"); break; - case 3: strcpy(buffer,"/"); break; - } - printf("%s ",buffer); - InternalFPFToString(buffer,bbase+i); - printf("(%s) = ",buffer); - InternalFPFToString(buffer,cbase+i); - printf("%s\n",buffer); - } - } -} -#endif -} -return(StopStopwatch(elapsed)); + } + return(StopStopwatch(elapsed)); } /*********************** diff --git a/fpemulation.c b/fpemulation.c index 7d631bf..b9b6235 100644 --- a/fpemulation.c +++ b/fpemulation.c @@ -30,7 +30,6 @@ void DoEmFloat(void) { unsigned long accumtime; /* Accumulated time in ticks */ double iterations; /* # of iterations */ unsigned long tickcount; /* # of ticks */ - int systemerror; /* For holding error code */ unsigned long loops; /* # of loops */ abase = malloc(locemfloatstruct->arraysize * sizeof(InternalFPF)); @@ -5,23 +5,6 @@ #define BUF_SIZ 1024 /****************** -** output_string ** -******************* -** Displays a string on the screen. Also, if the flag -** write_to_file is set, outputs the string to the output file. -** Note, this routine presumes that you've included a carriage -** return at the end of the buffer. -*/ -static void output_string(const char *buffer, const int write_to_file, - FILE *global_ofile){ - printf("%s",buffer); - if(write_to_file!=0) - fprintf(global_ofile,"%s",buffer); - return; -} - - -/****************** ** removeNewLine ** ******************* ** Removes a trailing newline character if present @@ -179,12 +162,9 @@ void hardware(const int write_to_file, FILE *global_ofile) { model[0] = '\0'; cache[0] = '\0'; } - sprintf(buffer, "CPU : %s\n", model); - output_string(buffer, write_to_file, global_ofile); - sprintf(buffer, "L2 Cache : %s\n", cache); - output_string(buffer, write_to_file, global_ofile); - sprintf(buffer, "OS : %s\n", os); - output_string(buffer, write_to_file, global_ofile); + printf("CPU : %s\n", model); + printf("L2 Cache : %s\n", cache); + printf("OS : %s\n", os); } @@ -58,12 +58,7 @@ /************* **** main **** *************/ -#ifdef MAC -void main(void) -#else -int main(int argc, char *argv[]) -#endif -{ +int main(int argc, char *argv[]) { int i; /* Index */ time_t time_and_date; /* Self-explanatory */ struct tm *loctime; @@ -74,37 +69,7 @@ double lx_intindex; /* Linux integer index */ double lx_fpindex; /* Linux floating-point index */ double intindex; /* Integer index */ double fpindex; /* Floating-point index */ -ulong bnumrun; /* # of runs */ - -#ifdef MAC - MaxApplZone(); -#endif - -#ifdef MACTIMEMGR -/* Set up high res timer */ -MacHSTdelay=600*1000*1000; /* Delay is 10 minutes */ - -memset((char *)&myTMTask,0,sizeof(TMTask)); - -/* Prime and remove the task, calculating overhead */ -PrimeTime((QElemPtr)&myTMTask,-MacHSTdelay); -RmvTime((QElemPtr)&myTMTask); -MacHSTohead=MacHSTdelay+myTMTask.tmCount; -#endif - -#ifdef WIN31TIMER -/* Set up the size of the timer info structure */ -win31tinfo.dwSize=(DWORD)sizeof(TIMERINFO); -/* Load library */ -if((hThlp=LoadLibrary("TOOLHELP.DLL"))<32) -{ printf("Error loading TOOLHELP\n"); - exit(0); -} -if(!(lpfn=GetProcAddress(hThlp,"TimerCount"))) -{ printf("TOOLHELP error\n"); - exit(0); -} -#endif +unsigned long bnumrun; /* # of runs */ /* ** Set global parameters to default. @@ -161,13 +126,6 @@ global_nnetstruct.adjust=0; global_lustruct.adjust=0; /* -** For Macintosh -- read the command line. -*/ -#ifdef MAC -UCommandLine(); -#endif - -/* ** Handle any command-line arguments. */ if(argc>1) @@ -179,85 +137,59 @@ if(argc>1) /* ** Output header */ -#ifdef LINUX -output_string("\nBYTEmark* Native Mode Benchmark ver. 2 (10/95)\n"); -output_string("Index-split by Andrew D. Balsa (11/97)\n"); -output_string("Linux/Unix* port by Uwe F. Mayer (12/96,11/97)\n"); -#else -output_string("BBBBBB YYY Y TTTTTTT EEEEEEE\n"); -output_string("BBB B YYY Y TTT EEE\n"); -output_string("BBB B YYY Y TTT EEE\n"); -output_string("BBBBBB YYY Y TTT EEEEEEE\n"); -output_string("BBB B YYY TTT EEE\n"); -output_string("BBB B YYY TTT EEE\n"); -output_string("BBBBBB YYY TTT EEEEEEE\n\n"); -output_string("\nBYTEmark (tm) Native Mode Benchmark ver. 2 (10/95)\n"); -#endif +puts("\nBYTEmark* 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)"); /* ** See if the user wants all stats. Output heading info ** if so. */ if(global_allstats) { - output_string("\n"); - output_string("============================== ALL STATISTICS ===============================\n"); + puts("\n============================== ALL STATISTICS ==============================="); time(&time_and_date); loctime=localtime(&time_and_date); - sprintf(buffer,"**Date and time of benchmark run: %s",asctime(loctime)); - output_string(buffer); - sprintf(buffer,"**Sizeof: char:%u short:%u int:%u long:%u uint8_t:%u uint16_t:%u uint32_t:%u int32:%u\n", - (unsigned int)sizeof(char), - (unsigned int)sizeof(short), - (unsigned int)sizeof(int), - (unsigned int)sizeof(long), - (unsigned int)sizeof(uint8_t), - (unsigned int)sizeof(uint16_t), - (unsigned int)sizeof(uint32_t), - (unsigned int)sizeof(int32_t)); - output_string(buffer); -#ifdef LINUX + printf("**Date and time of benchmark run: %s", asctime(loctime)); + printf("**Sizeof: char:%u short:%u int:%u long:%u uint8_t:%u uint16_t:%u uint32_t:%u int32:%u\n", + sizeof(char), + sizeof(short), + sizeof(int), + sizeof(long), + sizeof(uint8_t), + sizeof(uint16_t), + sizeof(uint32_t), + sizeof(int32_t)); +#ifdef LINUX /* FIXME: do this a better way */ #include "sysinfo.c" #else - sprintf(buffer,"**%s\n",sysname); - output_string(buffer); - sprintf(buffer,"**%s\n",compilername); - output_string(buffer); - sprintf(buffer,"**%s\n",compilerversion); - output_string(buffer); + printf("**%s\n",sysname); + printf("**%s\n",compilername); + printf("**%s\n",compilerversion); #endif - output_string("=============================================================================\n"); + puts("============================================================================="); } /* ** Execute the tests. */ -#ifdef LINUX -output_string("\nTEST : Iterations/sec. : Old Index : New Index\n"); -output_string(" : : Pentium 90* : AMD K6/233*\n"); -output_string("--------------------:------------------:-------------:------------\n"); -#endif +puts("\nTEST : Iterations/sec. : Old Index : New Index"); +puts(" : : Pentium 90* : AMD K6/233*"); +puts("--------------------:------------------:-------------:------------"); for(i=0;i<NUMTESTS;i++) { if(tests_to_do[i]) - { sprintf(buffer,"%s :",ftestnames[i]); - output_string(buffer); + { printf("%s :",ftestnames[i]); if (0!=bench_with_confidence(i, &bmean, &bstdev, &bnumrun)){ - output_string("\n** WARNING: The current test result is NOT 95 % statistically certain.\n"); - output_string("** WARNING: The variation among the individual results is too large.\n"); - output_string(" :"); + puts("\n** WARNING: The current test result is NOT 95 % statistically certain."); + puts("** WARNING: The variation among the individual results is too large."); + printf(" :"); } -#ifdef LINUX - sprintf(buffer," %15.5g : %9.2f : %9.2f\n", + printf(" %15.5g : %9.2f : %9.2f\n", bmean,bmean/bindex[i],bmean/lx_bindex[i]); -#else - sprintf(buffer," Iterations/sec.: %13.2f Index: %6.2f\n", - bmean,bmean/bindex[i]); -#endif - output_string(buffer); /* ** Gather integer or FP indexes */ @@ -280,19 +212,15 @@ for(i=0;i<NUMTESTS;i++) if(global_allstats) { - sprintf(buffer," Absolute standard deviation: %g\n",bstdev); - output_string(buffer); + printf(" Absolute standard deviation: %g\n",bstdev); if (bmean>(double)1e-100){ /* avoid division by zero */ - sprintf(buffer," Relative standard deviation: %g %%\n", + printf(" Relative standard deviation: %g %%\n", (double)100*bstdev/bmean); - output_string(buffer); } - sprintf(buffer," Number of runs: %lu\n",bnumrun); - output_string(buffer); + printf(" Number of runs: %lu\n",bnumrun); show_stats(i); - sprintf(buffer,"Done with %s\n\n",ftestnames[i]); - output_string(buffer); + printf("Done with %s\n\n",ftestnames[i]); } } } @@ -303,33 +231,27 @@ for(i=0;i<NUMTESTS;i++) */ if(global_custrun==0) { - output_string("==========================ORIGINAL BYTEMARK RESULTS==========================\n"); - sprintf(buffer,"INTEGER INDEX : %.3f\n", + puts("==========================ORIGINAL BYTEMARK RESULTS=========================="); + printf("INTEGER INDEX : %.3f\n", pow(intindex,(double).142857)); - output_string(buffer); - sprintf(buffer,"FLOATING-POINT INDEX: %.3f\n", + printf("FLOATING-POINT INDEX: %.3f\n", pow(fpindex,(double).33333)); - output_string(buffer); - output_string("Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0\n"); + puts("Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0"); #ifdef LINUX - output_string("==============================LINUX DATA BELOW===============================\n"); + puts("==============================LINUX DATA BELOW==============================="); hardware(write_to_file, global_ofile); #include "sysinfoc.c" - sprintf(buffer,"MEMORY INDEX : %.3f\n", + printf("MEMORY INDEX : %.3f\n", pow(lx_memindex,(double).3333333333)); - output_string(buffer); - sprintf(buffer,"INTEGER INDEX : %.3f\n", + printf("INTEGER INDEX : %.3f\n", pow(lx_intindex,(double).25)); - output_string(buffer); - sprintf(buffer,"FLOATING-POINT INDEX: %.3f\n", + printf("FLOATING-POINT INDEX: %.3f\n", pow(lx_fpindex,(double).3333333333)); - output_string(buffer); - output_string("Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38\n"); + puts("Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38"); #endif -output_string("* Trademarks are property of their respective holder.\n"); +puts("* Trademarks are property of their respective holder."); } - -exit(0); + return 0; } /************** @@ -457,11 +379,11 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) switch(i) { case PF_GMTICKS: /* GLOBALMINTICKS */ - global_min_ticks=(ulong)atol(eptr); + global_min_ticks=(unsigned long)atol(eptr); break; case PF_MINSECONDS: /* MINSECONDS */ - global_min_seconds=(ulong)atol(eptr); + global_min_seconds=(unsigned long)atol(eptr); set_request_secs(); break; @@ -501,12 +423,12 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_NUMASIZE: /* NUMARRAYSIZE */ global_numsortstruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_NUMMINS: /* NUMMINSECONDS */ global_numsortstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOSTR: /* DOSTRINGSORT */ @@ -515,7 +437,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_STRASIZE: /* STRARRAYSIZE */ global_strsortstruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_NUMSTRA: /* NUMSTRARRAYS */ @@ -526,7 +448,7 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_STRMINS: /* STRMINSECONDS */ global_strsortstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOBITF: /* DOBITFIELD */ @@ -535,18 +457,18 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_NUMBITOPS: /* NUMBITOPS */ global_bitopstruct.bitoparraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); global_bitopstruct.adjust=1; break; case PF_BITFSIZE: /* BITFIELDSIZE */ global_bitopstruct.bitfieldarraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_BITMINS: /* BITMINSECONDS */ global_bitopstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOEMF: /* DOEMF */ @@ -555,17 +477,17 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_EMFASIZE: /* EMFARRAYSIZE */ global_emfloatstruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_EMFLOOPS: /* EMFLOOPS */ global_emfloatstruct.loops= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_EMFMINS: /* EMFMINSECOND */ global_emfloatstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOFOUR: /* DOFOUR */ @@ -574,13 +496,13 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_FOURASIZE: /* FOURASIZE */ global_fourierstruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); global_fourierstruct.adjust=1; break; case PF_FOURMINS: /* FOURMINSECONDS */ global_fourierstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOASSIGN: /* DOASSIGN */ @@ -589,12 +511,12 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_AARRAYS: /* ASSIGNARRAYS */ global_assignstruct.numarrays= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_ASSIGNMINS: /* ASSIGNMINSECONDS */ global_assignstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOIDEA: /* DOIDEA */ @@ -603,17 +525,17 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_IDEAASIZE: /* IDEAARRAYSIZE */ global_ideastruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_IDEALOOPS: /* IDEALOOPS */ global_ideastruct.loops= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_IDEAMINS: /* IDEAMINSECONDS */ global_ideastruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOHUFF: /* DOHUFF */ @@ -622,18 +544,18 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_HUFFASIZE: /* HUFFARRAYSIZE */ global_huffstruct.arraysize= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_HUFFLOOPS: /* HUFFLOOPS */ global_huffstruct.loops= - (ulong)atol(eptr); + (unsigned long)atol(eptr); global_huffstruct.adjust=1; break; case PF_HUFFMINS: /* HUFFMINSECONDS */ global_huffstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DONNET: /* DONNET */ @@ -642,13 +564,13 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_NNETLOOPS: /* NNETLOOPS */ global_nnetstruct.loops= - (ulong)atol(eptr); + (unsigned long)atol(eptr); global_nnetstruct.adjust=1; break; case PF_NNETMINS: /* NNETMINSECONDS */ global_nnetstruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_DOLU: /* DOLU */ @@ -657,13 +579,13 @@ while(fgets(inbuf,39,cfile)!=(char *)NULL) case PF_LUNARRAYS: /* LUNUMARRAYS */ global_lustruct.numarrays= - (ulong)atol(eptr); + (unsigned long)atol(eptr); global_lustruct.adjust=1; break; case PF_LUMINS: /* LUMINSECONDS */ global_lustruct.request_secs= - (ulong)atol(eptr); + (unsigned long)atol(eptr); break; case PF_ALIGN: /* ALIGN */ @@ -757,7 +679,7 @@ return; static int bench_with_confidence(int fid, /* Function id */ double *mean, /* Mean of scores */ double *stdev, /* Standard deviation */ - ulong *numtries) /* # of attempts */ + unsigned long *numtries) /* # of attempts */ { double myscores[30]; /* Need at least 5 scores, use at most 30 */ double c_half_interval; /* Confidence half interval */ @@ -770,9 +692,6 @@ int i; /* Index */ for (i=0;i<5;i++) { (*funcpointer[fid])(); myscores[i]=getscore(fid); -#ifdef DEBUG - printf("score # %d = %g\n", i, myscores[i]); -#endif } *numtries=5; /* Show 5 attempts */ @@ -802,95 +721,17 @@ while(1) if(c_half_interval/ (*mean) <= (double)0.05) break; -#ifdef OLDCODE -#undef OLDCODE -#endif -#ifdef OLDCODE -/* this code is no longer valid, we now do not replace but add new scores */ -/* Uwe F. Mayer */ - /* - ** Go get a new score and see if it - ** improves existing scores. - */ - do { - if(*numtries==10) - return(-1); - (*funcpointer[fid])(); - *numtries+=1; - newscore=getscore(fid); - } while(seek_confidence(myscores,&newscore, - &c_half_interval,mean,stdev)==0); -#endif /* We now simply add a new test run and hope that the runs finally stabilize, Uwe F. Mayer */ if(*numtries==30) return(-1); (*funcpointer[fid])(); myscores[*numtries]=getscore(fid); -#ifdef DEBUG - printf("score # %ld = %g\n", *numtries, myscores[*numtries]); -#endif *numtries+=1; } -return(0); + return 0; } -#ifdef OLDCODE -/* this procecdure is no longer needed, Uwe F. Mayer */ - /******************** - ** seek_confidence ** - ********************* - ** Pass this routine an array of 5 scores PLUS a new score. - ** This routine tries the new score in place of each of - ** the other five scores to determine if the new score, - ** when replacing one of the others, improves the confidence - ** half-interval. - ** Return 0 if failure. Original 5 scores unchanged. - ** Return -1 if success. Also returns new half-interval, - ** mean, and standard deviation of the sample. - */ - static int seek_confidence( double scores[5], - double *newscore, - double *c_half_interval, - double *smean, - double *sdev) - { - double sdev_to_beat; /* Original sdev to be beaten */ - double temp; /* For doing a swap */ - int is_beaten; /* Indicates original was beaten */ - int i; /* Index */ - - /* - ** First calculate original standard deviation - */ - calc_confidence(scores,c_half_interval,smean,sdev); - sdev_to_beat=*sdev; - is_beaten=-1; - - /* - ** Try to beat original score. We'll come out of this - ** loop with a flag. - */ - for(i=0;i<5;i++) - { - temp=scores[i]; - scores[i]=*newscore; - calc_confidence(scores,c_half_interval,smean,sdev); - scores[i]=temp; - if(sdev_to_beat>*sdev) - { is_beaten=i; - sdev_to_beat=*sdev; - } - } - - if(is_beaten!=-1) - { scores[is_beaten]=*newscore; - return(-1); - } - return(0); - } -#endif - /******************** ** calc_confidence ** ********************* @@ -918,7 +759,7 @@ double student_t[30]={0.0 , 12.706 , 4.303 , 3.182 , 2.776 , 2.571 , 2.056 , 2.052 , 2.048 , 2.045 }; int i; /* Index */ if ((num_scores<2) || (num_scores>30)) { - output_string("Internal error: calc_confidence called with an illegal number of scores\n"); + puts("Internal error: calc_confidence called with an illegal number of scores"); return(-1); } /* @@ -953,15 +794,12 @@ 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) -{ +static double getscore(int fid) { + /* + ** Fid tells us the function. This is really a matter of + ** doing the proper coercion. + */ + switch(fid) { case TF_NUMSORT: return(global_numsortstruct.sortspersec); case TF_SSORT: @@ -982,25 +820,8 @@ switch(fid) return(global_nnetstruct.iterspersec); case TF_LU: return(global_lustruct.iterspersec); -} -return((double)0.0); -} - -/****************** -** output_string ** -******************* -** Displays a string on the screen. Also, if the flag -** write_to_file is set, outputs the string to the output file. -** Note, this routine presumes that you've included a carriage -** return at the end of the buffer. -*/ -static void output_string(char *buffer) -{ - -printf("%s",buffer); -if(write_to_file!=0) - fprintf(global_ofile,"%s",buffer); -return; + } + return 0.0; } /*************** @@ -1009,166 +830,44 @@ return; ** This routine displays statistics for a particular benchmark. ** The benchmark is identified by its id. */ -static void show_stats (int bid) -{ -char buffer[80]; /* Display buffer */ - -switch(bid) -{ - case TF_NUMSORT: /* Numeric sort */ - sprintf(buffer," Number of arrays: %d\n", - global_numsortstruct.numarrays); - output_string(buffer); - sprintf(buffer," Array size: %ld\n", - global_numsortstruct.arraysize); - output_string(buffer); +static void show_stats (int bid) { + switch(bid) { + case TF_NUMSORT: /* Numeric sort */ + printf(" Number of arrays: %d\n", global_numsortstruct.numarrays); + printf(" Array size: %ld\n", global_numsortstruct.arraysize); break; - case TF_SSORT: /* String sort */ - sprintf(buffer," Number of arrays: %d\n", - global_strsortstruct.numarrays); - output_string(buffer); - sprintf(buffer," Array size: %ld\n", - global_strsortstruct.arraysize); - output_string(buffer); + printf(" Number of arrays: %d\n", global_strsortstruct.numarrays); + printf(" Array size: %ld\n", global_strsortstruct.arraysize); break; - case TF_BITOP: /* Bitmap operation */ - sprintf(buffer," Operations array size: %ld\n", - global_bitopstruct.bitoparraysize); - output_string(buffer); - sprintf(buffer," Bitfield array size: %ld\n", - global_bitopstruct.bitfieldarraysize); - output_string(buffer); + printf(" Operations array size: %ld\n", global_bitopstruct.bitoparraysize); + printf(" Bitfield array size: %ld\n", global_bitopstruct.bitfieldarraysize); break; - case TF_FPEMU: /* Floating-point emulation */ - sprintf(buffer," Number of loops: %lu\n", - global_emfloatstruct.loops); - output_string(buffer); - sprintf(buffer," Array size: %lu\n", - global_emfloatstruct.arraysize); - output_string(buffer); + printf(" Number of loops: %lu\n", global_emfloatstruct.loops); + printf(" Array size: %lu\n", global_emfloatstruct.arraysize); break; - case TF_FFPU: /* Fourier test */ - sprintf(buffer," Number of coefficients: %lu\n", - global_fourierstruct.arraysize); - output_string(buffer); + printf(" Number of coefficients: %lu\n", global_fourierstruct.arraysize); break; - case TF_ASSIGN: - sprintf(buffer," Number of arrays: %lu\n", - global_assignstruct.numarrays); - output_string(buffer); + printf(" Number of arrays: %lu\n", global_assignstruct.numarrays); break; - case TF_IDEA: - sprintf(buffer," Array size: %lu\n", - global_ideastruct.arraysize); - output_string(buffer); - sprintf(buffer," Number of loops: %lu\n", - global_ideastruct.loops); - output_string(buffer); + printf(" Array size: %lu\n", global_ideastruct.arraysize); + printf(" Number of loops: %lu\n", global_ideastruct.loops); break; - case TF_HUFF: - sprintf(buffer," Array size: %lu\n", - global_huffstruct.arraysize); - output_string(buffer); - sprintf(buffer," Number of loops: %lu\n", - global_huffstruct.loops); - output_string(buffer); + printf(" Array size: %lu\n", global_huffstruct.arraysize); + printf(" Number of loops: %lu\n", global_huffstruct.loops); break; - case TF_NNET: - sprintf(buffer," Number of loops: %lu\n", - global_nnetstruct.loops); - output_string(buffer); + printf(" Number of loops: %lu\n", global_nnetstruct.loops); break; - case TF_LU: - sprintf(buffer," Number of arrays: %lu\n", - global_lustruct.numarrays); - output_string(buffer); + printf(" Number of arrays: %lu\n", global_lustruct.numarrays); break; -} -return; -} - -/* -** Following code added for Mac stuff, so that we can emulate command -** lines. -*/ - -#ifdef MAC - -/***************** -** UCommandLine ** -****************** -** Reads in a command line, and sets up argc and argv appropriately. -** Note that this routine uses gets() to read in the line. This means -** you'd better not enter more than 128 characters on a command line, or -** things will overflow, and oh boy... -*/ -void UCommandLine(void) -{ -printf("Enter command line\n:"); -gets((char *)Uargbuff); -UParse(); -return; -} - -/*********** -** UParse ** -************ -** Parse the pseudo command-line. This code appeared as part of the -** Small-C library in Dr. Dobb's ToolBook of C. -** It expects the following globals: -** argc = arg count -** argv = Pointer to array of char pointers -** Uargbuff = Character array that holds the arguments. Should be 129 bytes long. -** Udummy1 = This is a 2-byte buffer that holds a "*", and acts as the first -** argument in the argument list. This maintains compatibility with other -** C's, though it does not provide access to the executable filename. -** This routine allows for up to 20 individual command-line arguments. -** Also note that this routine does NOT allow for redirection. -*/ -void UParse(void) -{ -unsigned char *ptr; - -argc=0; /* Start arg count */ -Udummy[0]='*'; /* Set dummy first argument */ -Udummy[1]='\0'; -argv[argc++]=(char *)Udummy; - -ptr=Uargbuff; /* Start pointer */ -while(*ptr) -{ - if(isspace(*ptr)) - { ++ptr; - continue; } - if(argc<20) argv[argc++]=(char *)ptr; - ptr=UField(ptr); + return; } -return; -} -/*********** -** UField ** -************ -** Isolate the next command-line field. -*/ -unsigned char *UField(unsigned char *ptr) -{ -while(*ptr) -{ if(isspace(*ptr)) - { *ptr=(unsigned char)NULL; - return(++ptr); - } - ++ptr; -} -return(ptr); -} -#endif @@ -313,7 +313,6 @@ static int calc_confidence(double scores[], double *c_half_interval,double *smean, double *sdev); static double getscore(int fid); -static void output_string(char *buffer); static void show_stats(int bid); #ifdef MAC diff --git a/sysinfo.c.example b/sysinfo.c.example index db650f0..ece027d 100644 --- a/sysinfo.c.example +++ b/sysinfo.c.example @@ -1,10 +1,5 @@ -sprintf(buffer,"**System used for compilation:\n"); -output_string(buffer); -sprintf(buffer,"**Linux mimi 2.0.31 #5 Thu Oct 23 10:02:08 CDT 1997 i486\n"); -output_string(buffer); -sprintf(buffer,"**C compiler: gcc version 2.7.2.3\n"); -output_string(buffer); -sprintf(buffer,"**libc: libc.so.5.4.38\n"); -output_string(buffer); -sprintf(buffer,"**Date of compilation: Thu Nov 20 10:04:43 CST 1997\n"); -output_string(buffer); +printf("**System used for compilation:\n"); +printf("**Linux mimi 2.0.31 #5 Thu Oct 23 10:02:08 CDT 1997 i486\n"); +printf("**C compiler: gcc version 2.7.2.3\n"); +printf("**libc: libc.so.5.4.38\n"); +printf("**Date of compilation: Thu Nov 20 10:04:43 CST 1997\n"); diff --git a/sysinfo.c.template b/sysinfo.c.template index c1a986c..775b39c 100644 --- a/sysinfo.c.template +++ b/sysinfo.c.template @@ -1,10 +1,5 @@ -sprintf(buffer,"**System used for compilation:\n"); -output_string(buffer); -sprintf(buffer,"**%SYSTEM%\n"); -output_string(buffer); -sprintf(buffer,"**C compiler: %CCVERSION%\n"); -output_string(buffer); -sprintf(buffer,"**libc: %LIBCVERSION%\n"); -output_string(buffer); -sprintf(buffer,"**Date of compilation: %DATE%\n"); -output_string(buffer); +printf("**System used for compilation:\n"); +printf("**%SYSTEM%\n"); +printf("**C compiler: %CCVERSION%\n"); +printf("**libc: %LIBCVERSION%\n"); +printf("**Date of compilation: %DATE%\n"); diff --git a/sysinfoc.c.example b/sysinfoc.c.example index 7da71ac..ba123a5 100644 --- a/sysinfoc.c.example +++ b/sysinfoc.c.example @@ -1,4 +1,2 @@ -sprintf(buffer,"C compiler : gcc version 2.7.2.3\n"); -output_string(buffer); -sprintf(buffer,"libc : libc.so.5.4.38\n"); -output_string(buffer); +printf("C compiler : gcc version 2.7.2.3\n"); +printf("libc : libc.so.5.4.38\n"); diff --git a/sysinfoc.c.template b/sysinfoc.c.template index 922a5de..b576f54 100644 --- a/sysinfoc.c.template +++ b/sysinfoc.c.template @@ -1,4 +1,2 @@ -sprintf(buffer,"C compiler : %CCVERSION%\n"); -output_string(buffer); -sprintf(buffer,"libc : %LIBCVERSION%\n"); -output_string(buffer); +printf("C compiler : %CCVERSION%\n"); +printf("libc : %LIBCVERSION%\n"); |