aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_gnunet_service_fs_p2p.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-08 13:59:24 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-08 13:59:24 +0000
commit2ddddd76e3435fa8e88a1328bf57b381914a726e (patch)
treeea8d1fa5b5fa39eab23b12d621a773a752df999e /src/fs/test_gnunet_service_fs_p2p.c
parent65a939c8132e680adf1aa9d71b36b17aa2ba5b58 (diff)
downloadgnunet-2ddddd76e3435fa8e88a1328bf57b381914a726e.tar.gz
gnunet-2ddddd76e3435fa8e88a1328bf57b381914a726e.zip
mod
Diffstat (limited to 'src/fs/test_gnunet_service_fs_p2p.c')
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c17
1 files changed, 15 insertions, 2 deletions
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 @@
26#include "platform.h" 26#include "platform.h"
27#include "fs_test_lib.h" 27#include "fs_test_lib.h"
28 28
29#define VERBOSE GNUNET_YES 29#define VERBOSE GNUNET_NO
30 30
31/** 31/**
32 * File-size we use for testing. 32 * File-size we use for testing.
33 */ 33 */
34#define FILESIZE (1024 * 1024 * 2) 34#define FILESIZE (1024 * 1024 * 20)
35 35
36/** 36/**
37 * How long until we give up on transmitting the message? 37 * How long until we give up on transmitting the message?
@@ -48,16 +48,28 @@ static struct GNUNET_SCHEDULER_Handle *sched;
48 48
49static int ok; 49static int ok;
50 50
51static struct GNUNET_TIME_Absolute start_time;
51 52
52static void 53static void
53do_stop (void *cls, 54do_stop (void *cls,
54 const struct GNUNET_SCHEDULER_TaskContext *tc) 55 const struct GNUNET_SCHEDULER_TaskContext *tc)
55{ 56{
57 struct GNUNET_TIME_Relative del;
58 char *fancy;
59
56 GNUNET_FS_TEST_daemons_stop (sched, 60 GNUNET_FS_TEST_daemons_stop (sched,
57 NUM_DAEMONS, 61 NUM_DAEMONS,
58 daemons); 62 daemons);
59 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) 63 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
60 { 64 {
65 del = GNUNET_TIME_absolute_get_duration (start_time);
66 if (del.value == 0)
67 del.value = 1;
68 fancy = GNUNET_STRINGS_byte_size_fancy (((unsigned long long)FILESIZE) * 1000LL / del.value);
69 fprintf (stdout,
70 "Download speed was %s/s\n",
71 fancy);
72 GNUNET_free (fancy);
61 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
62 "Finished download, shutting down\n", 74 "Finished download, shutting down\n",
63 (unsigned long long) FILESIZE); 75 (unsigned long long) FILESIZE);
@@ -88,6 +100,7 @@ do_download (void *cls,
88 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
89 "Downloading %llu bytes\n", 101 "Downloading %llu bytes\n",
90 (unsigned long long) FILESIZE); 102 (unsigned long long) FILESIZE);
103 start_time = GNUNET_TIME_absolute_get ();
91 GNUNET_FS_TEST_download (sched, 104 GNUNET_FS_TEST_download (sched,
92 daemons[0], 105 daemons[0],
93 TIMEOUT, 106 TIMEOUT,