gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8733 - in gnunet: . src/datastore


From: gnunet
Subject: [GNUnet-SVN] r8733 - in gnunet: . src/datastore
Date: Fri, 17 Jul 2009 06:59:05 -0600

Author: grothoff
Date: 2009-07-17 06:59:05 -0600 (Fri, 17 Jul 2009)
New Revision: 8733

Modified:
   gnunet/configure.ac
   gnunet/src/datastore/perf_datastore_api.c
Log:
sthuff

Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2009-07-17 12:41:48 UTC (rev 8732)
+++ gnunet/configure.ac 2009-07-17 12:59:05 UTC (rev 8733)
@@ -711,20 +711,7 @@
 
 GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
 GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
-dnl TODO insert a proper check here
-AC_CACHE_CHECK([whether -export-symbols-regex works],
- gn_cv_export_symbols_regex_works, 
- [
-  case "$host_os" in
-  mingw*) gn_cv_export_symbols_regex_works=no;;
-  *) gn_cv_export_symbols_regex_works=yes;;
-  esac
- ])
-if test "x$gn_cv_export_symbols_regex_works" = "xyes"
-then
- GN_LIB_LDFLAGS="$GN_LIB_LDFLAGS -export-symbols-regex 
\"GNUNET_@<:@a-zA-Z0-9_@:>@*\""
- GN_PLUGIN_LDFLAGS="$GN_PLUGIN_LDFLAGS -export-symbols-regex 
\"@<:@a-zA-Z0-9_@:>@*\""
-fi
+
 AC_SUBST(GN_LIB_LDFLAGS)
 AC_SUBST(GN_PLUGIN_LDFLAGS)
 AC_SUBST(GN_INTLINCL)

Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c   2009-07-17 12:41:48 UTC (rev 
8732)
+++ gnunet/src/datastore/perf_datastore_api.c   2009-07-17 12:59:05 UTC (rev 
8733)
@@ -111,36 +111,12 @@
 
 static int ok;
 
-static int
-putValue (int i, int k)
-{
-
-  return GNUNET_OK;
-}
-
-
-static void
-iterate_delete (void *cls,
-               const GNUNET_HashCode * key,
-               uint32_t size,
-               const void *data,
-               uint32_t type,
-               uint32_t priority,
-               uint32_t anonymity,
-               struct GNUNET_TIME_Absolute
-               expiration, uint64_t uid)
-{
-  GNUNET_DATASTORE_remove (datastore, key, size, data, NULL, NULL);
-}
-
-
 enum RunPhase
   {
     RP_DONE = 0,
     RP_PUT,
     RP_CUT,
-    RP_REPORT,
-    RP_END
+    RP_REPORT
   };
 
 
@@ -152,10 +128,6 @@
   int j;
   unsigned long long size;
   int i;
-
-
-  GNUNET_HashCode key;
-  int *iptr;
 };
 
 
@@ -172,6 +144,8 @@
               int success,
               const char *msg)
 {
+  static int ic;
+
   struct CpsRunContext *crc = cls;
   if (GNUNET_OK != success)
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -182,9 +156,19 @@
   if (ic % REP_FREQ == 0)
     fprintf (stderr, "I");
 #endif
-  stored_bytes += size;
+  stored_bytes += crc->size;
   stored_ops++;
   stored_entries++;
+  crc->j++;
+  if (crc->j == PUT_10)
+    {
+      crc->j = 0;
+      crc->i++;
+      if (crc->i == ITERATIONS)
+       crc->phase = RP_DONE;
+      else
+       crc->phase = RP_CUT;
+    }
   GNUNET_SCHEDULER_add_continuation (crc->sched,
                                     GNUNET_NO,
                                     &run_continuation,
@@ -192,6 +176,61 @@
                                     GNUNET_SCHEDULER_REASON_PREREQ_DONE);
 }
 
+
+/**
+ * Continuation called to notify client about result of the
+ * operation.
+ *
+ * @param cls closure
+ * @param success GNUNET_SYSERR on failure
+ * @param msg NULL on success, otherwise an error message
+ */
+static void 
+remove_next(void *cls,
+           int success,
+           const char *msg)
+{
+  GNUNET_assert (GNUNET_OK == success);
+}
+
+
+static void 
+delete_value (void *cls,
+            const GNUNET_HashCode * key,
+            uint32_t size,
+            const void *data,
+            uint32_t type,
+            uint32_t priority,
+            uint32_t anonymity,
+            struct GNUNET_TIME_Absolute
+            expiration, uint64_t uid)
+{
+  struct CpsRunContext *crc = cls;
+
+  /* FIXME: should probably abort deletion iteration
+     earlier (to not delete everything...) */
+  if (key == NULL)
+    {
+      crc->phase = RP_REPORT;
+      /* FIXME: should wait for all "remove_next" calls
+        to complete before going back to the run_continuation */
+      GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                        GNUNET_NO,
+                                        &run_continuation,
+                                        crc,
+                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+      return;
+    }
+  GNUNET_DATASTORE_remove (datastore,
+                          key,
+                          size,
+                          data,
+                          &remove_next,
+                          crc);
+}
+
+
+
 static void
 run_continuation (void *cls,
                  const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -199,7 +238,6 @@
   struct CpsRunContext *crc = cls;
   size_t size;
   static GNUNET_HashCode key;
-  static int ic;
   static char data[65536];
   int i;
   int k;
@@ -208,14 +246,14 @@
   switch (crc->phase)
     {
     case RP_PUT:
-      memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
+      memset (&key, 256 - crc->i, sizeof (GNUNET_HashCode));
       i = crc->j;
       k = crc->i;
       /* most content is 32k */
       size = 32 * 1024;
       if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0)  /* 
but some of it is less! */
        size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
-      size = size - (size & 7);     /* always multiple of 8 */
+      crc->size = size = size - (size & 7);     /* always multiple of 8 */
       GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
       memset (data, i, size);
       if (i > 255)
@@ -235,23 +273,22 @@
                            TIMEOUT,
                            &check_success, 
                            crc);
-      crc->j++;
-      if (crc->j < PUT_10)
-       break;
-      crc->j = 0;
-      crc->i++;
-      if (crc->i == ITERATIONS)
-       crc->phase = RP_DONE;
-      else
-       crc->phase = RP_CUT;
       break;
     case RP_CUT:
       /* trim down below MAX_SIZE again */
       if ((i % 2) == 0)
-        GNUNET_DATASTORE_get_random (datastore, 
-                                    &iterate_delete,
-                                    NULL);
+       {
+         GNUNET_DATASTORE_get_random (datastore, 
+                                      &delete_value,
+                                      crc);
+         break;
+       }
       crc->phase = RP_REPORT;
+      GNUNET_SCHEDULER_add_continuation (crc->sched,
+                                        GNUNET_NO,
+                                        &run_continuation,
+                                        crc,
+                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
     case RP_REPORT:
       size = 0;
@@ -264,7 +301,6 @@
                (stored_ops * 2 - stored_entries) / 1024,        /* total 
operations (in k) */
                1000 * (stored_ops * 2 - stored_entries) / (1 + 
GNUNET_TIME_absolute_get_duration(start_time).value));       /* operations per 
second */
       crc->phase = RP_PUT;
-      // fixme: trigger next round...
       GNUNET_SCHEDULER_add_continuation (crc->sched,
                                         GNUNET_NO,
                                         &run_continuation,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]