gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32158 - in gnunet/src/ats-tests: . experiments


From: gnunet
Subject: [GNUnet-SVN] r32158 - in gnunet/src/ats-tests: . experiments
Date: Mon, 3 Feb 2014 10:58:18 +0100

Author: wachs
Date: 2014-02-03 10:58:18 +0100 (Mon, 03 Feb 2014)
New Revision: 32158

Modified:
   gnunet/src/ats-tests/ats-testing-experiment.c
   gnunet/src/ats-tests/ats-testing-traffic.c
   gnunet/src/ats-tests/experiments/test.exp
Log:
safety checks


Modified: gnunet/src/ats-tests/ats-testing-experiment.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-experiment.c       2014-02-03 09:44:09 UTC 
(rev 32157)
+++ gnunet/src/ats-tests/ats-testing-experiment.c       2014-02-03 09:58:18 UTC 
(rev 32158)
@@ -256,6 +256,18 @@
       }
     }
 
+    /* Safety checks */
+    if ((GNUNET_ATS_TEST_TG_LINEAR == o->tg_type) ||
+        (GNUNET_ATS_TEST_TG_SINUS == o->tg_type))
+    {
+      if ((o->max_rate - o->base_rate) > o->base_rate)
+      {
+        /* This will cause an underflow */
+        GNUNET_break (0);
+      }
+      fprintf (stderr, "Selected max rate and base rate cannot be used for 
desired traffic form!\n");
+    }
+
     fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu] == 
%s, %llu -> %llu in %s\n",
         op_counter, cur->id, print_op (o->type), o->src_id,
         o->dest_id, type, o->base_rate, o->max_rate,

Modified: gnunet/src/ats-tests/ats-testing-traffic.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-traffic.c  2014-02-03 09:44:09 UTC (rev 
32157)
+++ gnunet/src/ats-tests/ats-testing-traffic.c  2014-02-03 09:58:18 UTC (rev 
32158)
@@ -54,9 +54,13 @@
       time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start);
       /* Calculate point of time in the current period */
       time_delta.rel_value_us = time_delta.rel_value_us % 
tg->duration_period.rel_value_us;
-
       delta_rate = ((double) time_delta.rel_value_us  / 
tg->duration_period.rel_value_us) *
           (tg->max_rate - tg->base_rate);
+      if ((tg->max_rate - tg->base_rate) > tg->base_rate)
+      {
+        /* This will cause an underflow */
+        GNUNET_break (0);
+      }
       cur_rate = tg->base_rate + delta_rate;
       break;
     case GNUNET_ATS_TEST_TG_RANDOM:
@@ -67,7 +71,7 @@
       time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start);
       /* Calculate point of time in the current period */
       time_delta.rel_value_us = time_delta.rel_value_us % 
tg->duration_period.rel_value_us;
-      if ((tg->max_rate - tg->base_rate) < tg->base_rate)
+      if ((tg->max_rate - tg->base_rate) > tg->base_rate)
       {
         /* This will cause an underflow for second half of sinus period,
          * will be detected in general when experiments are loaded */
@@ -82,6 +86,11 @@
       break;
   }
 
+  if (cur_rate < 0)
+  {
+    cur_rate = 0;
+  }
+
   /* Calculate the delay for the next message based on the current delay  */
   delay.rel_value_us =  GNUNET_TIME_UNIT_SECONDS.rel_value_us * 
TEST_MESSAGE_SIZE / cur_rate;
 

Modified: gnunet/src/ats-tests/experiments/test.exp
===================================================================
--- gnunet/src/ats-tests/experiments/test.exp   2014-02-03 09:44:09 UTC (rev 
32157)
+++ gnunet/src/ats-tests/experiments/test.exp   2014-02-03 09:58:18 UTC (rev 
32158)
@@ -21,7 +21,7 @@
 op-1-type = sinus
 op-1-period = 1 s
 op-1-base-rate= 10000
-op-1-max-rate = 20000
+op-1-max-rate = 15000
 
 op-2-operation = set_rate
 op-2-src = 0




reply via email to

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