*/
static MYSQL *conn;
-#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid) "\
- "VALUES (?, ?, ?, ?, ?, ?, ?)"
+#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, time) "\
+ "VALUES (?, ?, ?, ?, ?, ?, ?, NOW())"
static struct StatementHandle *insert_query;
#define INSERT_ROUTES_STMT "INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\
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) ||
stmt = mysql_stmt_init(conn);
if (GNUNET_OK !=
- (ret = prepared_statement_run (insert_trial, &trial_info->trialuid,
+ (ret = prepared_statement_run (insert_trial, ¤t_trial,
MYSQL_TYPE_LONG, &trial_info->other_identifier, GNUNET_YES,
MYSQL_TYPE_LONG, &trial_info->num_nodes, GNUNET_YES,
MYSQL_TYPE_LONG, &trial_info->topology, GNUNET_YES,
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
*
/*
* Update dhttests.trials table with current server time as end time
*
- * @param trialuid trial to update
* @param gets_succeeded how many gets did the testcase report as successful
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure.
*/
int
-update_trials (unsigned long long trialuid,
- unsigned int gets_succeeded)
+update_trials (unsigned int gets_succeeded)
{
int ret;
(ret = prepared_statement_run (update_trial,
NULL,
MYSQL_TYPE_LONG, &gets_succeeded, GNUNET_YES,
- MYSQL_TYPE_LONGLONG, &trialuid, GNUNET_YES,
+ MYSQL_TYPE_LONGLONG, ¤t_trial, GNUNET_YES,
-1)))
{
if (ret == GNUNET_SYSERR)
/*
* Update dhttests.trials table with total connections information
*
- * @param trialuid the trialuid to update
* @param totalConnections the number of connections
*
* @return GNUNET_OK on success, GNUNET_SYSERR on failure.
*/
int
-add_connections (unsigned long long trialuid, unsigned int totalConnections)
+add_connections (unsigned int totalConnections)
{
int ret;
&totalConnections,
GNUNET_YES,
MYSQL_TYPE_LONGLONG,
- &trialuid, GNUNET_YES, -1)))
+ ¤t_trial, GNUNET_YES, -1)))
{
if (ret == GNUNET_SYSERR)
{
if (from_node != NULL)
get_node_uid (&from_uid, &from_node->hashPubKey);
- else
- from_uid = 0;
if (to_node != NULL)
get_node_uid (&to_uid, &to_node->hashPubKey);
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
+
}
/*
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
}
/*
}
if (ret > 0)
return GNUNET_OK;
- else
- return GNUNET_SYSERR;
- return GNUNET_OK;
+ return GNUNET_SYSERR;
}
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);