aboutsummaryrefslogtreecommitdiff
path: root/src/core
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/core
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core_kx.c20
-rw-r--r--src/core/gnunet-service-core_sessions.c10
-rw-r--r--src/core/test_core_api_reliability.c6
-rw-r--r--src/core/test_core_quota_compliance.c6
4 files changed, 21 insertions, 21 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index d574d3762..879939b18 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -756,7 +756,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
756 if ( ( (KX_STATE_KEY_RECEIVED == kx->status) || 756 if ( ( (KX_STATE_KEY_RECEIVED == kx->status) ||
757 (KX_STATE_UP == kx->status) || 757 (KX_STATE_UP == kx->status) ||
758 (KX_STATE_REKEY_SENT == kx->status) ) && 758 (KX_STATE_REKEY_SENT == kx->status) ) &&
759 (end_t.abs_value <= kx->foreign_key_expires.abs_value) ) 759 (end_t.abs_value_us <= kx->foreign_key_expires.abs_value_us) )
760 { 760 {
761 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"), 761 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# old ephemeral keys ignored"),
762 1, GNUNET_NO); 762 1, GNUNET_NO);
@@ -796,15 +796,15 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx,
796 return; 796 return;
797 } 797 }
798 now = GNUNET_TIME_absolute_get (); 798 now = GNUNET_TIME_absolute_get ();
799 if ( (end_t.abs_value < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value) || 799 if ( (end_t.abs_value_us < GNUNET_TIME_absolute_subtract (now, REKEY_TOLERANCE).abs_value_us) ||
800 (start_t.abs_value > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value) ) 800 (start_t.abs_value_us > GNUNET_TIME_absolute_add (now, REKEY_TOLERANCE).abs_value_us) )
801 { 801 {
802 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 802 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
803 _("Ephemeral key message from peer `%s' rejected as its validity range does not match our system time (%llu not in [%llu,%llu]).\n"), 803 _("Ephemeral key message from peer `%s' rejected as its validity range does not match our system time (%llu not in [%llu,%llu]).\n"),
804 GNUNET_i2s (&kx->peer), 804 GNUNET_i2s (&kx->peer),
805 now.abs_value, 805 now.abs_value_us,
806 start_t.abs_value, 806 start_t.abs_value_us,
807 end_t.abs_value); 807 end_t.abs_value_us);
808 return; 808 return;
809 } 809 }
810 if (GNUNET_OK != 810 if (GNUNET_OK !=
@@ -994,7 +994,7 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
994 994
995 kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; 995 kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK;
996 left = GNUNET_TIME_absolute_get_remaining (kx->timeout); 996 left = GNUNET_TIME_absolute_get_remaining (kx->timeout);
997 if (0 == left.rel_value) 997 if (0 == left.rel_value_us)
998 { 998 {
999 GNUNET_STATISTICS_update (GSC_stats, 999 GNUNET_STATISTICS_update (GSC_stats,
1000 gettext_noop ("# sessions terminated by timeout"), 1000 gettext_noop ("# sessions terminated by timeout"),
@@ -1300,7 +1300,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
1300 1, GNUNET_NO); 1300 1, GNUNET_NO);
1301 return; 1301 return;
1302 } 1302 }
1303 if (0 == GNUNET_TIME_absolute_get_remaining (kx->foreign_key_expires).rel_value) 1303 if (0 == GNUNET_TIME_absolute_get_remaining (kx->foreign_key_expires).rel_value_us)
1304 { 1304 {
1305 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1305 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1306 _("Session to peer `%s' went down due to key expiration (should not happen)\n"), 1306 _("Session to peer `%s' went down due to key expiration (should not happen)\n"),
@@ -1394,8 +1394,8 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
1394 1394
1395 /* check timestamp */ 1395 /* check timestamp */
1396 t = GNUNET_TIME_absolute_ntoh (pt->timestamp); 1396 t = GNUNET_TIME_absolute_ntoh (pt->timestamp);
1397 if (GNUNET_TIME_absolute_get_duration (t).rel_value > 1397 if (GNUNET_TIME_absolute_get_duration (t).rel_value_us >
1398 MAX_MESSAGE_AGE.rel_value) 1398 MAX_MESSAGE_AGE.rel_value_us)
1399 { 1399 {
1400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1401 "Message received far too old (%s). Content ignored.\n", 1401 "Message received far too old (%s). Content ignored.\n",
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index bf27d5600..a77919bde 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010, 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
@@ -240,8 +240,8 @@ transmit_typemap_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
240 delay = TYPEMAP_FREQUENCY; 240 delay = TYPEMAP_FREQUENCY;
241 } 241 }
242 /* randomize a bit to avoid spont. sync */ 242 /* randomize a bit to avoid spont. sync */
243 delay.rel_value += 243 delay.rel_value_us +=
244 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); 244 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000 * 1000);
245 session->typemap_task = 245 session->typemap_task =
246 GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session); 246 GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session);
247 GNUNET_STATISTICS_update (GSC_stats, 247 GNUNET_STATISTICS_update (GSC_stats,
@@ -409,7 +409,7 @@ discard_expired_requests (struct Session *session)
409 { 409 {
410 pos = nxt; 410 pos = nxt;
411 nxt = pos->next; 411 nxt = pos->next;
412 if ((pos->deadline.abs_value < now.abs_value) && 412 if ((pos->deadline.abs_value_us < now.abs_value_us) &&
413 (GNUNET_YES != pos->was_solicited)) 413 (GNUNET_YES != pos->was_solicited))
414 { 414 {
415 GNUNET_STATISTICS_update (GSC_stats, 415 GNUNET_STATISTICS_update (GSC_stats,
@@ -501,7 +501,7 @@ try_transmission (struct Session *session)
501 now = GNUNET_TIME_absolute_get (); 501 now = GNUNET_TIME_absolute_get ();
502 if ((msize == 0) || 502 if ((msize == 0) ||
503 ((msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) && 503 ((msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) &&
504 (min_deadline.abs_value > now.abs_value))) 504 (min_deadline.abs_value_us > now.abs_value_us)))
505 { 505 {
506 /* not enough ready yet, try to solicit more */ 506 /* not enough ready yet, try to solicit more */
507 solicit_messages (session); 507 solicit_messages (session);
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 149a49225..29f39585e 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -127,10 +127,10 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
127 p1.th = NULL; 127 p1.th = NULL;
128 GNUNET_TRANSPORT_disconnect (p2.th); 128 GNUNET_TRANSPORT_disconnect (p2.th);
129 p2.th = NULL; 129 p2.th = NULL;
130 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 130 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
131 FPRINTF (stderr, "\nThroughput was %llu kb/s\n", 131 FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
132 total_bytes * 1000 / 1024 / delta); 132 total_bytes * 1000000LL / 1024 / delta);
133 GAUGER ("CORE", "Core throughput/s", total_bytes * 1000 / 1024 / delta, 133 GAUGER ("CORE", "Core throughput/s", total_bytes * 1000000LL / 1024 / delta,
134 "kb/s"); 134 "kb/s");
135 ok = 0; 135 ok = 0;
136} 136}
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index e09417642..9eb4d841f 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -231,10 +231,10 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
231 FPRINTF (stdout, "%s", "\n"); 231 FPRINTF (stdout, "%s", "\n");
232 running = GNUNET_NO; 232 running = GNUNET_NO;
233 233
234 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; 234 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
235 235
236 throughput_out = total_bytes_sent * 1000 / delta; /* convert to bytes/s */ 236 throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */
237 throughput_in = total_bytes_recv * 1000 / delta; /* convert to bytes/s */ 237 throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */
238 238
239 max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in); 239 max_quota_in = GNUNET_MIN (current_quota_p1_in, current_quota_p2_in);
240 max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out); 240 max_quota_out = GNUNET_MIN (current_quota_p1_out, current_quota_p2_out);