[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32155 - gnunet/src/ats-tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32155 - gnunet/src/ats-tests |
Date: |
Mon, 3 Feb 2014 09:56:57 +0100 |
Author: wachs
Date: 2014-02-03 09:56:56 +0100 (Mon, 03 Feb 2014)
New Revision: 32155
Modified:
gnunet/src/ats-tests/ats-testing-log.c
gnunet/src/ats-tests/ats-testing-traffic.c
gnunet/src/ats-tests/ats-testing.h
gnunet/src/ats-tests/gnunet-ats-sim.c
Log:
documentation and random generator
Modified: gnunet/src/ats-tests/ats-testing-log.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-log.c 2014-02-02 17:51:46 UTC (rev
32154)
+++ gnunet/src/ats-tests/ats-testing-log.c 2014-02-03 08:56:56 UTC (rev
32155)
@@ -577,7 +577,7 @@
/**
* Log all data now
*
- * @param llogging handle to use
+ * @param l logging handle to use
*/
void
GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
@@ -799,12 +799,12 @@
* @param log_frequency the logging frequency
* @param testname the testname
* @param masters the master peers used for benchmarking
- * @oaram num_master the number of master peers
+ * @param num_masters the number of master peers
* @return the logging handle or NULL on error
*/
struct LoggingHandle *
-GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency,
- char * testname, struct BenchmarkPeer *masters, int num_masters)
+GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency,
+ char *testname, struct BenchmarkPeer *masters, int num_masters)
{
struct LoggingHandle *l;
int c_m;
Modified: gnunet/src/ats-tests/ats-testing-traffic.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-02 17:51:46 UTC (rev
32154)
+++ gnunet/src/ats-tests/ats-testing-traffic.c 2014-02-03 08:56:56 UTC (rev
32155)
@@ -40,9 +40,9 @@
long long int cur_rate;
long long int delta_rate;
-
delay.rel_value_us = 0;
+ /* Calculate the current transmission rate based on the type of traffic */
switch (tg->type) {
case GNUNET_ATS_TEST_TG_CONSTANT:
if (UINT32_MAX == tg->base_rate)
@@ -58,14 +58,14 @@
cur_rate = tg->base_rate + delta_rate;
break;
case GNUNET_ATS_TEST_TG_RANDOM:
- GNUNET_break (0);
+ cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK,
+ tg->max_rate - tg->base_rate);
break;
case GNUNET_ATS_TEST_TG_SINUS:
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:
@@ -73,7 +73,12 @@
break;
}
+ /* 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;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Current rate is %u, calculated delay is %u \n",
+ cur_rate, delay.rel_value_us);
return delay;
}
@@ -269,8 +274,14 @@
* Generate between the source master and the partner and send traffic with a
* maximum rate.
*
+ * @param src traffic source
+ * @param dest traffic partner
+ * @param type type of traffic to generate
* @param base_rate traffic base rate to send data with
* @param max_rate traffic maximum rate to send data with
+ * @param period duration of a period of traffic generation (~ 1/frequency)
+ * @param duration how long to generate traffic
+ * @return the traffic generator
*/
struct TrafficGenerator *
GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
Modified: gnunet/src/ats-tests/ats-testing.h
===================================================================
--- gnunet/src/ats-tests/ats-testing.h 2014-02-02 17:51:46 UTC (rev 32154)
+++ gnunet/src/ats-tests/ats-testing.h 2014-02-03 08:56:56 UTC (rev 32155)
@@ -540,6 +540,19 @@
GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
+/**
+ * Generate between the source master and the partner and send traffic with a
+ * maximum rate.
+ *
+ * @param src traffic source
+ * @param dest traffic partner
+ * @param type type of traffic to generate
+ * @param base_rate traffic base rate to send data with
+ * @param max_rate traffic maximum rate to send data with
+ * @param period duration of a period of traffic generation (~ 1/frequency)
+ * @param duration how long to generate traffic
+ * @return the traffic generator
+ */
struct TrafficGenerator *
GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
struct BenchmarkPartner *dest,
@@ -597,7 +610,7 @@
/**
* Log all data now
*
- * @param llogging handle to use
+ * @param l logging handle to use
*/
void
GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l);
Modified: gnunet/src/ats-tests/gnunet-ats-sim.c
===================================================================
--- gnunet/src/ats-tests/gnunet-ats-sim.c 2014-02-02 17:51:46 UTC (rev
32154)
+++ gnunet/src/ats-tests/gnunet-ats-sim.c 2014-02-03 08:56:56 UTC (rev
32155)
@@ -208,28 +208,41 @@
for (c_s = 0; c_s < e->num_slaves; c_s++)
{
/* Generate maximum traffic to all peers */
- /*
+ /* Example: Generate traffic with constant 10,000 Bytes/s
GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
&masters[c_m].partners[c_s],
GNUNET_ATS_TEST_TG_CONSTANT,
10000,
GNUNET_TIME_UNIT_FOREVER_REL);
*/
- /*
+ /* Example: Generate traffic with an increasing rate from 1000 to 2000
+ * Bytes/s with in a minute
GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
&masters[c_m].partners[c_s],
GNUNET_ATS_TEST_TG_LINEAR,
- 100,
- 200,
+ 1000,
+ 2000,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_FOREVER_REL);
*/
+ /* Example: Generate traffic with a random rate between 1000 to 2000
+ * Bytes/s
GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
&masters[c_m].partners[c_s],
+ GNUNET_ATS_TEST_TG_RANDOM,
+ 1000,
+ 2000,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ */
+ /* Example: Generate traffic with a sinus form, a base rate of
+ * 1000 Bytes/s, an amplitude of (max-base), and a period of 1 minute
*/
+ 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,
+ 2000,
+ GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_FOREVER_REL);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32155 - gnunet/src/ats-tests,
gnunet <=