gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3593 - GNUnet/src/applications/sqstore_sqlite


From: grothoff
Subject: [GNUnet-SVN] r3593 - GNUnet/src/applications/sqstore_sqlite
Date: Tue, 31 Oct 2006 21:42:00 -0800 (PST)

Author: grothoff
Date: 2006-10-31 21:41:58 -0800 (Tue, 31 Oct 2006)
New Revision: 3593

Modified:
   GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
Log:
sqlite benchmark

Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2006-11-01 
05:30:41 UTC (rev 3592)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2006-11-01 
05:41:58 UTC (rev 3593)
@@ -47,7 +47,7 @@
 /**
  * Target datastore size (in bytes).
  */
-#define MAX_SIZE 1024 * 1024 * 4
+#define MAX_SIZE 1024 * 1024 * 256
 
 /**
  * Report progress outside of major reports? Should probably be YES if
@@ -72,10 +72,19 @@
  */
 #define ITERATIONS 1000000
 
+/**
+ * Name of the database on disk.
+ */
+#define DB_NAME "/tmp/gnunet-sqlite-sqstore-test/data/fs/content/gnunet.dat"
+
 static unsigned long long stored_bytes;
 
 static unsigned long long stored_entries;
 
+static unsigned long long stored_ops;
+
+static cron_t start_time;
+
 static int putValue(SQstore_ServiceAPI * api,
                    int i) {
   Datastore_Value * value;
@@ -113,6 +122,7 @@
     fprintf(stderr, "I");
 #endif
   stored_bytes += ntohl(value->size);
+  stored_ops++;
   stored_entries++;
   FREE(value);
   return OK;
@@ -147,7 +157,11 @@
   int i;
   int j;
   unsigned long long size;
+  int have_file;
 
+  have_file = OK == disk_file_test(NULL,
+                                  DB_NAME);
+
   for (i=0;i<ITERATIONS;i++) {
 #if REPORT_ID
     fprintf(stderr, ".");
@@ -167,21 +181,25 @@
 
     /* every 10 iterations print status */
     if ((i % 10) == 9) {
-      disk_file_size(NULL,
-                    
"/tmp/gnunet-sqlite-sqstore-test/data/fs/content/gnunet.dat",
-                    &size,
-                    NO);
+      size = 0;
+      if (have_file)
+       disk_file_size(NULL,
+                      DB_NAME,
+                      &size,
+                      NO);
       printf(
 #if REPORT_ID
             "\n"
 #endif
-            "Useful %llu, API %llu (Useful-API: %lld/%.2f), disk %llu 
(overhead: %.2f)\n",
-            stored_bytes, 
-            api->getSize(),
-            api->getSize() - stored_bytes,
-            1.0 * (api->getSize() - stored_bytes) / (stored_entries * 
sizeof(Datastore_Value)),
-            size,
-            1.0 * size / stored_bytes);
+            "Useful %llu, API %llu (Useful-API: %lld/%.2f), disk %llu (%.2f%%) 
/ %lluk ops / %llu ops/s\n",
+            stored_bytes / 1024,  /* used size in k */
+            api->getSize() / 1024, /* API-reported size in k */
+            (api->getSize() - stored_bytes) / 1024, /* difference between 
reported and used */
+            1.0 * (api->getSize() - stored_bytes) / (stored_entries * 
sizeof(Datastore_Value)), /* relative to number of entries (should be equal to 
internal overhead per entry) */
+            size / 1024, /* disk size in kb */
+            1.0 * size / stored_bytes, /* overhead */
+            (stored_ops * 2 - stored_entries) / 1024, /* total operations (in 
k) */
+            1000 * (stored_ops * 2 - stored_entries) / (1 + get_time() - 
start_time)); /* operations per second */
     }
     if (GNUNET_SHUTDOWN_TEST() == YES)
       break;
@@ -213,6 +231,7 @@
           NULL);
   api = requestService("sqstore");
   if (api != NULL) {
+    start_time = get_time();
     ok = test(api);
     releaseService(api);
   } else





reply via email to

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