From 585bf7d499409f42a5c293119c426e2f02107768 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 31 Jan 2014 16:30:22 +0000 Subject: [PATCH] sinus support for traffic generator --- src/ats-tests/ats-testing-traffic.c | 10 ++++++++-- src/ats-tests/gnunet-ats-sim.c | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c index 3019d2054..06a983d5c 100644 --- a/src/ats-tests/ats-testing-traffic.c +++ b/src/ats-tests/ats-testing-traffic.c @@ -61,7 +61,12 @@ get_delay (struct TrafficGenerator *tg) GNUNET_break (0); break; case GNUNET_ATS_TEST_TG_SINUS: - GNUNET_break (0); + time_delta = GNUNET_TIME_absolute_get_duration(tg->time_start); + time_delta.rel_value_us = time_delta.rel_value_us % tg->duration_period.rel_value_us; + delta_rate = (tg->max_rate - tg->base_rate) * + sin ( (2 * M_PI) / ((double) tg->duration_period.rel_value_us) * time_delta.rel_value_us); + //fprintf (stderr, "delta_rate %i\n", delta_rate); + cur_rate = tg->base_rate + delta_rate; break; default: return delay; @@ -128,8 +133,9 @@ send_ping_ready_cb (void *cls, size_t size, void *buf) return TEST_MESSAGE_SIZE; } delay = get_delay (p->tg); + /* fprintf (stderr, "Delay for next transmission %llu ms\n", - (long long unsigned int) delay.rel_value_us / 1000); + (long long unsigned int) delay.rel_value_us / 1000);*/ p->tg->next_ping_transmission = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), delay); diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c index 02441fffe..1e969689a 100644 --- a/src/ats-tests/gnunet-ats-sim.c +++ b/src/ats-tests/gnunet-ats-sim.c @@ -224,6 +224,13 @@ static void topology_setup_done (void *cls, GNUNET_TIME_UNIT_MINUTES, GNUNET_TIME_UNIT_FOREVER_REL); */ + GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m], + &masters[c_m].partners[c_s], + GNUNET_ATS_TEST_TG_SINUS, + 1000, + 1500, + GNUNET_TIME_UNIT_SECONDS, + GNUNET_TIME_UNIT_FOREVER_REL); } } -- 2.25.1