[test-suite] r273529 - nbench: Eliminate timing and re-running related code

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 20:07:43 PDT 2016


Author: matze
Date: Wed Jun 22 22:07:42 2016
New Revision: 273529

URL: http://llvm.org/viewvc/llvm-project?rev=273529&view=rev
Log:
nbench: Eliminate timing and re-running related code

nbench is by far the noisiest benchmark in the test-suite for me. This
seems to be caused by the benchmark running a variable number of
iterations internally based on its own measurements. Even though the
original commit to the test-suite claims this was disabled.

This commit shortcuts all the re-running until confident code and remove
all time measurement code just to be sure.

The number of iterations is also reduced to 1 to reduce the overal
test-suite runtime (see the discussion in the review).

Differential Revision: http://reviews.llvm.org/D21590

Modified:
    test-suite/trunk/MultiSource/Benchmarks/nbench/nbench0.c
    test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.c
    test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.h

Modified: test-suite/trunk/MultiSource/Benchmarks/nbench/nbench0.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/nbench/nbench0.c?rev=273529&r1=273528&r2=273529&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/nbench/nbench0.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/nbench/nbench0.c Wed Jun 22 22:07:42 2016
@@ -55,6 +55,10 @@
 #include "nbench0.h"
 #include "hardware.h"
 
+#ifndef N_ITERATIONS
+#define N_ITERATIONS 1
+#endif
+
 /*************
 **** main ****
 *************/
@@ -65,6 +69,7 @@ int main(int argc, char *argv[])
 #endif
 {
 int i;                  /* Index */
+int iter;
 time_t time_and_date;   /* Self-explanatory */
 struct tm *loctime;
 double bmean;           /* Benchmark mean */
@@ -243,16 +248,19 @@ for(i=0;i<NUMTESTS;i++)
         if(tests_to_do[i])
         {       sprintf(buffer,"%s    :",ftestnames[i]);
                                 output_string(buffer);
+#if 0
                 if (0!=bench_with_confidence(i,
                         &bmean,
                         &bstdev,
                         &bnumrun)){
-#if 0
 		  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("                    :");
-#endif
 		}
+#endif
+                for (iter = 0; iter < N_ITERATIONS; ++iter) {
+                  (*funcpointer[i])();
+                }
 #ifdef LINUX
                 sprintf(buffer," %15.5g  :  %9.2f  :  %9.2f\n",
                         bmean,bmean/bindex[i],bmean/lx_bindex[i]);

Modified: test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.c?rev=273529&r1=273528&r2=273529&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.c Wed Jun 22 22:07:42 2016
@@ -781,25 +781,8 @@ exit(1);
 */
 unsigned long StartStopwatch()
 {
-#ifdef MACTIMEMGR
-/*
-** For Mac code warrior, use timer. In this case, what we return is really
-** a dummy value.
-*/
-InsTime((QElemPtr)&myTMTask);
-PrimeTime((QElemPtr)&myTMTask,-MacHSTdelay);
-return((unsigned long)1);
-#else
-#ifdef WIN31TIMER
-/*
-** Win 3.x timer returns a DWORD, which we coax into a long.
-*/
-_Call16(lpfn,"p",&win31tinfo);
-return((unsigned long)win31tinfo.dwmsSinceStart);
-#else
-return((unsigned long)clock());
-#endif
-#endif
+  /* no timing code in this version. */
+  return 0;
 }
 
 /****************************
@@ -809,21 +792,8 @@ return((unsigned long)clock());
 */
 unsigned long StopStopwatch(unsigned long startticks)
 {
-	
-#ifdef MACTIMEMGR
-/*
-** For Mac code warrior...ignore startticks.  Return val. in microseconds
-*/
-RmvTime((QElemPtr)&myTMTask);
-return((unsigned long)(MacHSTdelay+myTMTask.tmCount-MacHSTohead));
-#else
-#ifdef WIN31TIMER
-_Call16(lpfn,"p",&win31tinfo);
-return((unsigned long)win31tinfo.dwmsSinceStart-startticks);
-#else
-return((unsigned long)clock()-startticks);
-#endif
-#endif
+  /* no timing code in this version. */
+  return 1000;
 }
 
 /****************************
@@ -833,25 +803,8 @@ return((unsigned long)clock()-startticks
 */
 unsigned long TicksToSecs(unsigned long tickamount)
 {
-#ifdef CLOCKWCT
-return((unsigned long)(tickamount/CLK_TCK));
-#endif
-
-#ifdef MACTIMEMGR
-/* +++ MAC time manager version (using timer in microseconds) +++ */
-return((unsigned long)(tickamount/1000000));
-#endif
-
-#ifdef CLOCKWCPS
-/* Everybody else */
-return((unsigned long)(tickamount/CLOCKS_PER_SEC));
-#endif
-
-#ifdef WIN31TIMER
-/* Each tick is 840 nanoseconds */
-return((unsigned long)(tickamount/1000L));
-#endif
-
+  /* no timing code in this version. */
+  return 0;
 }
 
 /****************************
@@ -862,23 +815,7 @@ return((unsigned long)(tickamount/1000L)
 */
 double TicksToFracSecs(unsigned long tickamount)
 {
-#ifdef CLOCKWCT
-return((double)tickamount/(double)CLK_TCK);
-#endif
-
-#ifdef MACTIMEMGR
-/* +++ MAC time manager version +++ */
-return((double)tickamount/(double)1000000);
-#endif
-
-#ifdef CLOCKWCPS
-/* Everybody else */
-return((double)tickamount/(double)CLOCKS_PER_SEC);
-#endif
-
-#ifdef WIN31TIMER
-/* Using 840 nanosecond ticks */
-return((double)tickamount/(double)1000);
-#endif
+  /* no timing code in this version. */
+  return 0;
 }
 

Modified: test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.h?rev=273529&r1=273528&r2=273529&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.h (original)
+++ test-suite/trunk/MultiSource/Benchmarks/nbench/sysspec.h Wed Jun 22 22:07:42 2016
@@ -28,7 +28,6 @@
 */
 #include <stdlib.h>
 #include <stdio.h>
-#include <time.h>
 #include <string.h>
 
 #include "nmglobal.h"




More information about the llvm-commits mailing list