From 2ddddd76e3435fa8e88a1328bf57b381914a726e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 8 Apr 2010 13:59:24 +0000 Subject: [PATCH] mod --- src/fs/fs_test_lib.c | 8 +++++++- src/fs/fs_test_lib_data.conf | 6 ++++-- src/fs/gnunet-service-fs.c | 9 ++------- src/fs/test_gnunet_service_fs_p2p.c | 17 +++++++++++++++-- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index fb179e8a4..205567ace 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -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;pospublish_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; } diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf index 820c1e639..24afb18a2 100644 --- a/src/fs/fs_test_lib_data.conf +++ b/src/fs/fs_test_lib_data.conf @@ -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 diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 9b64e49dd..1c93b88f3 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -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, diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index 024e08155..09b1698e1 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c @@ -26,12 +26,12 @@ #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, -- 2.25.1