mod
authorChristian Grothoff <christian@grothoff.org>
Thu, 8 Apr 2010 13:59:24 +0000 (13:59 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 8 Apr 2010 13:59:24 +0000 (13:59 +0000)
src/fs/fs_test_lib.c
src/fs/fs_test_lib_data.conf
src/fs/gnunet-service-fs.c
src/fs/test_gnunet_service_fs_p2p.c

index fb179e8a4da3be76292f7538a9895ece59390bd1..205567acef51f140eadc24d18da49428d0021627 100644 (file)
@@ -481,9 +481,15 @@ file_generator (void *cls,
   struct GNUNET_FS_TestDaemon *daemon = cls;
   uint64_t pos;
   uint8_t *cbuf = buf;
+  int mod;
 
   for (pos=0;pos<max;pos++)
-    cbuf[pos] = (uint8_t) ((offset * daemon->publish_seed) % (255 - (offset / 1024 / 32)));  
+    {
+      mod = (255 - (offset / 1024 / 32));
+      if (mod == 0)
+       mod = 1;
+      cbuf[pos] = (uint8_t) ((offset * daemon->publish_seed) % mod));  
+    }
   return max;
 }
 
index 820c1e6391554f6603f16f3fbd54dc16da3f0517..24afb18a2295691ae5f73a6038b437860fe8d454 100644 (file)
@@ -41,9 +41,11 @@ HOSTNAME = localhost
 [core]
 PORT = 43470
 HOSTNAME = localhost
+#TOTAL_QUOTA_IN = 9321
+#TOTAL_QUOTA_OUT = 9321
 TOTAL_QUOTA_IN = 3932160
 TOTAL_QUOTA_OUT = 3932160
-#DEBUG = YES
+# DEBUG = YES
 #PREFIX = valgrind --tool=memcheck --leak-check=yes
 #BINARY = /home/grothoff/bin/gnunet-service-core
 
@@ -51,7 +53,7 @@ TOTAL_QUOTA_OUT = 3932160
 PORT = 43471
 HOSTNAME = localhost
 #OPTIONS = -L DEBUG
-#DEBUG = YES
+# DEBUG = YES
 #PREFIX = valgrind --tool=memcheck --leak-check=yes
 #BINARY = /home/grothoff/bin/gnunet-service-fs
 #PREFIX = xterm -e gdb -x cmd --args 
index 9b64e49ddbb09da6a9e07da637eda6db0efab558..1c93b88f3e6dfd3cad132b0f350290fba4f88010 100644 (file)
@@ -47,7 +47,7 @@
 #include "gnunet-service-fs_indexing.h"
 #include "fs.h"
 
-#define DEBUG_FS GNUNET_YES
+#define DEBUG_FS GNUNET_NO
 
 /**
  * Maximum number of outgoing messages we queue per peer.
@@ -1594,7 +1594,7 @@ forward_request_task (void *cls,
                                                &psc.target,
                                                GNUNET_CONSTANTS_SERVICE_TIMEOUT, 
                                                GNUNET_BANDWIDTH_value_init ((uint32_t) -1 /* no limit */), 
-                                               DBLOCK_SIZE, 
+                                               DBLOCK_SIZE * 2
                                                (uint64_t) cp->inc_preference,
                                                &target_reservation_cb,
                                                pr);
@@ -2011,11 +2011,6 @@ process_reply (void *cls,
   pr->remaining_priority = 0;
   if (pr->client_request_list != NULL)
     {
-#if DEBUG_FS
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Transmitting result for query `%s' to local client\n",
-                 GNUNET_h2s (key));
-#endif  
       GNUNET_STATISTICS_update (stats,
                                gettext_noop ("# replies received for local clients"),
                                1,
index 024e08155a6afb3fa4c3034c341d47d03d113824..09b1698e1d015fa49c782ec5e3a981988571b38a 100644 (file)
 #include "platform.h"
 #include "fs_test_lib.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 /**
  * File-size we use for testing.
  */
-#define FILESIZE (1024 * 1024 * 2)
+#define FILESIZE (1024 * 1024 * 20)
 
 /**
  * How long until we give up on transmitting the message?
@@ -48,16 +48,28 @@ static struct GNUNET_SCHEDULER_Handle *sched;
 
 static int ok;
 
+static struct GNUNET_TIME_Absolute start_time;
 
 static void
 do_stop (void *cls,
         const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  struct GNUNET_TIME_Relative del;
+  char *fancy;
+
   GNUNET_FS_TEST_daemons_stop (sched,
                               NUM_DAEMONS,
                               daemons);
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
     {
+      del = GNUNET_TIME_absolute_get_duration (start_time);
+      if (del.value == 0)
+       del.value = 1;
+      fancy = GNUNET_STRINGS_byte_size_fancy (((unsigned long long)FILESIZE) * 1000LL / del.value);
+      fprintf (stdout,
+              "Download speed was %s/s\n",
+              fancy);
+      GNUNET_free (fancy);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Finished download, shutting down\n",
                  (unsigned long long) FILESIZE);
@@ -88,6 +100,7 @@ do_download (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Downloading %llu bytes\n",
              (unsigned long long) FILESIZE);
+  start_time = GNUNET_TIME_absolute_get ();
   GNUNET_FS_TEST_download (sched,
                           daemons[0],
                           TIMEOUT,