gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29415 - gnunet/src/ats-tests


From: gnunet
Subject: [GNUnet-SVN] r29415 - gnunet/src/ats-tests
Date: Thu, 19 Sep 2013 14:05:35 +0200

Author: wachs
Date: 2013-09-19 14:05:35 +0200 (Thu, 19 Sep 2013)
New Revision: 29415

Modified:
   gnunet/src/ats-tests/perf_ats.c
   gnunet/src/ats-tests/perf_ats.h
Log:
added duration cmd line argument


Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c     2013-09-19 11:36:47 UTC (rev 29414)
+++ gnunet/src/ats-tests/perf_ats.c     2013-09-19 12:05:35 UTC (rev 29415)
@@ -30,11 +30,6 @@
 #include "gnunet_core_service.h"
 #include "perf_ats.h"
 
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
10)
-#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5)
-#define TESTNAME_PREFIX "perf_ats_"
-#define DEFAULT_SLAVES_NUM 3
-#define DEFAULT_MASTERS_NUM 1
 
 #define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 1)
 #define TEST_ATS_PREFRENCE_START 1.0
@@ -139,7 +134,7 @@
 /**
  * Array of master peers
  */
-struct BenchmarkPeer *mps;
+static  struct BenchmarkPeer *mps;
 
 /**
  * Number slave peers
@@ -148,9 +143,14 @@
 /**
  * Array of slave peers
  */
-struct BenchmarkPeer *sps;
+static struct BenchmarkPeer *sps;
 
 /**
+ * Benchmark duration
+ */
+static struct GNUNET_TIME_Relative perf_duration;
+
+/**
  * Benchmark state
  */
 static struct BenchmarkState state;
@@ -163,7 +163,7 @@
   unsigned int duration;
   struct BenchmarkPeer *mp;
 
-  duration = (BENCHMARK_DURATION.rel_value_us / (1000 * 1000));
+  duration = (perf_duration.rel_value_us / (1000 * 1000));
   for (c_m = 0; c_m < num_masters; c_m++)
   {
     mp = &mps[c_m];
@@ -390,7 +390,7 @@
   progress_task = GNUNET_SCHEDULER_NO_TASK;
 
   fprintf (stderr, "%llu..",
-      (long long unsigned) BENCHMARK_DURATION.rel_value_us / (1000 * 1000) - 
calls);
+      (long long unsigned) perf_duration.rel_value_us / (1000 * 1000) - calls);
   calls++;
 
   progress_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
@@ -431,7 +431,7 @@
 
   if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
     GNUNET_SCHEDULER_cancel (shutdown_task);
-  shutdown_task = GNUNET_SCHEDULER_add_delayed (BENCHMARK_DURATION,
+  shutdown_task = GNUNET_SCHEDULER_add_delayed (perf_duration,
       &do_shutdown, NULL );
 
   progress_task = GNUNET_SCHEDULER_add_now (&print_progress, NULL );
@@ -1176,6 +1176,22 @@
 
   for (c = 0; c < (argc - 1); c++)
   {
+    if (0 == strcmp (argv[c], "-d"))
+      break;
+  }
+  if (c < argc - 1)
+  {
+    if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[c + 1], 
&perf_duration))
+        fprintf (stderr, "Failed to parse duration `%s'\n", argv[c + 1]);
+  }
+  else
+  {
+    perf_duration = BENCHMARK_DURATION;
+  }
+  fprintf (stderr, "Running benchmark for %llu secs\n", (unsigned long long) 
(perf_duration.rel_value_us) / (1000 * 1000));
+
+  for (c = 0; c < (argc - 1); c++)
+  {
     if (0 == strcmp (argv[c], "-s"))
       break;
   }

Modified: gnunet/src/ats-tests/perf_ats.h
===================================================================
--- gnunet/src/ats-tests/perf_ats.h     2013-09-19 11:36:47 UTC (rev 29414)
+++ gnunet/src/ats-tests/perf_ats.h     2013-09-19 12:05:35 UTC (rev 29415)
@@ -29,8 +29,8 @@
 #include "gnunet_ats_service.h"
 #include "gnunet_core_service.h"
 
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
10)
-#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 5)
+#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
30)
+#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 10)
 #define TESTNAME_PREFIX "perf_ats_"
 #define DEFAULT_SLAVES_NUM 3
 #define DEFAULT_MASTERS_NUM 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]