-remove trailing whitespace
[oweals/gnunet.git] / src / datastore / perf_datastore_api.c
index fa2ee52dc95e3df2c9453721b8d39af9234fda53..c51502cc65d9937cd579e03a10e6d56838471d87 100644 (file)
@@ -36,7 +36,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_datastore_service.h"
-#include "gnunet_testing_lib-new.h"
+#include "gnunet_testing_lib.h"
 #include <gauger.h>
 
 /**
@@ -171,7 +171,7 @@ remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration,
 
 
 static void
-delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
+delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
               const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
               uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
               uint64_t uid)
@@ -196,7 +196,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct CpsRunContext *crc = cls;
   size_t size;
-  static GNUNET_HashCode key;
+  static struct GNUNET_HashCode key;
   static char data[65536];
   int i;
   int k;
@@ -206,7 +206,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   switch (crc->phase)
   {
   case RP_PUT:
-    memset (&key, 256 - crc->i, sizeof (GNUNET_HashCode));
+    memset (&key, 256 - crc->i, sizeof (struct GNUNET_HashCode));
     i = crc->j;
     k = crc->i;
     /* most content is 32k */
@@ -214,7 +214,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     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);
     crc->size = size = size - (size & 7);       /* always multiple of 8 */
-    GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
+    GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
     memset (data, i, size);
     if (i > 255)
       memset (data, i - 255, size / 2);
@@ -245,9 +245,9 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #endif
              "Stored %llu kB / %lluk ops / %llu ops/s\n", stored_bytes / 1024,  /* used size in k */
              stored_ops / 1024, /* total operations (in k) */
-             1000 * stored_ops / (1 +
-                                  GNUNET_TIME_absolute_get_duration
-                                  (start_time).rel_value));
+             1000LL * 1000LL * stored_ops / (1 +
+                                            GNUNET_TIME_absolute_get_duration
+                                            (start_time).rel_value_us));
     crc->phase = RP_PUT;
     crc->j = 0;
     GNUNET_SCHEDULER_add_continuation (&run_continuation, crc,
@@ -257,7 +257,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_snprintf (gstr, sizeof (gstr), "DATASTORE-%s", plugin_name);
     if ((crc->i == ITERATIONS) && (stored_ops > 0))
       GAUGER (gstr, "PUT operation duration",
-              GNUNET_TIME_absolute_get_duration (start_time).rel_value /
+              GNUNET_TIME_absolute_get_duration (start_time).rel_value_us / 1000LL /
               stored_ops, "ms/operation");
     GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
     GNUNET_free (crc);
@@ -294,11 +294,12 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
 
 
 static void
-run (void *cls, 
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls,
+     const struct GNUNET_CONFIGURATION_Handle *cfg,
+     struct GNUNET_TESTING_Peer *peer)
 {
   struct CpsRunContext *crc;
-  static GNUNET_HashCode zkey;
+  static struct GNUNET_HashCode zkey;
 
   datastore = GNUNET_DATASTORE_connect (cfg);
   start_time = GNUNET_TIME_absolute_get ();
@@ -324,7 +325,7 @@ main (int argc, char *argv[])
 {
   char cfg_name[128];
 
-  plugin_name = GNUNET_TESTING_get_testname_from_underscoare (argv[0]);
+  plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]);
   GNUNET_snprintf (cfg_name, sizeof (cfg_name),
                    "test_datastore_api_data_%s.conf", plugin_name);
   if (0 !=
@@ -333,6 +334,7 @@ main (int argc, char *argv[])
                               &run,
                               NULL))
     return 1;
+  FPRINTF (stderr, "%s", "\n");
   return ok;
 }