int main(int argc, char *argv[]) { int count = 4, calibrate = 1; long xtra = 1; int section; long x100 = 100; int duration = 100; FILE *outfile; char compiler[80] = " ", options[256] = " ", general[10][80] = {" "}; char *endit = " "; char *getinput = "Yes"; printf("\n"); printf("##########################################\n"); printf("%s Precision C/C++ Whetstone Benchmark\n\n", Precision); printf("Calibrate\n"); do { TimeUsed=0; whetstones(xtra,x100,calibrate); printf("%11.2f Seconds %10.0lf Passes (x 100)\n", TimeUsed,(SPDP)(xtra)); calibrate++; count--; xtra = xtra * 5; } while (count > 0); return 0; }
main(int argc, char *argv[]) { int count = 10, calibrate = 1; long xtra=1; int endit, section; long x100 = 100; int duration = 100; FILE *outfile; char general[9][80] = {" "}; int getinput = 1; printf("\n %s Precision C/C++ Whetstone Benchmark\n\n", Precision); if (argc > 1) { switch (argv[1][0]) { case 'N': getinput = 0; break; case 'n': getinput = 0; break; } } if (getinput == 0) { printf ("No run time input data\n\n"); } else { printf ("With run time input data\n\n"); } outfile = fopen("Whets.txt","a+"); if (outfile == NULL) { printf ("Cannot open results file \n\n"); printf("Press any key\n"); endit = getch(); exit (0); } printf("Calibrate\n"); do { TimeUsed=0; whetstones(xtra,x100,calibrate); printf("%11.2f Seconds %10.0lf Passes (x 100)\n", TimeUsed,(SPDP)(xtra)); calibrate = calibrate + 1; count = count - 1; if (TimeUsed > 2.0) count = 0; else xtra = xtra * 5; } while (count > 0); if (TimeUsed > 0) xtra = (long)((SPDP)(duration * xtra) / TimeUsed); if (xtra < 1) xtra = 1; calibrate = 0; printf("\nUse %d passes (x 100)\n", xtra); printf("\n %s Precision C/C++ Whetstone Benchmark", Precision); printf("\n %s", compiler); printf("\n %s\n", options); /* ----------------- ---------------------------- --------- --------- --------- */ printf("\nLoop content Result MFLOPS " " MOPS Seconds\n\n"); TimeUsed=0; whetstones(xtra,x100,calibrate); printf("\nMWIPS "); if (TimeUsed>0) mwips=(float)(xtra) * (float)(x100) / (10 * TimeUsed); else mwips = 0; printf("%39.3f%19.3f\n\n",mwips,TimeUsed); if (Check == 0) printf("Wrong answer "); /************************************************************************ * Type details of hardware, software etc. * ************************************************************************/ if (getinput == 1) { printf ("Enter the following which will be added with results to file WHETS.TXT\n"); printf ("When submitting a number of results you need only provide details once\n"); printf ("but a cross reference such as an abbreviated CPU type would be useful.\n"); printf ("You can kill (exit or close) the program now and no data will be added.\n\n"); printf ("PC Supplier/model ? "); gets(general[1]); printf ("CPU chip ? "); gets(general[2]); printf ("Clock MHz ? "); gets(general[3]); printf ("Cache size ? "); gets(general[4]); printf ("Chipset & H/W options ? "); gets(general[5]); printf ("OS/DOS version ? "); gets(general[6]); printf ("Your name ? "); gets(general[7]); printf ("Company/Location ? "); gets(general[8]); printf ("E-mail address ? "); gets(general[0]); } what_date(); /************************************************************************ * Add results to output file Whets.txt * ************************************************************************/ fprintf (outfile, "----------------- -----------------------------" " --------- --------- --------- ---------" " --------- --------- --------- ---------" " ---------\n"); fprintf (outfile, "Whetstone %s Precision Benchmark in C/C++\n\n", Precision); fprintf (outfile, "Month run %d/%d\n", this_month, this_year); fprintf (outfile, "PC model %s\n", general[1]); fprintf (outfile, "CPU %s\n", general[2]); fprintf (outfile, "Clock MHz %s\n", general[3]); fprintf (outfile, "Cache %s\n", general[4]); fprintf (outfile, "H/W Options %s\n", general[5]); fprintf (outfile, "OS/DOS %s\n", general[6]); fprintf (outfile, "Compiler %s\n", compiler); fprintf (outfile, "OptLevel %s\n", options); fprintf (outfile, "Run by %s\n", general[7]); fprintf (outfile, "From %s\n", general[8]); fprintf (outfile, "E-mail address %s\n\n", general[0]); fprintf (outfile,"Loop content Result" " MFLOPS MOPS Seconds\n\n"); for (section=1; section<9; section++) { fprintf (outfile, "%s %24.17f ", headings[section], results[section]); if (loop_mops[section] == 99999) { fprintf (outfile," %9.3f %9.3f\n", loop_mflops[section], loop_time[section]); } else { fprintf (outfile, " %9.3f %9.3f\n", loop_mops[section], loop_time[section]); } } fprintf (outfile, "\nMWIPS "); fprintf (outfile, "%39.3f%20.3f\n\n",mwips,TimeUsed); fprintf (outfile, "Results to load to spreadsheet "); fprintf (outfile, " MWIPS Mflops1 Mflops2 Mflops3 Cosmops" " Expmops Fixpmops Ifmops Eqmops\n"); fprintf (outfile, "Results to load to spreadsheet "); fprintf (outfile, " %9.3f %9.3f %9.3f", mwips, loop_mflops[1], loop_mflops[2]); fprintf (outfile, " %9.3f %9.3f %9.3f", loop_mflops[6], loop_mops[5], loop_mops[8]); fprintf (outfile, " %9.3f %9.3f %9.3f\n\n", loop_mops[4], loop_mops[3], loop_mops[7]); fclose (outfile); printf ("\n"); printf ("A new results file will have been created in the same directory as the\n"); printf (".EXE files if one did not already exist. If you made a mistake on input, \n"); printf ("you can use a text editor to correct it, delete the results or copy \n"); printf ("them to a different file name. If you intend to run multiple tests you\n"); printf ("you may wish to rename WHETS.TXT with a more informative title.\n\n"); printf ("Please submit feedback and results files as a posting in Section 12\n"); printf ("or to [email protected]\n\n"); if (getinput == 1) { printf("Press any key to exit\n"); endit = getch(); printf ("\nIf this is displayed you must close the window in the normal way\n"); } }
int main(int argc, char *argv[]) { int count = 10, calibrate = 1; long xtra = 1; long x100 = 100; #ifdef UNIXBENCH int duration = 10; #else int section; int duration = 100; FILE *outfile; int getinput = 1; char compiler[80] = " ", options[256] = " ", general[10][80] = {" "}; char *endit = " "; printf("##########################################\n"); printf("%s Precision C/C++ Whetstone Benchmark\n\n", Precision); #endif #ifndef UNIXBENCH if (argc > 1) { switch (argv[1][0]) { case 'N': case 'n': getinput = 0; break; } } if (! getinput) { printf ("No run time input data\n\n"); } outfile = fopen("whets.res","a+"); if (outfile == NULL) { printf ("Cannot open results file \n\n"); printf("Press RETURN to exit\n"); gets(endit); exit (0); } #endif printf("Calibrate\n"); do { TimeUsed=0; whetstones(xtra,x100,calibrate); printf("%11.2f Seconds %10.0f Passes (x 100)\n", TimeUsed, (SPDP)(xtra)); calibrate++; count--; #ifndef UNIXBENCH if (TimeUsed > 2.0) #else if (TimeUsed > 0.5) #endif { count = 0; } else { xtra = xtra * 5; } } while (count > 0); if (TimeUsed > 0) xtra = (long)((SPDP)(duration * xtra) / TimeUsed); if (xtra < 1) xtra = 1; calibrate = 0; printf("\nUse %ld passes (x 100)\n", xtra); printf("\n %s Precision C/C++ Whetstone Benchmark",Precision); #ifdef PRECOMP printf("\n Compiler %s", precompiler); printf("\n Options %s\n", preoptions); #else printf("\n"); #endif printf("\nLoop content Result MFLOPS " " MOPS Seconds\n\n"); TimeUsed=0; whetstones(xtra,x100,calibrate); printf("\nMWIPS "); if (TimeUsed>0) { mwips=(float)(xtra) * (float)(x100) / (10 * TimeUsed); } else { mwips = 0; } printf("%39.3f%19.3f\n\n",mwips,TimeUsed); if (Check == 0) printf("Wrong answer "); /************************************************************************/ /* Type details of hardware, software etc. */ /************************************************************************/ #ifndef UNIXBENCH if (getinput) { printf ("Enter the following which will be added with results to file WHETS.RES\n"); printf ("When submitting a number of results you need only provide details once\n"); printf ("but a cross reference such as an abbreviated CPU type would be useful.\n"); printf ("You can kill (exit or close) the program now and no data will be added.\n\n"); printf ("Date: "); gets(general[0]); printf ("Computer: "); gets(general[1]); printf ("CPU chip: "); gets(general[2]); printf ("Clock MHz: "); gets(general[3]); printf ("Cache size: "); gets(general[4]); printf ("H/W options:"); gets(general[5]); printf ("OS version: "); gets(general[6]); #ifdef PRECOMP strcpy (compiler, precompiler); strcpy (options, preoptions); #else printf ("Compiler: "); gets(compiler); printf ("Options: "); gets(options); #endif printf ("Your name: "); gets(general[7]); printf ("From: "); gets(general[8]); printf ("Email: "); gets(general[9]); } else { #ifdef PRECOMP strcpy (compiler, precompiler); strcpy (options, preoptions); #endif } /************************************************************************/ /* Add results to output file whets.res */ /************************************************************************/ fprintf (outfile, "\n"); fprintf (outfile, "##############################################\n"); fprintf (outfile, "Whetstone %s Precision Benchmark in C/C++\n\n",Precision); fprintf (outfile, "Date %s\n", general[0]); fprintf (outfile, "Model %s\n", general[1]); fprintf (outfile, "CPU %s\n", general[2]); fprintf (outfile, "Clock MHz %s\n", general[3]); fprintf (outfile, "Cache %s\n", general[4]); fprintf (outfile, "H/W options %s\n", general[5]); fprintf (outfile, "OS %s\n", general[6]); fprintf (outfile, "Compiler %s\n", compiler); fprintf (outfile, "Options %s\n", options); fprintf (outfile, "Run by %s\n", general[7]); fprintf (outfile, "From %s\n", general[8]); fprintf (outfile, "Email %s\n", general[9]); fprintf (outfile, "\n"); fprintf (outfile,"Loop content Result" " MFLOPS MOPS Seconds\n\n"); for (section=1; section<9; section++) { fprintf (outfile, "%s %24.17f ", headings[section], results[section]); if (loop_mops[section] == 99999) { fprintf (outfile," %9.3f %9.3f\n", loop_mflops[section], loop_time[section]); } else { fprintf (outfile, " %9.3f %9.3f\n", loop_mops[section], loop_time[section], results[section]); } } fprintf (outfile, "\nMWIPS "); fprintf (outfile, "%39.3f%20.3f\n\n",mwips,TimeUsed); fprintf (outfile, "Results to load to spreadsheet "); fprintf (outfile, " MWIPS Mflops1 Mflops2 Mflops3 Cosmops" " Expmops Fixpmops Ifmops Eqmops\n"); fprintf (outfile, "Results to load to spreadsheet "); fprintf (outfile, " %9.3f %9.3f %9.3f", mwips, loop_mflops[1], loop_mflops[2]); fprintf (outfile, " %9.3f %9.3f %9.3f", loop_mflops[6], loop_mops[5], loop_mops[8]); fprintf (outfile, " %9.3f %9.3f %9.3f\n\n", loop_mops[4], loop_mops[3], loop_mops[7]); fclose (outfile); printf ("\n"); printf ("A new results file will have been created in the same directory as the\n"); printf (".EXE files if one did not already exist. If you made a mistake on input, \n"); printf ("you can use a text editor to correct it, delete the results or copy \n"); printf ("them to a different file name. If you intend to run multiple tests you\n"); printf ("you may wish to rename WHETS.RES with a more informative title.\n\n"); printf ("Please submit feedback and results files to [email protected] or to\n"); printf ("[email protected]\n\n"); #else /* Unixbench */ fprintf (stderr, "COUNT|%.3f|0|MWIPS\n", mwips); fprintf (stderr, "TIME|%.3f\n", TimeUsed); exit(0); #endif }