*/
int (*insert_round) (unsigned int round_type, unsigned int round_count);
+ /*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+ int (*insert_round_details) (unsigned int round_type, unsigned int round_count,
+ unsigned int num_messages, unsigned int num_messages_succeeded);
+
/*
* Update dhttests.trials table with total connections information
*
#define DEFAULT_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5)
/* Timeout for waiting for (individual) replies to get requests */
-#define DEFAULT_GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90)
+#define DEFAULT_GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10)
#define DEFAULT_TOPOLOGY_CAPTURE_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90)
/**
* How long to send find peer requests, once the settle time
* is over don't send any more out!
- *
- * TODO: Add option for settle time and find peer sending time?
*/
struct GNUNET_TIME_Absolute endtime;
*/
static unsigned int failed_connections;
+/**
+ * If GNUNET_YES, only log PUT/GET round data to mysql, otherwise
+ * log everything (including each dht service logging).
+ */
+static unsigned int dhtlog_minimal;
+
/* Task handle to use to schedule shutdown if something goes wrong */
GNUNET_SCHEDULER_TaskIdentifier die_task;
struct TopologyIteratorContext *topo_ctx = cls;
if ((first != NULL) && (second != NULL))
{
- /* GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "According to CORE, peer %s is connected to %s\n", GNUNET_i2s(first), GNUNET_h2s(&second->hashPubKey));*/
if ((topo_ctx->peers_seen != NULL) && (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(topo_ctx->peers_seen, &first->hashPubKey)))
{
GNUNET_CONTAINER_multihashmap_put(topo_ctx->peers_seen, &first->hashPubKey, NULL, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
topo_ctx->total_peers++;
}
topo_ctx->total_connections++;
- if ((GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(config, "dht_testing", "mysql_logging")) ||
- (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(config, "dht_testing", "mysql_logging_extended")))
+ if ((GNUNET_NO == dhtlog_minimal) && (dhtlog_handle != NULL))
dhtlog_handle->insert_extended_topology(first, second);
}
else
}
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Added %d peers to heap, total size %d\n", count_added, GNUNET_CONTAINER_heap_get_size(find_peer_context->peer_min_heap));
GNUNET_SCHEDULER_add_delayed(DEFAULT_PEER_DISCONNECT_TIMEOUT, &schedule_churn_get_topology, find_peer_context);
- //GNUNET_TESTING_get_topology (pg, &count_peers_churn_cb, find_peer_context);
}
else
{
die_task = GNUNET_SCHEDULER_add_delayed (calc_timeout,
&end_badly, "from do gets (churn_complete)");
GNUNET_SCHEDULER_add_delayed(DEFAULT_PEER_DISCONNECT_TIMEOUT, &capture_current_topology, topo_ctx);
+ dhtlog_handle->insert_round(DHT_ROUND_GET, rounds_finished);
}
else
{
calc_timeout = GNUNET_TIME_relative_add(calc_timeout, DEFAULT_PEER_DISCONNECT_TIMEOUT);
die_task = GNUNET_SCHEDULER_add_delayed (calc_timeout,
&end_badly, "from do gets (churn_complete)");
- if (dhtlog_handle != NULL)
- dhtlog_handle->insert_round(DHT_ROUND_GET, rounds_finished);
GNUNET_SCHEDULER_add_delayed(DEFAULT_PEER_DISCONNECT_TIMEOUT, &do_get, all_gets);
}
}
if ((gets_completed + gets_failed == num_gets) && (outstanding_gets == 0))
{
fprintf(stderr, "Canceling die task (get_stop_finished) %llu gets completed, %llu gets failed\n", gets_completed, gets_failed);
+ if ((GNUNET_YES == dhtlog_minimal) && (NULL != dhtlog_handle))
+ dhtlog_handle->insert_round_details(DHT_ROUND_GET, rounds_finished, num_gets, gets_completed);
GNUNET_SCHEDULER_cancel(die_task);
reset_meter(put_meter);
reset_meter(get_meter);
*/
if (rounds_finished == total_rounds - 1) /* Everything is finished, end testing */
{
- if (dhtlog_handle != NULL)
+ if ((dhtlog_handle != NULL) && (GNUNET_NO == dhtlog_minimal))
{
topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
topo_ctx->cont = &log_dht_statistics;
{
GNUNET_assert(outstanding_puts == 0);
GNUNET_SCHEDULER_cancel (die_task);
- if (dhtlog_handle != NULL)
+ if ((dhtlog_handle != NULL) && (GNUNET_NO == dhtlog_minimal))
{
topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
topo_ctx->cont = &do_get;
struct TopologyIteratorContext *topo_ctx;
struct FindPeerContext *find_peer_context;
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "In continue_puts_and_gets\n");
- if (dhtlog_handle != NULL)
+ if ((dhtlog_handle != NULL) && (GNUNET_NO == dhtlog_minimal))
{
if (settle_time >= 180 * 2)
max = (settle_time / 180) - 2;
* Get DHT specific testing options.
*/
if ((GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht_testing", "mysql_logging")) ||
- (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht_testing", "mysql_logging_extended")))
+ (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht_testing", "mysql_logging_extended")) ||
+ (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht_testing", "mysql_logging_minimal")))
{
+ if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht_testing", "mysql_logging_minimal"))
+ dhtlog_minimal = GNUNET_YES;
+
dhtlog_handle = GNUNET_DHTLOG_connect(cfg);
if (dhtlog_handle == NULL)
{
return GNUNET_OK;
}
+/*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round_details (unsigned int round_type, unsigned int round_count,
+ unsigned int num_messages, unsigned int num_messages_succeded)
+{
+ return GNUNET_OK;
+}
+
/*
* Inserts the specified dhtkey into the dhttests.dhtkeys table,
* stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->add_generic_stat = &add_generic_stat;
plugin->dhtlog_api->insert_round = &add_round;
+ plugin->dhtlog_api->insert_round_details = &add_round_details;
plugin->dhtlog_api->insert_stat = &insert_stat;
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_query = &add_query;
static struct StatementHandle *insert_round;
+#define INSERT_ROUND_DETAILS_STMT "INSERT INTO rounds (trialuid, round_type, round_count, starttime, endtime, num_messages, num_messages_succeeded) "\
+ "VALUES (?, ?, ?, NOW(), NOW(), ?, ?)"
+
+static struct StatementHandle *insert_round_details;
+
#define INSERT_TRIALS_STMT "INSERT INTO trials"\
"(starttime, other_trial_identifier, numnodes, topology,"\
"topology_percentage, topology_probability,"\
PINIT (insert_route, INSERT_ROUTES_STMT) ||
PINIT (insert_trial, INSERT_TRIALS_STMT) ||
PINIT (insert_round, INSERT_ROUNDS_STMT) ||
+ PINIT (insert_round, INSERT_ROUND_DETAILS_STMT) ||
PINIT (insert_stat, INSERT_STAT_STMT) ||
PINIT (insert_generic_stat, INSERT_GENERIC_STAT_STMT) ||
PINIT (insert_node, INSERT_NODES_STMT) ||
return ret;
}
+/*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round_details (unsigned int round_type, unsigned int round_count,
+ unsigned int num_messages, unsigned int num_messages_succeeded)
+{
+ MYSQL_STMT *stmt;
+ int ret;
+
+ stmt = mysql_stmt_init(conn);
+ ret = prepared_statement_run (insert_round_details,
+ NULL,
+ MYSQL_TYPE_LONGLONG, ¤t_trial, GNUNET_YES,
+ MYSQL_TYPE_LONG, &round_type, GNUNET_YES,
+ MYSQL_TYPE_LONG, &round_count, GNUNET_YES,
+ MYSQL_TYPE_LONG, &num_messages, GNUNET_YES,
+ MYSQL_TYPE_LONG, &num_messages_succeeded, GNUNET_YES,
+ -1);
+ mysql_stmt_close(stmt);
+ if (ret != GNUNET_OK)
+ return GNUNET_SYSERR;
+ return ret;
+}
+
/*
* Inserts the specified stats into the dhttests.node_statistics table
*
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_stat = &add_stat;
plugin->dhtlog_api->insert_round = &add_round;
+ plugin->dhtlog_api->insert_round_details = &add_round_details;
plugin->dhtlog_api->add_generic_stat = &add_generic_stat;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
prepared_statement_close(insert_route);
prepared_statement_close(insert_trial);
prepared_statement_close(insert_round);
+ prepared_statement_close(insert_round_details);
prepared_statement_close(insert_node);
prepared_statement_close(insert_dhtkey);
prepared_statement_close(update_trial);
#define INSERT_ROUND_STMT "prepare insert_round from 'INSERT INTO rounds (trialuid, round_type, round_count, starttime) VALUES (@temp_trial, @rtype, @rcount, @curr_time)'"
+#define INSERT_ROUND_DETAILS_STMT "prepare insert_round_details from 'INSERT INTO processed_trial_rounds "\
+ "(trialuid, round_type, round_count, starttime, endtime, num_messages, num_messages_succeeded)"\
+ "VALUES (@temp_trial, @rtype, @rcount, @curr_time, @curr_time, @totalmsgs, @msgssucceeded)'"
+
#define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO extended_topology (topology_uid, uid_first, uid_second) "\
"VALUES (@temp_topology, ?, ?)'"
if (PINIT (INSERT_QUERIES_STMT) ||
PINIT (INSERT_ROUTES_STMT) ||
PINIT (INSERT_ROUND_STMT) ||
+ PINIT (INSERT_ROUND_DETAILS_STMT) ||
PINIT (INSERT_TRIALS_STMT) ||
PINIT (SET_MALICIOUS_STMT) ||
PINIT (INSERT_GENERIC_STAT_STMT) ||
return GNUNET_SYSERR;
}
+/*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round_details (unsigned int round_type, unsigned int round_count,
+ unsigned int num_messages, unsigned int num_messages_succeeded)
+{
+ int ret;
+ if (outfile == NULL)
+ return GNUNET_SYSERR;
+
+ ret = fprintf(outfile, "set @curr_time = \"%s\", @rtype = \"%u\", @rcount = \"%u\", @totalmsgs = \"%u\", @msgssucceeded = \"%u\";\n",
+ get_sql_time(), round_type, round_count, num_messages, num_messages_succeeded);
+
+ if (ret < 0)
+ return GNUNET_SYSERR;
+ ret = fprintf(outfile, "execute insert_round_details;\n");
+
+ if (ret >= 0)
+ return GNUNET_OK;
+ return GNUNET_SYSERR;
+}
+
/*
* Records the current topology (number of connections, time, trial)
*
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_round = &add_round;
+ plugin->dhtlog_api->insert_round_details = &add_round_details;
plugin->dhtlog_api->insert_stat = &add_stat;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
}
+/*
+ * Inserts the specified round results into the
+ * dhttests.processed_round_details table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ * @param num_messages the total number of messages initiated
+ * @param num_messages_succeeded the number of messages that succeeded
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round_details (unsigned int round_type, unsigned int round_count,
+ unsigned int num_messages, unsigned int num_messages_succeeded)
+{
+ int ret;
+ if (outfile == NULL)
+ return GNUNET_SYSERR;
+
+ ret = fprintf(outfile, "insert into processed_trial_rounds (trialuid, round_type, round_count, starttime, endtime, num_messages, num_messages_succeeded) values (@temp_trial, \"%u\", \"%u\", \"%s\", \"%s\", \"%u\", \"%u\");\n",
+ round_type, round_count, get_sql_time(), get_sql_time(), num_messages, num_messages_succeeded);
+
+ if (ret >= 0)
+ return GNUNET_OK;
+ return GNUNET_SYSERR;
+}
+
/*
* Records a connection between two peers in the current topology
*
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_stat = &add_stat;
plugin->dhtlog_api->insert_round = &add_round;
+ plugin->dhtlog_api->insert_round_details = &add_round_details;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
plugin->dhtlog_api->insert_route = &add_route;
#endif
ret = api->insert_round(401, 507);
CHECK(ret);
+ ret = api->insert_round_details(402, 507, 1123, 985);
+ CHECK(ret);
#if VERBOSE
fprintf(stderr, "Insert round succeeded!\n");
#endif