[beast] TESTS: improve perftest measurements: best of 7 runs, more calls per run.



commit ddeaafd4edaa9923213d37b8e955682b70127da8
Author: Stefan Westerfeld <stefan space twc de>
Date:   Tue May 18 10:48:15 2010 +0200

    TESTS: improve perftest measurements: best of 7 runs, more calls per run.

 tests/perftest.cc |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/tests/perftest.cc b/tests/perftest.cc
index 65af2a1..2768d4d 100644
--- a/tests/perftest.cc
+++ b/tests/perftest.cc
@@ -46,13 +46,19 @@ int main(int argc, char **argv)
 
   printf ("%s: testing remote glue layer calls via C++ interface:\n", argv[0]);
 
-  const int max_calls = 10000;
-  double start = gettime ();
+  const int max_calls = 30000;
+  const int runs = 7;
+  double t = 1e7;
 
-  for(int i=0; i < max_calls; i++)
-    note_to_freq (MUSICAL_TUNING_12_TET, 60, 0);
+  for (int r = 0; r < runs; r++)
+    {
+      double start = gettime ();
 
-  double t = gettime () - start;
+      for(int i=0; i < max_calls; i++)
+        note_to_freq (MUSICAL_TUNING_12_TET, 60, 0);
+
+      t = std::min (gettime () - start, t);
+    }
   printf ("%f seconds for %d invocations => %f invocations/second, %f milli seconds per invocation\n",
           t, max_calls, max_calls / t, t * 1000 / max_calls);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]