aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/perf_plugin_datastore.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-17 20:14:47 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-17 20:14:47 +0000
commit4524a128f4f6e72a802dd7b1c4130d5c746467f2 (patch)
tree5ce6870069c9aa55e84efd7e0cadd6ec3cea6c11 /src/datastore/perf_plugin_datastore.c
parente452c722e830617352fed1ee003248ce00c108f4 (diff)
downloadgnunet-4524a128f4f6e72a802dd7b1c4130d5c746467f2.tar.gz
gnunet-4524a128f4f6e72a802dd7b1c4130d5c746467f2.zip
stuff
Diffstat (limited to 'src/datastore/perf_plugin_datastore.c')
-rw-r--r--src/datastore/perf_plugin_datastore.c110
1 files changed, 56 insertions, 54 deletions
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 54f1eb90c..fce5ef9ea 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -36,9 +36,10 @@
36 * those take too long to run them in the usual "make check" 36 * those take too long to run them in the usual "make check"
37 * sequence. Hence the value used for shipping is tiny. 37 * sequence. Hence the value used for shipping is tiny.
38 */ 38 */
39#define MAX_SIZE 1024LL * 1024 * 128 39#define MAX_SIZE 1024LL * 1024
40/* * 128 */
40 41
41#define ITERATIONS 10 42#define ITERATIONS 2
42 43
43/** 44/**
44 * Number of put operations equivalent to 1/10th of MAX_SIZE 45 * Number of put operations equivalent to 1/10th of MAX_SIZE
@@ -170,12 +171,59 @@ iterateDummy (void *cls,
170 &test, crc); 171 &test, crc);
171 return GNUNET_OK; 172 return GNUNET_OK;
172 } 173 }
174 fprintf (stderr, ".");
173 crc->api->next_request (next_cls, 175 crc->api->next_request (next_cls,
174 GNUNET_NO); 176 GNUNET_NO);
175 return GNUNET_OK; 177 return GNUNET_OK;
176} 178}
177 179
178 180
181
182/**
183 * Function called when the service shuts
184 * down. Unloads our datastore plugin.
185 *
186 * @param api api to unload
187 */
188static void
189unload_plugin (struct GNUNET_DATASTORE_PluginFunctions * api,
190 struct GNUNET_CONFIGURATION_Handle *cfg)
191{
192 char *name;
193 char *libname;
194
195 if (GNUNET_OK !=
196 GNUNET_CONFIGURATION_get_value_string (cfg,
197 "DATASTORE", "DATABASE", &name))
198 {
199 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
200 _("No `%s' specified for `%s' in configuration!\n"),
201 "DATABASE",
202 "DATASTORE");
203 return;
204 }
205 GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
206 GNUNET_break (NULL == GNUNET_PLUGIN_unload (libname, api));
207 GNUNET_free (libname);
208 GNUNET_free (name);
209}
210
211
212
213/**
214 * Last task run during shutdown. Disconnects us from
215 * the transport and core.
216 */
217static void
218cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
219{
220 struct CpsRunContext *crc = cls;
221
222 unload_plugin (crc->api, crc->cfg);
223 GNUNET_free (crc);
224}
225
226
179static void 227static void
180test (void *cls, 228test (void *cls,
181 const struct GNUNET_SCHEDULER_TaskContext *tc) 229 const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -237,6 +285,12 @@ test (void *cls,
237 break; 285 break;
238 case RP_DONE: 286 case RP_DONE:
239 crc->api->drop (crc->api->cls); 287 crc->api->drop (crc->api->cls);
288 GNUNET_SCHEDULER_add_delayed (crc->sched,
289 GNUNET_YES,
290 GNUNET_SCHEDULER_PRIORITY_IDLE,
291 GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
292 GNUNET_TIME_UNIT_ZERO,
293 &cleaning_task, crc);
240 break; 294 break;
241 } 295 }
242} 296}
@@ -276,52 +330,6 @@ load_plugin (struct GNUNET_CONFIGURATION_Handle *cfg,
276} 330}
277 331
278 332
279/**
280 * Function called when the service shuts
281 * down. Unloads our datastore plugin.
282 *
283 * @param api api to unload
284 */
285static void
286unload_plugin (struct GNUNET_DATASTORE_PluginFunctions * api,
287 struct GNUNET_CONFIGURATION_Handle *cfg)
288{
289 char *name;
290 char *libname;
291
292 if (GNUNET_OK !=
293 GNUNET_CONFIGURATION_get_value_string (cfg,
294 "DATASTORE", "DATABASE", &name))
295 {
296 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
297 _("No `%s' specified for `%s' in configuration!\n"),
298 "DATABASE",
299 "DATASTORE");
300 return;
301 }
302 GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
303 GNUNET_break (NULL == GNUNET_PLUGIN_unload (libname, api));
304 GNUNET_free (libname);
305 GNUNET_free (name);
306}
307
308
309
310/**
311 * Last task run during shutdown. Disconnects us from
312 * the transport and core.
313 */
314static void
315cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
316{
317 struct CpsRunContext *crc = cls;
318
319 unload_plugin (crc->api, crc->cfg);
320 GNUNET_free (crc);
321}
322
323
324
325static void 333static void
326run (void *cls, 334run (void *cls,
327 struct GNUNET_SCHEDULER_Handle *s, 335 struct GNUNET_SCHEDULER_Handle *s,
@@ -344,12 +352,6 @@ run (void *cls,
344 GNUNET_SCHEDULER_PRIORITY_KEEP, 352 GNUNET_SCHEDULER_PRIORITY_KEEP,
345 GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, 353 GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
346 &test, crc); 354 &test, crc);
347 GNUNET_SCHEDULER_add_delayed (s,
348 GNUNET_YES,
349 GNUNET_SCHEDULER_PRIORITY_IDLE,
350 GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
351 GNUNET_TIME_UNIT_FOREVER_REL,
352 &cleaning_task, crc);
353} 355}
354 356
355 357