diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-11 21:21:56 +0000 |
commit | 3d7fefedc9ba60bd8e8448efe8b628446d958536 (patch) | |
tree | 61ce41a52cd6e7232cead77818ef265993b2427e /src/fs/gnunet-service-fs_cp.c | |
parent | 4a0398474db197abed243a123fb971fbeeffab4b (diff) | |
download | gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip |
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.c')
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index e1a3e1ac9..5f047665e 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -488,7 +488,7 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf) | |||
488 | } | 488 | } |
489 | GNUNET_LOAD_update (cp->ppd.transmission_delay, | 489 | GNUNET_LOAD_update (cp->ppd.transmission_delay, |
490 | GNUNET_TIME_absolute_get_duration | 490 | GNUNET_TIME_absolute_get_duration |
491 | (pth->transmission_request_start_time).rel_value); | 491 | (pth->transmission_request_start_time).rel_value_us); |
492 | ret = pth->gmc (pth->gmc_cls, size, buf); | 492 | ret = pth->gmc (pth->gmc_cls, size, buf); |
493 | if (NULL != (pos = cp->pth_head)) | 493 | if (NULL != (pos = cp->pth_head)) |
494 | { | 494 | { |
@@ -621,7 +621,7 @@ revive_migration (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
621 | 621 | ||
622 | cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; | 622 | cp->mig_revive_task = GNUNET_SCHEDULER_NO_TASK; |
623 | bt = GNUNET_TIME_absolute_get_remaining (cp->ppd.migration_blocked_until); | 623 | bt = GNUNET_TIME_absolute_get_remaining (cp->ppd.migration_blocked_until); |
624 | if (0 != bt.rel_value) | 624 | if (0 != bt.rel_value_us) |
625 | { | 625 | { |
626 | /* still time left... */ | 626 | /* still time left... */ |
627 | cp->mig_revive_task = | 627 | cp->mig_revive_task = |
@@ -833,12 +833,12 @@ get_randomized_delay () | |||
833 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 833 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, |
834 | GNUNET_CRYPTO_random_u32 | 834 | GNUNET_CRYPTO_random_u32 |
835 | (GNUNET_CRYPTO_QUALITY_WEAK, | 835 | (GNUNET_CRYPTO_QUALITY_WEAK, |
836 | 2 * GSF_avg_latency.rel_value + 1)); | 836 | 2 * GSF_avg_latency.rel_value_us + 1)); |
837 | #if INSANE_STATISTICS | 837 | #if INSANE_STATISTICS |
838 | GNUNET_STATISTICS_update (GSF_stats, | 838 | GNUNET_STATISTICS_update (GSF_stats, |
839 | gettext_noop | 839 | gettext_noop |
840 | ("# artificial delays introduced (ms)"), | 840 | ("# artificial delays introduced (ms)"), |
841 | ret.rel_value, GNUNET_NO); | 841 | ret.rel_value_us / 1000LL, GNUNET_NO); |
842 | #endif | 842 | #endif |
843 | return ret; | 843 | return ret; |
844 | } | 844 | } |
@@ -1216,7 +1216,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1216 | spid = 0; | 1216 | spid = 0; |
1217 | if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) | 1217 | if ((GNUNET_LOAD_get_load (cp->ppd.transmission_delay) > 3 * (1 + priority)) |
1218 | || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > | 1218 | || (GNUNET_LOAD_get_average (cp->ppd.transmission_delay) > |
1219 | GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value * 2 + | 1219 | GNUNET_CONSTANTS_MAX_CORK_DELAY.rel_value_us * 2 + |
1220 | GNUNET_LOAD_get_average (GSF_rt_entry_lifetime))) | 1220 | GNUNET_LOAD_get_average (GSF_rt_entry_lifetime))) |
1221 | { | 1221 | { |
1222 | /* don't have BW to send to peer, or would likely take longer than we have for it, | 1222 | /* don't have BW to send to peer, or would likely take longer than we have for it, |
@@ -1253,7 +1253,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1253 | prd = GSF_pending_request_get_data_ (pr); | 1253 | prd = GSF_pending_request_get_data_ (pr); |
1254 | if (prd->type == type) | 1254 | if (prd->type == type) |
1255 | { | 1255 | { |
1256 | if (prd->ttl.abs_value >= GNUNET_TIME_absolute_get ().abs_value + ttl) | 1256 | if (prd->ttl.abs_value_us >= GNUNET_TIME_absolute_get ().abs_value_us + ttl * 1000LL) |
1257 | { | 1257 | { |
1258 | /* existing request has higher TTL, drop new one! */ | 1258 | /* existing request has higher TTL, drop new one! */ |
1259 | prd->priority += priority; | 1259 | prd->priority += priority; |
@@ -1425,9 +1425,9 @@ GSF_peer_update_performance_ (struct GSF_ConnectedPeer *cp, | |||
1425 | struct GNUNET_TIME_Relative delay; | 1425 | struct GNUNET_TIME_Relative delay; |
1426 | 1426 | ||
1427 | delay = GNUNET_TIME_absolute_get_duration (request_time); | 1427 | delay = GNUNET_TIME_absolute_get_duration (request_time); |
1428 | cp->ppd.avg_reply_delay.rel_value = | 1428 | cp->ppd.avg_reply_delay.rel_value_us = |
1429 | (cp->ppd.avg_reply_delay.rel_value * (RUNAVG_DELAY_N - 1) + | 1429 | (cp->ppd.avg_reply_delay.rel_value_us * (RUNAVG_DELAY_N - 1) + |
1430 | delay.rel_value) / RUNAVG_DELAY_N; | 1430 | delay.rel_value_us) / RUNAVG_DELAY_N; |
1431 | cp->ppd.avg_priority = | 1431 | cp->ppd.avg_priority = |
1432 | (cp->ppd.avg_priority * (RUNAVG_DELAY_N - 1) + | 1432 | (cp->ppd.avg_priority * (RUNAVG_DELAY_N - 1) + |
1433 | request_priority) / RUNAVG_DELAY_N; | 1433 | request_priority) / RUNAVG_DELAY_N; |
@@ -1678,7 +1678,7 @@ void | |||
1678 | GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, | 1678 | GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, |
1679 | struct GNUNET_TIME_Absolute block_time) | 1679 | struct GNUNET_TIME_Absolute block_time) |
1680 | { | 1680 | { |
1681 | if (cp->last_migration_block.abs_value > block_time.abs_value) | 1681 | if (cp->last_migration_block.abs_value_us > block_time.abs_value_us) |
1682 | { | 1682 | { |
1683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1684 | "Migration already blocked for another %s\n", | 1684 | "Migration already blocked for another %s\n", |
@@ -1686,8 +1686,9 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, | |||
1686 | (cp->last_migration_block), GNUNET_YES)); | 1686 | (cp->last_migration_block), GNUNET_YES)); |
1687 | return; /* already blocked */ | 1687 | return; /* already blocked */ |
1688 | } | 1688 | } |
1689 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n", | 1689 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %s\n", |
1690 | (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value); | 1690 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (block_time), |
1691 | GNUNET_YES)); | ||
1691 | cp->last_migration_block = block_time; | 1692 | cp->last_migration_block = block_time; |
1692 | if (NULL != cp->migration_pth) | 1693 | if (NULL != cp->migration_pth) |
1693 | GSF_peer_transmit_cancel_ (cp->migration_pth); | 1694 | GSF_peer_transmit_cancel_ (cp->migration_pth); |