debugstuff
authorChristian Grothoff <christian@grothoff.org>
Fri, 17 Jul 2009 22:43:42 +0000 (22:43 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 17 Jul 2009 22:43:42 +0000 (22:43 +0000)
src/datastore/perf_plugin_datastore.c
src/datastore/plugin_datastore_sqlite.c

index 85659f06a980194faac90a871827c5b46f5dc208..0eed035d10cb0d5970e4648c5fef40a2123afbce 100644 (file)
@@ -28,7 +28,7 @@
 #include "gnunet_protocols.h"
 #include "plugin_datastore.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_YES
 
 /**
  * Target datastore size (in bytes).  Realistic sizes are
  * those take too long to run them in the usual "make check"
  * sequence.  Hence the value used for shipping is tiny.
  */
-#define MAX_SIZE 1024LL * 1024 * 128
+#define MAX_SIZE 1024LL * 1024 / 4
+// * 128
 
-#define ITERATIONS 10
+#define ITERATIONS 2
 
 /**
  * Number of put operations equivalent to 1/10th of MAX_SIZE
@@ -88,6 +89,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions * api, int i, int k)
   static GNUNET_HashCode key;
   static int ic;
   char *msg;
+  unsigned int prio;
 
   /* most content is 32k */
   size = 32 * 1024;
@@ -104,12 +106,13 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions * api, int i, int k)
     memset (value, i - 255, size / 2);
   value[0] = k;
   msg = NULL;
+  prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
   if (GNUNET_OK != api->put (api->cls,
                             &key, 
                             size,
                             value,
                             i,
-                            GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100),
+                            prio,
                             i,
                             GNUNET_TIME_relative_to_absolute 
                             (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
@@ -172,6 +175,11 @@ iterateDummy (void *cls,
                                  &test, crc);
       return GNUNET_OK;
     }
+#if VERBOSE
+  fprintf (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n",
+          type, priority, size,
+          (unsigned long long) expiration.value);
+#endif
   crc->cnt++;
   crc->api->next_request (next_cls,
                          GNUNET_NO);
index 3cedbd5d6f1752dc3f75cfa915f7b95d6cc58fc5..27a349be0bf09521e79f40d5915b396ceb5c6bbe 100644 (file)
@@ -29,7 +29,7 @@
 #include "plugin_datastore.h"
 #include <sqlite3.h>
 
-#define DEBUG_SQLITE GNUNET_NO
+#define DEBUG_SQLITE GNUNET_YES
 
 /**
  * After how many payload-changing operations
@@ -899,6 +899,10 @@ iter_next_prepare (void *cls,
                GNUNET_ERROR_TYPE_ERROR |
                GNUNET_ERROR_TYPE_BULK,
                "sqlite3_reset");
+#if DEBUG_SQLITE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "No result found using either iterator\n");
+#endif
   return GNUNET_NO;
 }
 
@@ -932,6 +936,13 @@ basic_iter (struct Plugin *plugin,
   sqlite3_stmt *stmt_1;
   sqlite3_stmt *stmt_2;
 
+#if DEBUG_SQLITE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "At %llu, using queries `%s' and `%s'\n",
+             (unsigned long long) GNUNET_TIME_absolute_get ().value,
+             stmt_str_1,
+             stmt_str_2);
+#endif
   if (sq_prepare (plugin->dbh, stmt_str_1, &stmt_1) != SQLITE_OK)
     {
       LOG_SQLITE (plugin, NULL,
@@ -1029,9 +1040,9 @@ sqlite_plugin_iter_zero_anonymity (void *cls,
 
   now = GNUNET_TIME_absolute_get ();
   GNUNET_asprintf (&q1, SELECT_IT_NON_ANONYMOUS_1,
-                  now.value);
+                  (unsigned long long) now.value);
   GNUNET_asprintf (&q2, SELECT_IT_NON_ANONYMOUS_2,
-                  now.value);
+                  (unsigned long long) now.value);
   basic_iter (cls,
              type, 
              GNUNET_NO, GNUNET_YES, 
@@ -1067,9 +1078,9 @@ sqlite_plugin_iter_ascending_expiration (void *cls,
 
   now = GNUNET_TIME_absolute_get ();
   GNUNET_asprintf (&q1, SELECT_IT_EXPIRATION_TIME_1,
-                  now.value);
+                  (unsigned long long) 0*now.value);
   GNUNET_asprintf (&q2, SELECT_IT_EXPIRATION_TIME_2,
-                  now.value);
+                  (unsigned long long) 0*now.value);
   basic_iter (cls,
              type, 
              GNUNET_YES, GNUNET_NO, 
@@ -1102,7 +1113,7 @@ sqlite_plugin_iter_migration_order (void *cls,
 
   now = GNUNET_TIME_absolute_get ();
   GNUNET_asprintf (&q, SELECT_IT_MIGRATION_ORDER_2,
-                  now.value);
+                  (unsigned long long) now.value);
   basic_iter (cls,
              type, 
              GNUNET_NO, GNUNET_NO, 
@@ -1132,10 +1143,6 @@ all_next_prepare (void *cls,
   plugin = nc->plugin;
   if (SQLITE_ROW == (ret = sqlite3_step (nc->stmt)))
     {      
-#if DEBUG_SQLITE
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Result found\n");
-#endif
       return GNUNET_OK;
     }
   if (ret != SQLITE_DONE)