From 0f80cc6bb4c838a9987f7ad1325642b5f0133b86 Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Wed, 27 Jul 2011 12:48:54 +0000 Subject: [PATCH] timestamps --- src/nse/gnunet-service-nse.c | 1 + src/nse/nse-profiler.c | 6 ++++-- src/nse/nse.h | 5 +++++ src/nse/nse_api.c | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index a926c1f23..04ddf5041 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -332,6 +332,7 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em) em->header.type = htons (GNUNET_MESSAGE_TYPE_NSE_ESTIMATE); em->reserved = htonl (0); + em->timestamp = GNUNET_TIME_absolute_hton(GNUNET_TIME_absolute_get()); em->size_estimate = mean - 1.0/3.0; em->std_deviation = std_dev; GNUNET_STATISTICS_set (stats, diff --git a/src/nse/nse-profiler.c b/src/nse/nse-profiler.c index 3b7371ccc..8ca1b8ed9 100644 --- a/src/nse/nse-profiler.c +++ b/src/nse/nse-profiler.c @@ -197,13 +197,14 @@ shutdown_task (void *cls, * Callback to call when network size estimate is updated. * * @param cls closure + * @param timestamp server timestamp * @param estimate the value of the current network size estimate * @param std_dev standard deviation (rounded down to nearest integer) * of the size estimation values seen * */ static void -handle_estimate (void *cls, double estimate, double std_dev) +handle_estimate (void *cls, struct GNUNET_TIME_AbsoluteNBO timestamp, double estimate, double std_dev) { struct NSEPeer *peer = cls; char *output_buffer; @@ -212,9 +213,10 @@ handle_estimate (void *cls, double estimate, double std_dev) if (output_file != NULL) { size = GNUNET_asprintf(&output_buffer, - "%s %u %f %f %f\n", + "%s %u %llu %f %f %f\n", GNUNET_i2s(&peer->daemon->id), peers_running, + GNUNET_TIME_absolute_ntoh(timestamp).abs_value, pow(2, estimate), estimate, std_dev); diff --git a/src/nse/nse.h b/src/nse/nse.h index 24001e8cc..45748b1f3 100644 --- a/src/nse/nse.h +++ b/src/nse/nse.h @@ -54,6 +54,11 @@ struct GNUNET_NSE_ClientMessage */ uint32_t reserved; + /** + * Timestamp at which the server received the message. + */ + struct GNUNET_TIME_AbsoluteNBO timestamp; + /** * The current estimated network size. */ diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index a50cd5a41..c986b7ff4 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c @@ -122,6 +122,7 @@ message_handler (void *cls, } client_msg = (const struct GNUNET_NSE_ClientMessage *)msg; h->recv_cb (h->recv_cb_cls, + client_msg->timestamp, client_msg->size_estimate, client_msg->std_deviation); GNUNET_CLIENT_receive (h->client, -- 2.25.1