aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/gnunet-service-datastore.c
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/datastore/gnunet-service-datastore.c
parent4a0398474db197abed243a123fb971fbeeffab4b (diff)
downloadgnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.tar.gz
gnunet-3d7fefedc9ba60bd8e8448efe8b628446d958536.zip
changing time measurement from milliseconds to microseconds
Diffstat (limited to 'src/datastore/gnunet-service-datastore.c')
-rw-r--r--src/datastore/gnunet-service-datastore.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 93b43b16c..f6018b7b5 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -332,7 +332,7 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
332 return GNUNET_SYSERR; 332 return GNUNET_SYSERR;
333 } 333 }
334 now = GNUNET_TIME_absolute_get (); 334 now = GNUNET_TIME_absolute_get ();
335 if (expiration.abs_value > now.abs_value) 335 if (expiration.abs_value_us > now.abs_value_us)
336 { 336 {
337 /* finished processing */ 337 /* finished processing */
338 expired_kill_task = 338 expired_kill_task =
@@ -342,9 +342,11 @@ expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
342 return GNUNET_SYSERR; 342 return GNUNET_SYSERR;
343 } 343 }
344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
345 "Deleting content `%s' of type %u that expired %llu ms ago\n", 345 "Deleting content `%s' of type %u that expired %s ago\n",
346 GNUNET_h2s (key), type, 346 GNUNET_h2s (key), type,
347 (unsigned long long) (now.abs_value - expiration.abs_value)); 347 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (expiration,
348 now),
349 GNUNET_YES));
348 min_expiration = now; 350 min_expiration = now;
349 GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, 351 GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size,
350 GNUNET_YES); 352 GNUNET_YES);
@@ -404,11 +406,12 @@ quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
404 if (NULL == key) 406 if (NULL == key)
405 return GNUNET_SYSERR; 407 return GNUNET_SYSERR;
406 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 408 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
407 "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %llu ms prior to expiration (still trying to free another %llu bytes)\n", 409 "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n",
408 (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), 410 (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD),
409 (unsigned int) priority, 411 (unsigned int) priority,
410 GNUNET_h2s (key), type, 412 GNUNET_h2s (key), type,
411 (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value, 413 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration),
414 GNUNET_YES),
412 *need); 415 *need);
413 if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need) 416 if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need)
414 *need = 0; 417 *need = 0;
@@ -619,10 +622,11 @@ transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
619 dm->key = *key; 622 dm->key = *key;
620 memcpy (&dm[1], data, size); 623 memcpy (&dm[1], data, size);
621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 624 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
622 "Transmitting `%s' message for `%s' of type %u with expiration %llu (now: %llu)\n", 625 "Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n",
623 "DATA", GNUNET_h2s (key), type, 626 "DATA", GNUNET_h2s (key), type,
624 (unsigned long long) expiration.abs_value, 627 GNUNET_STRINGS_absolute_time_to_string (expiration),
625 (unsigned long long) GNUNET_TIME_absolute_get ().abs_value); 628 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration),
629 GNUNET_YES));
626 GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1, 630 GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1,
627 GNUNET_NO); 631 GNUNET_NO);
628 transmit (client, &dm->header); 632 transmit (client, &dm->header);
@@ -896,8 +900,8 @@ check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
896 "Result already present in datastore\n"); 900 "Result already present in datastore\n");
897 /* FIXME: change API to allow increasing 'replication' counter */ 901 /* FIXME: change API to allow increasing 'replication' counter */
898 if ((ntohl (dm->priority) > 0) || 902 if ((ntohl (dm->priority) > 0) ||
899 (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value > 903 (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value_us >
900 expiration.abs_value)) 904 expiration.abs_value_us))
901 plugin->api->update (plugin->api->cls, uid, 905 plugin->api->update (plugin->api->cls, uid,
902 (int32_t) ntohl (dm->priority), 906 (int32_t) ntohl (dm->priority),
903 GNUNET_TIME_absolute_ntoh (dm->expiration), NULL); 907 GNUNET_TIME_absolute_ntoh (dm->expiration), NULL);