*/
static struct GNUNET_TIME_Absolute connect_last_time;
+/**
+ * At what time did we start the hostkey creation process.
+ */
+static struct GNUNET_TIME_Absolute hostkey_start_time;
+
+/**
+ * At what time did we start the peer startup process.
+ */
+static struct GNUNET_TIME_Absolute peer_start_time;
+
/**
* Boolean value, should the driver issue find peer requests
* (GNUNET_YES) or should it be left to the service (GNUNET_NO)
*/
static unsigned int do_find_peer;
+/**
+ * Whether or not to insert gauger data.
+ */
+static unsigned int insert_gauger_data;
+
#if ONLY_TESTING
/**
* Are we currently trying to connect two peers repeatedly?
free_meter (get_meter);
GNUNET_asprintf (&temp_get_string,
- "DHT Successful GETs (trial %d)", trial_to_run);
+ "DHT Successful GETs", trial_to_run);
GNUNET_asprintf (&revision_str, "%llu", revision);
- GAUGER_ID("DHT_TESTING", temp_get_string, cumulative_successful_gets / (double)cumulative_num_gets, "percent successful", revision_str);
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING", temp_get_string, cumulative_successful_gets / (double)cumulative_num_gets, "percent successful", revision_str);
fprintf (
stderr,
"Finished trial, had %llu successful gets out of %llu total, %.2f percent succeeded\n",
static int
remove_peer_count(void *cls, const GNUNET_HashCode * key, void *value)
{
- struct FindPeerContext *find_peer_ctx = cls;
struct PeerCount *peer_count = value;
- GNUNET_CONTAINER_heap_remove_node (find_peer_ctx->peer_min_heap,
- peer_count->heap_node);
+ GNUNET_CONTAINER_heap_remove_node (peer_count->heap_node);
GNUNET_free(peer_count);
return GNUNET_YES;
{
struct TestGetContext *test_get = cls;
- if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0)
gets_failed++;
else
cumulative_successful_gets++;
outstanding_puts--;
puts_completed++;
- if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT)
+ if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0)
fprintf (stderr, "PUT Request failed!\n");
/* Reset the daemon (which peer to insert at) for later put request iterations */
*/
static void
malicious_disconnect_task(void *cls,
- const struct GNUNET_SCHEDULER_TaskContext * tc)
+ const struct GNUNET_SCHEDULER_TaskContext * tc)
{
struct MaliciousContext *ctx = cls;
outstanding_malicious--;
{
fprintf (stderr, "Finished setting all malicious peers up!\n");
}
-
}
/**
switch (ctx->malicious_type)
{
case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET:
- GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency);
- GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+ GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency, &malicious_done_task, ctx);
break;
case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
- GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency);
- GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+ GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency, &malicious_done_task, ctx);
break;
case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP:
- GNUNET_DHT_set_malicious_dropper (ctx->dht_handle);
- GNUNET_SCHEDULER_add_now (&malicious_done_task, ctx);
+ GNUNET_DHT_set_malicious_dropper (ctx->dht_handle, &malicious_done_task, ctx);
break;
default:
break;
*/
static void
topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
- const struct GNUNET_PeerIdentity *second, uint32_t distance,
- const struct GNUNET_CONFIGURATION_Handle *first_cfg,
- const struct GNUNET_CONFIGURATION_Handle *second_cfg,
- struct GNUNET_TESTING_Daemon *first_daemon,
- struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
+ const struct GNUNET_PeerIdentity *second, uint32_t distance,
+ const struct GNUNET_CONFIGURATION_Handle *first_cfg,
+ const struct GNUNET_CONFIGURATION_Handle *second_cfg,
+ struct GNUNET_TESTING_Daemon *first_daemon,
+ struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg)
{
struct TopologyIteratorContext *topo_ctx;
unsigned long long duration;
unsigned long long total_duration;
unsigned int new_connections;
unsigned int new_failed_connections;
- double conns_per_sec_recent;
- double conns_per_sec_total;
- double failed_conns_per_sec_recent;
- double failed_conns_per_sec_total;
+ long double conns_per_sec_recent;
+ long double conns_per_sec_total;
+ long double failed_conns_per_sec_recent;
+ long double failed_conns_per_sec_total;
char *temp_conn_string;
char *temp_conn_failed_string;
char *revision_str;
GNUNET_TIME_absolute_get ()).rel_value
/ 1000;
- failed_conns_per_sec_recent = (double) new_failed_connections / duration;
- failed_conns_per_sec_total = (double) failed_connections / total_duration;
- conns_per_sec_recent = (double) new_connections / duration;
- conns_per_sec_total = (double) total_connections / total_duration;
+ failed_conns_per_sec_recent = (long double) new_failed_connections / duration;
+ failed_conns_per_sec_total = (long double) failed_connections / total_duration;
+ conns_per_sec_recent = (long double) new_connections / duration;
+ conns_per_sec_total = (long double) total_connections / total_duration;
GNUNET_log (
GNUNET_ERROR_TYPE_WARNING,
"Recent: %.2f/s, Total: %.2f/s, Recent failed: %.2f/s, total failed %.2f/s\n",
- conns_per_sec_recent, CONN_UPDATE_DURATION,
+ conns_per_sec_recent,
conns_per_sec_total, failed_conns_per_sec_recent,
failed_conns_per_sec_total);
connect_last_time = GNUNET_TIME_absolute_get ();
= GNUNET_TIME_absolute_get_difference (connect_start_time,
GNUNET_TIME_absolute_get ()).rel_value
/ 1000;
- failed_conns_per_sec_total = (double) failed_connections / total_duration;
- conns_per_sec_total = (double) total_connections / total_duration;
+ failed_conns_per_sec_total = (long double) failed_connections / total_duration;
+ conns_per_sec_total = (long double) total_connections / total_duration;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Overall connection info --- Total: %u, Total Failed %u/s\n",
total_connections, failed_connections);
conns_per_sec_total, failed_conns_per_sec_total);
GNUNET_asprintf (&temp_conn_string,
- "DHT Profiler Connection (trial %d)",
+ "DHT Profiler Connection/s",
trial_to_run);
GNUNET_asprintf (&temp_conn_failed_string,
- "DHT Profiler Connection failed (trial %d)",
+ "DHT Profiler Connection/s failed",
trial_to_run);
GNUNET_asprintf (&revision_str, "%llu", revision);
- GAUGER_ID("DHT_TESTING", temp_conn_string, conns_per_sec_total, "conns/s", revision_str);
- GAUGER_ID("DHT_TESTING", temp_conn_failed_string, failed_conns_per_sec_total, "failed_conns", revision_str);
+
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING", temp_conn_string, (float)conns_per_sec_total, "conns/s", revision_str);
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING", temp_conn_failed_string, (float)failed_conns_per_sec_total, "failed_conns", revision_str);
+
GNUNET_free(temp_conn_string);
GNUNET_free(temp_conn_failed_string);
GNUNET_asprintf (&temp_conn_string,
- "DHT Profiler Total Connections (trial %d)",
+ "DHT Profiler Total Connections",
trial_to_run);
GNUNET_asprintf (
&temp_conn_failed_string,
- "DHT Profiler Total Connections failed (trial %d)",
+ "DHT Profiler Total Connections failed",
trial_to_run);
- GAUGER_ID("DHT_TESTING", temp_conn_string, total_connections, "conns", revision_str);
- GAUGER_ID("DHT_TESTING", temp_conn_failed_string, failed_connections, "failed conns", revision_str);
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING", temp_conn_string, total_connections, "conns", revision_str);
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING", temp_conn_failed_string, failed_connections, "failed conns", revision_str);
GNUNET_free(temp_conn_string);
GNUNET_free(temp_conn_failed_string);
GNUNET_free(revision_str);
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Daemon *d, const char *emsg)
{
+ char *revision_str;
if (emsg != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
#endif
GNUNET_SCHEDULER_cancel (die_task);
+ GNUNET_asprintf (&revision_str, "%llu", revision);
+ if (GNUNET_YES == insert_gauger_data)
+ GAUGER_ID("DHT_TESTING",
+ "peer_startup_time",
+ GNUNET_TIME_absolute_get_duration(peer_start_time).rel_value / (double)num_peers,
+ "ms/peer", revision_str);
+ GNUNET_free(revision_str);
+
expected_connections = UINT_MAX;
if ((pg != NULL) && (peers_left == 0))
{
expected_connections);
}
- if (expected_connections == GNUNET_SYSERR)
+ if (expected_connections == 0)
{
die_task
= GNUNET_SCHEDULER_add_now (&end_badly,
static void
create_topology()
{
+ unsigned int create_expected_connections;
peers_left = num_peers; /* Reset counter */
- if (GNUNET_TESTING_create_topology (pg, topology, blacklist_topology,
- blacklist_transports) != GNUNET_SYSERR)
+ create_expected_connections = GNUNET_TESTING_create_topology (pg, topology, blacklist_topology,
+ blacklist_transports);
+ if (create_expected_connections > 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Topology set up, now starting peers!\n");
+ "Topology set up, have %u expected connections, now starting peers!\n", create_expected_connections);
GNUNET_TESTING_daemons_continue_startup (pg);
+ peer_start_time = GNUNET_TIME_absolute_get();
}
else
{
hostkey_callback(void *cls, const struct GNUNET_PeerIdentity *id,
struct GNUNET_TESTING_Daemon *d, const char *emsg)
{
+ char * revision_str;
if (emsg != NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"All %d hostkeys created, now creating topology!\n",
num_peers);
+
+ GNUNET_asprintf (&revision_str, "%llu", revision);
+ if (GNUNET_YES == insert_gauger_data)
+ {
+ if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (config, "TESTING",
+ "HOSTKEYSFILE"))
+ {
+ GAUGER_ID("DHT_TESTING",
+ "HOSTKEY_GENERATION",
+ GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers,
+ "ms/hostkey", revision_str);
+ }
+ else
+ {
+ GAUGER_ID("DHT_TESTING",
+ "HOSTKEY_GENERATION_REAL",
+ GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers,
+ "ms/hostkey", revision_str);
+ }
+ }
+
+ GNUNET_free(revision_str);
+
GNUNET_SCHEDULER_cancel (die_task);
/* Set up task in case topology creation doesn't finish
* within a reasonable amount of time */
while (count < frstat.st_size - 1)
{
count++;
- /* if (((data[count] == '\n') || (data[count] == '\0')) && (buf != &data[count]))*/
if (((data[count] == '\n')) && (buf != &data[count]))
{
data[count] = '\0';
if (3 == ret)
{
GNUNET_log (
- GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_ERROR_TYPE_DEBUG,
"Successfully read host %s, port %d and user %s from file\n",
temphost->hostname, temphost->port,
temphost->username);
buf = &data[count + 1];
continue;
}
- /* temphost->hostname = buf; */
temphost->next = hosts;
hosts = temphost;
buf = &data[count + 1];
"do_find_peer"))
do_find_peer = GNUNET_YES;
+ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
+ "insert_gauger_data"))
+ insert_gauger_data = GNUNET_YES;
+
if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht",
"republish"))
in_dht_replication = GNUNET_YES;
put_meter = create_meter (num_puts, "Puts completed ", GNUNET_YES);
get_meter = create_meter (num_gets, "Gets completed ", GNUNET_YES);
+ hostkey_start_time = GNUNET_TIME_absolute_get();
pg
= GNUNET_TESTING_daemons_start (
cfg,