#define LONG_MESSAGE_SIZE 32000
-#define SHORT_BURST_SECONDS 2
+#define BURST_PACKETS 5000
-#define LONG_BURST_SECONDS 2
+#define BURST_RUNS 1
#define SHORT_BURST_WINDOW \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,SHORT_BURST_SECONDS)
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,5)
#define LONG_BURST_WINDOW \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,SHORT_BURST_SECONDS)
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
#define BURST_SHORT 0
#define SIZE_CHECK 2
-#define MAX_BUF_LEN 1
-static int buf_len = 0;
+static int num_sent = 0;
static uint32_t ack = 0;
payload,
ack);
GNUNET_free (payload);
+ ack += 5;
+ if (ack < 64000)
+ GNUNET_SCHEDULER_add_now (&size_test, NULL);
+ else
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &size_test, NULL);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Size packet test done.\n");
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "#packets: %lu -- latency: %lu\n",
+ "#packets: %lu -- latency: %lu microseconds\n",
num_received,
avg_latency);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
struct GNUNET_TIME_Relative duration = GNUNET_TIME_absolute_get_duration (
start_long);
char *payload;
- if (LONG_BURST_WINDOW.rel_value_us > duration.rel_value_us)
+ if (num_sent < BURST_PACKETS)
{
- //FIXME: Not sure how aggressive we should be here, our transport does not
- //implement congestion control or flow control... (also for the other three
- if (buf_len < MAX_BUF_LEN)
- {
- payload = make_payload (LONG_MESSAGE_SIZE);
- GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
- payload,
- LONG_MESSAGE_SIZE);
- buf_len++;
- GNUNET_free (payload);
+ payload = make_payload (LONG_MESSAGE_SIZE);
+ GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
+ payload,
+ LONG_MESSAGE_SIZE);
+ num_sent++;
+ GNUNET_free (payload);
+ if (num_sent < BURST_PACKETS)
GNUNET_SCHEDULER_add_now (&long_test, NULL);
- }
+ if (num_sent == BURST_PACKETS)
+ GNUNET_SCHEDULER_add_delayed (LONG_BURST_WINDOW,
+ &long_test, NULL);
return;
}
+ duration = GNUNET_TIME_absolute_get_duration (start_long);
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Long size packet test done.\n");
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "goodput: %lu b/s -- #packets: %lu -- latency: %lu\n",
- (LONG_MESSAGE_SIZE * num_received) / LONG_BURST_SECONDS,
+ "goodput: %lu kb/s -- #packets: %lu -- latency: %lu microseconds\n",
+ (LONG_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 1000),
num_received,
avg_latency);
ack = 10;
num_received = 0;
- buf_len = 0;
+ num_sent = 0;
avg_latency = 0;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &size_test, NULL);
}
static void
short_test (void *cls)
{
- struct GNUNET_TIME_Relative duration = GNUNET_TIME_absolute_get_duration (
- start_short);
+ struct GNUNET_TIME_Relative duration;
char *payload;
- if (SHORT_BURST_WINDOW.rel_value_us > duration.rel_value_us)
+ if (num_sent < BURST_PACKETS)
{
- if (buf_len < MAX_BUF_LEN)
- {
- payload = make_payload (SHORT_MESSAGE_SIZE);
- GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
- payload,
- SHORT_MESSAGE_SIZE);
- buf_len++;
- GNUNET_free (payload);
+ payload = make_payload (SHORT_MESSAGE_SIZE);
+ GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
+ payload,
+ SHORT_MESSAGE_SIZE);
+ num_sent++;
+ GNUNET_free (payload);
+ if (num_sent < BURST_PACKETS)
GNUNET_SCHEDULER_add_now (&short_test, NULL);
- }
+ if (num_sent == BURST_PACKETS)
+ GNUNET_SCHEDULER_add_delayed (SHORT_BURST_WINDOW,
+ &short_test, NULL);
return;
}
+ duration = GNUNET_TIME_absolute_get_duration (start_short);
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
"Short size packet test done.\n");
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "goodput: %lu b/s -- #packets: %lu -- latency: %lu\n",
- (SHORT_MESSAGE_SIZE * num_received) / SHORT_BURST_SECONDS,
+ "goodput: %lu kb/s -- #packets: %lu -- latency: %lu microseconds\n",
+ (SHORT_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 1000),
num_received,
avg_latency);
start_long = GNUNET_TIME_absolute_get ();
phase = BURST_LONG;
- buf_len = 0;
+ num_sent = 0;
avg_latency = 0;
num_received = 0;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &long_test, NULL);
"Queue established, starting test...\n");
start_short = GNUNET_TIME_absolute_get ();
my_tc = tc_queue;
- buf_len = 0;
phase = BURST_SHORT;
GNUNET_SCHEDULER_add_now (&short_test, tc_queue);
}
GNUNET_assert (SHORT_MESSAGE_SIZE == payload_len);
num_received++;
update_avg_latency (payload);
- if (buf_len == MAX_BUF_LEN)
- GNUNET_SCHEDULER_add_now (&short_test, NULL);
- buf_len--;
}
else if (phase == BURST_LONG)
{
return; // Ignore
num_received++;
update_avg_latency (payload);
- if (buf_len == MAX_BUF_LEN)
- GNUNET_SCHEDULER_add_now (&long_test, NULL);
- buf_len--;
}
else // if (phase == SIZE_CHECK) {
{
- // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- // "Receiving payload with size %lu...\n", payload_len);
- if (ack != payload_len)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Error receiving message, corrupted.\n");
- ret = 1;
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
num_received++;
update_avg_latency (payload);
- ack += 5; // Next expected message size
- GNUNET_SCHEDULER_add_now (&size_test, NULL);
}
}
{
ret = 0;
num_received = 0;
+ num_sent = 0;
for (int i = 0; i < NUM_PEERS; i++)
{
tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (