[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32156 - gnunet/src/ats-tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32156 - gnunet/src/ats-tests |
Date: |
Mon, 3 Feb 2014 10:10:13 +0100 |
Author: wachs
Date: 2014-02-03 10:10:13 +0100 (Mon, 03 Feb 2014)
New Revision: 32156
Modified:
gnunet/src/ats-tests/ats-testing-traffic.c
Log:
additional check for sinus generator
Modified: gnunet/src/ats-tests/ats-testing-traffic.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-03 08:56:56 UTC (rev
32155)
+++ gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-03 09:10:13 UTC (rev
32156)
@@ -52,7 +52,9 @@
break;
case GNUNET_ATS_TEST_TG_LINEAR:
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);
cur_rate = tg->base_rate + delta_rate;
@@ -63,7 +65,14 @@
break;
case GNUNET_ATS_TEST_TG_SINUS:
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)
+ {
+ /* This will cause an underflow for second half of sinus period,
+ * will be detected in general when experiments are loaded */
+ GNUNET_break (0);
+ }
delta_rate = (tg->max_rate - tg->base_rate) *
sin ( (2 * M_PI) / ((double) tg->duration_period.rel_value_us) *
time_delta.rel_value_us);
cur_rate = tg->base_rate + delta_rate;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32156 - gnunet/src/ats-tests,
gnunet <=