diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-02-08 14:46:17 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-02-08 14:46:17 +0000 |
commit | 2669904d8e9280390a3cf87acc574e7caef4dc19 (patch) | |
tree | 85026797c11d2c6582d058a05ae0c660987a42ea /src/dht/plugin_dhtlog_mysql_dump.c | |
parent | b9cb7a612968c7b7347b0bc598e46435ef9600a5 (diff) | |
download | gnunet-2669904d8e9280390a3cf87acc574e7caef4dc19.tar.gz gnunet-2669904d8e9280390a3cf87acc574e7caef4dc19.zip |
enable very minimal dht logging
Diffstat (limited to 'src/dht/plugin_dhtlog_mysql_dump.c')
-rw-r--r-- | src/dht/plugin_dhtlog_mysql_dump.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/dht/plugin_dhtlog_mysql_dump.c b/src/dht/plugin_dhtlog_mysql_dump.c index 1e549d115..3033be535 100644 --- a/src/dht/plugin_dhtlog_mysql_dump.c +++ b/src/dht/plugin_dhtlog_mysql_dump.c | |||
@@ -65,6 +65,10 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
65 | 65 | ||
66 | #define INSERT_ROUND_STMT "prepare insert_round from 'INSERT INTO rounds (trialuid, round_type, round_count, starttime) VALUES (@temp_trial, @rtype, @rcount, @curr_time)'" | 66 | #define INSERT_ROUND_STMT "prepare insert_round from 'INSERT INTO rounds (trialuid, round_type, round_count, starttime) VALUES (@temp_trial, @rtype, @rcount, @curr_time)'" |
67 | 67 | ||
68 | #define INSERT_ROUND_DETAILS_STMT "prepare insert_round_details from 'INSERT INTO processed_trial_rounds "\ | ||
69 | "(trialuid, round_type, round_count, starttime, endtime, num_messages, num_messages_succeeded)"\ | ||
70 | "VALUES (@temp_trial, @rtype, @rcount, @curr_time, @curr_time, @totalmsgs, @msgssucceeded)'" | ||
71 | |||
68 | #define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO extended_topology (topology_uid, uid_first, uid_second) "\ | 72 | #define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO extended_topology (topology_uid, uid_first, uid_second) "\ |
69 | "VALUES (@temp_topology, ?, ?)'" | 73 | "VALUES (@temp_topology, ?, ?)'" |
70 | 74 | ||
@@ -161,6 +165,7 @@ iopen () | |||
161 | if (PINIT (INSERT_QUERIES_STMT) || | 165 | if (PINIT (INSERT_QUERIES_STMT) || |
162 | PINIT (INSERT_ROUTES_STMT) || | 166 | PINIT (INSERT_ROUTES_STMT) || |
163 | PINIT (INSERT_ROUND_STMT) || | 167 | PINIT (INSERT_ROUND_STMT) || |
168 | PINIT (INSERT_ROUND_DETAILS_STMT) || | ||
164 | PINIT (INSERT_TRIALS_STMT) || | 169 | PINIT (INSERT_TRIALS_STMT) || |
165 | PINIT (SET_MALICIOUS_STMT) || | 170 | PINIT (SET_MALICIOUS_STMT) || |
166 | PINIT (INSERT_GENERIC_STAT_STMT) || | 171 | PINIT (INSERT_GENERIC_STAT_STMT) || |
@@ -210,6 +215,36 @@ int add_round (unsigned int round_type, unsigned int round_count) | |||
210 | } | 215 | } |
211 | 216 | ||
212 | /* | 217 | /* |
218 | * Inserts the specified round results into the | ||
219 | * dhttests.processed_round_details table | ||
220 | * | ||
221 | * @param round_type the type of round that is being started | ||
222 | * @param round_count counter for the round (if applicable) | ||
223 | * @param num_messages the total number of messages initiated | ||
224 | * @param num_messages_succeeded the number of messages that succeeded | ||
225 | * | ||
226 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | ||
227 | */ | ||
228 | int add_round_details (unsigned int round_type, unsigned int round_count, | ||
229 | unsigned int num_messages, unsigned int num_messages_succeeded) | ||
230 | { | ||
231 | int ret; | ||
232 | if (outfile == NULL) | ||
233 | return GNUNET_SYSERR; | ||
234 | |||
235 | ret = fprintf(outfile, "set @curr_time = \"%s\", @rtype = \"%u\", @rcount = \"%u\", @totalmsgs = \"%u\", @msgssucceeded = \"%u\";\n", | ||
236 | get_sql_time(), round_type, round_count, num_messages, num_messages_succeeded); | ||
237 | |||
238 | if (ret < 0) | ||
239 | return GNUNET_SYSERR; | ||
240 | ret = fprintf(outfile, "execute insert_round_details;\n"); | ||
241 | |||
242 | if (ret >= 0) | ||
243 | return GNUNET_OK; | ||
244 | return GNUNET_SYSERR; | ||
245 | } | ||
246 | |||
247 | /* | ||
213 | * Records the current topology (number of connections, time, trial) | 248 | * Records the current topology (number of connections, time, trial) |
214 | * | 249 | * |
215 | * @param num_connections how many connections are in the topology | 250 | * @param num_connections how many connections are in the topology |
@@ -821,6 +856,7 @@ libgnunet_plugin_dhtlog_mysql_dump_init (void * cls) | |||
821 | plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle)); | 856 | plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle)); |
822 | plugin->dhtlog_api->insert_trial = &add_trial; | 857 | plugin->dhtlog_api->insert_trial = &add_trial; |
823 | plugin->dhtlog_api->insert_round = &add_round; | 858 | plugin->dhtlog_api->insert_round = &add_round; |
859 | plugin->dhtlog_api->insert_round_details = &add_round_details; | ||
824 | plugin->dhtlog_api->insert_stat = &add_stat; | 860 | plugin->dhtlog_api->insert_stat = &add_stat; |
825 | plugin->dhtlog_api->insert_query = &add_query; | 861 | plugin->dhtlog_api->insert_query = &add_query; |
826 | plugin->dhtlog_api->update_trial = &update_trials; | 862 | plugin->dhtlog_api->update_trial = &update_trials; |