* How many messages have peers received during the test.
*/
unsigned long long total_nse_received_messages;
+
/**
* How many messages have peers send during the test (should be == received).
*/
- unsigned long long total_nse_sent_messages;
+ unsigned long long total_nse_transmitted_messages;
+
+ /**
+ * How many messages have travelled an edge in both directions.
+ */
+ unsigned long long total_nse_cross;
+
+ /**
+ * How many extra messages per edge (corrections) have been received.
+ */
+ unsigned long long total_nse_extra;
+
+ /**
+ * How many messages have been discarded.
+ */
+ unsigned long long total_discarded;
};
struct NSEPeer *pos;
#if VERBOSE
- fprintf (stderr, "Ending test.\n");
+ FPRINTF (stderr, "%s", "Ending test.\n");
#endif
if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
if (pos->nse_handle != NULL)
GNUNET_NSE_disconnect (pos->nse_handle);
GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, pos);
+ if (GNUNET_SCHEDULER_NO_TASK != pos->stats_task)
+ {
+ GNUNET_SCHEDULER_cancel (pos->stats_task);
+ if (NULL != pos->stats)
+ GNUNET_STATISTICS_destroy(pos->stats, GNUNET_NO);
+ }
GNUNET_free (pos);
}
GNUNET_free (output_buffer);
}
else
- fprintf (stderr,
+ FPRINTF (stderr,
"Received network size estimate from peer %s. Size: %f std.dev. %f\n",
GNUNET_i2s (&peer->daemon->id), estimate, std_dev);
core_get_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct NSEPeer *peer = cls;
-
- peer->stats_task = GNUNET_SCHEDULER_NO_TASK;
+
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
{
GNUNET_STATISTICS_destroy(peer->stats, GNUNET_NO);
peer->stats = NULL;
+ return;
}
else
{
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, &core_stats_iterator, peer);
}
+ peer->stats_task = GNUNET_SCHEDULER_NO_TASK;
}
/**
GNUNET_DISK_file_write (data_file, buf, buf_len);
}
GNUNET_free_non_null (buf);
+
buf = NULL;
buf_len =
- GNUNET_asprintf (&buf, "TOTAL_NSE_SENT_MESSAGES_%d: %u\n",
+ GNUNET_asprintf (&buf, "TOTAL_NSE_TRANSMITTED_MESSAGES_%d: %u\n",
stats_context->shutdown,
- stats_context->total_nse_received_messages);
+ stats_context->total_nse_transmitted_messages);
if (buf_len > 0)
{
GNUNET_DISK_file_write (data_file, buf, buf_len);
}
GNUNET_free_non_null (buf);
+
+ buf = NULL;
+ buf_len =
+ GNUNET_asprintf (&buf, "TOTAL_NSE_CROSS_%d: %u \n",
+ stats_context->shutdown,
+ stats_context->total_nse_cross);
+ if (buf_len > 0)
+ {
+ GNUNET_DISK_file_write (data_file, buf, buf_len);
+ }
+ GNUNET_free_non_null (buf);
+
+ buf = NULL;
+ buf_len =
+ GNUNET_asprintf (&buf, "TOTAL_NSE_EXTRA_%d: %u \n",
+ stats_context->shutdown,
+ stats_context->total_nse_extra);
+ if (buf_len > 0)
+ {
+ GNUNET_DISK_file_write (data_file, buf, buf_len);
+ }
+ GNUNET_free_non_null (buf);
+
+ buf = NULL;
+ buf_len =
+ GNUNET_asprintf (&buf, "TOTAL_NSE_DISCARDED_%d: %u \n",
+ stats_context->shutdown,
+ stats_context->total_discarded);
+ if (buf_len > 0)
+ {
+ GNUNET_DISK_file_write (data_file, buf, buf_len);
+ }
+ GNUNET_free_non_null (buf);
+
}
if (GNUNET_YES == stats_context->shutdown)
}
#endif
}
- if (0 == strcmp (name, "# flood messages sent"))
+ if (0 == strcmp (name, "# flood messages transmitted"))
{
- stats_context->total_nse_sent_messages += value;
+ stats_context->total_nse_transmitted_messages += value;
#if VERBOSE
if (data_file != NULL)
{
buf = NULL;
buf_len =
- GNUNET_asprintf (&buf, "%s %u SENT\n", GNUNET_i2s(peer), value);
+ GNUNET_asprintf (&buf, "%s %u TRANSMITTED\n",
+ GNUNET_i2s(peer), value);
if (buf_len > 0)
{
GNUNET_DISK_file_write (data_file, buf, buf_len);
}
#endif
}
+ if (0 == strcmp (name, "# cross messages"))
+ {
+ stats_context->total_nse_cross += value;
+ }
+ if (0 == strcmp (name, "# extra messages"))
+ {
+ stats_context->total_nse_extra += value;
+ }
+ if (0 == strcmp (name, "# flood messages discarded (clock skew too large)"))
+ {
+ stats_context->total_discarded += value;
+ }
}
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnecting nse service of peers\n");
disconnect_task = GNUNET_SCHEDULER_NO_TASK;
- pos = peer_head;
while (NULL != (pos = peer_head))
{
if (pos->nse_handle != NULL)