aboutsummaryrefslogtreecommitdiff
path: root/src/fragmentation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-11 21:21:56 +0000
commit3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch)
tree61ce41a52cd6e7232cead77818ef265993b2427e /src/fragmentation
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/fragmentation')
-rw-r--r--src/fragmentation/defragmentation.c10
-rw-r--r--src/fragmentation/fragmentation.c16
2 files changed, 13 insertions, 13 deletions
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c
index 2d3f4a57b..f42207046 100644
--- a/src/fragmentation/defragmentation.c
+++ b/src/fragmentation/defragmentation.c
@@ -354,13 +354,13 @@ estimate_latency (struct MessageContext *mc)
354 for (i = 0; i < total; i++) 354 for (i = 0; i < total; i++)
355 { 355 {
356 x[i] = (double) i; 356 x[i] = (double) i;
357 y[i] = (double) (first[i].time.abs_value - first[0].time.abs_value); 357 y[i] = (double) (first[i].time.abs_value_us - first[0].time.abs_value_us);
358 } 358 }
359 gsl_fit_mul (x, 1, y, 1, total, &c1, &cov11, &sumsq); 359 gsl_fit_mul (x, 1, y, 1, total, &c1, &cov11, &sumsq);
360 c1 += sqrt (sumsq); /* add 1 std dev */ 360 c1 += sqrt (sumsq); /* add 1 std dev */
361 ret.rel_value = (uint64_t) c1; 361 ret.rel_value_us = (uint64_t) c1;
362 if (ret.rel_value == 0) 362 if (0 == ret.rel_value_us)
363 ret = GNUNET_TIME_UNIT_MILLISECONDS; /* always at least 1 */ 363 ret = GNUNET_TIME_UNIT_MICROSECONDS; /* always at least 1 */
364 return ret; 364 return ret;
365} 365}
366 366
@@ -381,7 +381,7 @@ discard_oldest_mc (struct GNUNET_DEFRAGMENT_Context *dc)
381 while (NULL != pos) 381 while (NULL != pos)
382 { 382 {
383 if ((old == NULL) || 383 if ((old == NULL) ||
384 (old->last_update.abs_value > pos->last_update.abs_value)) 384 (old->last_update.abs_value_us > pos->last_update.abs_value_us))
385 old = pos; 385 old = pos;
386 pos = pos->next; 386 pos = pos->next;
387 } 387 }
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c
index f859b32c7..39a5af814 100644
--- a/src/fragmentation/fragmentation.c
+++ b/src/fragmentation/fragmentation.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2009, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2009-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -180,7 +180,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
180 delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker, fsize); 180 delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker, fsize);
181 else 181 else
182 delay = GNUNET_TIME_UNIT_ZERO; 182 delay = GNUNET_TIME_UNIT_ZERO;
183 if (delay.rel_value > 0) 183 if (delay.rel_value_us > 0)
184 { 184 {
185 fc->task = GNUNET_SCHEDULER_add_delayed (delay, &transmit_next, fc); 185 fc->task = GNUNET_SCHEDULER_add_delayed (delay, &transmit_next, fc);
186 return; 186 return;
@@ -207,7 +207,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
207 GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize); 207 GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize);
208 GNUNET_STATISTICS_update (fc->stats, _("# fragments transmitted"), 1, 208 GNUNET_STATISTICS_update (fc->stats, _("# fragments transmitted"), 1,
209 GNUNET_NO); 209 GNUNET_NO);
210 if (0 != fc->last_round.abs_value) 210 if (0 != fc->last_round.abs_value_us)
211 GNUNET_STATISTICS_update (fc->stats, _("# fragments retransmitted"), 1, 211 GNUNET_STATISTICS_update (fc->stats, _("# fragments retransmitted"), 1,
212 GNUNET_NO); 212 GNUNET_NO);
213 213
@@ -367,8 +367,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
367 /* normal ACK, can update running average of delay... */ 367 /* normal ACK, can update running average of delay... */
368 fc->wack = GNUNET_NO; 368 fc->wack = GNUNET_NO;
369 ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round); 369 ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round);
370 fc->ack_delay.rel_value = 370 fc->ack_delay.rel_value_us =
371 (ndelay.rel_value / fc->num_transmissions + 3 * fc->ack_delay.rel_value) / 4; 371 (ndelay.rel_value_us / fc->num_transmissions + 3 * fc->ack_delay.rel_value_us) / 4;
372 fc->num_transmissions = 0; 372 fc->num_transmissions = 0;
373 /* calculate ratio msg sent vs. msg acked */ 373 /* calculate ratio msg sent vs. msg acked */
374 ack_cnt = 0; 374 ack_cnt = 0;
@@ -392,11 +392,11 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
392 { 392 {
393 /* some loss, slow down proportionally */ 393 /* some loss, slow down proportionally */
394 fprintf (stderr, "Prop loss\n"); 394 fprintf (stderr, "Prop loss\n");
395 fc->msg_delay.rel_value = ((fc->msg_delay.rel_value * ack_cnt) / snd_cnt); 395 fc->msg_delay.rel_value_us = ((fc->msg_delay.rel_value_us * ack_cnt) / snd_cnt);
396 } 396 }
397 else if (1 < fc->msg_delay.rel_value) 397 else if (100 < fc->msg_delay.rel_value_us)
398 { 398 {
399 fc->msg_delay.rel_value--; /* try a bit faster */ 399 fc->msg_delay.rel_value_us -= 100; /* try a bit faster */
400 } 400 }
401 fc->msg_delay = GNUNET_TIME_relative_min (fc->msg_delay, 401 fc->msg_delay = GNUNET_TIME_relative_min (fc->msg_delay,
402 GNUNET_TIME_UNIT_SECONDS); 402 GNUNET_TIME_UNIT_SECONDS);