From 900cc413d1504f62fa5bcd55058c7bef91e40993 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 4 Apr 2011 14:20:33 +0000 Subject: [PATCH] rewriting perf test to match new API --- now it fails... --- src/datastore/perf_datastore_api.c | 69 +++++++----------------------- 1 file changed, 16 insertions(+), 53 deletions(-) diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 3b89ad233..f8d68a37a 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c @@ -99,10 +99,6 @@ struct CpsRunContext int j; unsigned long long size; int i; - - GNUNET_HashCode key; - size_t esize; - char data[65536]; }; @@ -165,33 +161,11 @@ remove_next(void *cls, fprintf (stderr, "D"); #endif GNUNET_assert (GNUNET_OK == success); - GNUNET_SCHEDULER_add_continuation (&run_continuation, - crc, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); -} - - - -static void -do_delete (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) -{ - struct CpsRunContext *crc = cls; - - stored_bytes -= crc->esize; - stored_entries--; - stored_ops++; - GNUNET_DATASTORE_remove (datastore, - &crc->key, - crc->esize, - crc->data, - 1, 1, TIMEOUT, - &remove_next, - crc); + GNUNET_SCHEDULER_add_now (&run_continuation, + crc); } - static void delete_value (void *cls, const GNUNET_HashCode * key, @@ -204,32 +178,22 @@ delete_value (void *cls, expiration, uint64_t uid) { struct CpsRunContext *crc = cls; - - if (key == NULL) - { - if (stored_bytes < MAX_SIZE) - { - crc->phase = RP_REPORT; - GNUNET_SCHEDULER_add_continuation (&run_continuation, - crc, - GNUNET_SCHEDULER_REASON_PREREQ_DONE); - return; - } - GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_HIGH, - &do_delete, - crc); - return; - } + + GNUNET_assert (NULL != key); + stored_ops++; + stored_bytes -= size; + stored_entries--; stored_ops++; if (stored_bytes < MAX_SIZE) - { - GNUNET_DATASTORE_iterate_get_next (datastore); - return; - } - crc->key = *key; - crc->esize = size; - memcpy (crc->data, data, size); - GNUNET_DATASTORE_iterate_get_next (datastore); + crc->phase = RP_PUT; + GNUNET_assert (NULL != + GNUNET_DATASTORE_remove (datastore, + key, + size, + data, + 1, 1, TIMEOUT, + &remove_next, + crc)); } @@ -315,7 +279,6 @@ run_continuation (void *cls, } - static void run_tests (void *cls, int success, -- 2.25.1