diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-21 12:00:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-21 12:00:05 +0000 |
commit | 7e655d5542a9912e14e779915acef2791cfa55c7 (patch) | |
tree | a2871d809accd9f6fcee2e4be26800833a27953c /src/fs/perf_gnunet_service_fs_p2p.c | |
parent | 71db17bc50adc7c959838ca0bc9d5190c841e3c8 (diff) | |
download | gnunet-7e655d5542a9912e14e779915acef2791cfa55c7.tar.gz gnunet-7e655d5542a9912e14e779915acef2791cfa55c7.zip |
more testcases, allow location uris in fs_download
Diffstat (limited to 'src/fs/perf_gnunet_service_fs_p2p.c')
-rw-r--r-- | src/fs/perf_gnunet_service_fs_p2p.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index ac4458994..fe57c1666 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -27,12 +27,12 @@ | |||
27 | #include "fs_test_lib.h" | 27 | #include "fs_test_lib.h" |
28 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
29 | 29 | ||
30 | #define VERBOSE GNUNET_YES | 30 | #define VERBOSE GNUNET_NO |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * File-size we use for testing. | 33 | * File-size we use for testing. |
34 | */ | 34 | */ |
35 | #define FILESIZE (1024 * 1024 * 1) | 35 | #define FILESIZE (1024 * 1024 * 50) |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * How long until we give up on transmitting the message? | 38 | * How long until we give up on transmitting the message? |
@@ -51,6 +51,8 @@ static int ok; | |||
51 | 51 | ||
52 | static struct GNUNET_TIME_Absolute start_time; | 52 | static struct GNUNET_TIME_Absolute start_time; |
53 | 53 | ||
54 | static const char *progname; | ||
55 | |||
54 | static void | 56 | static void |
55 | do_stop (void *cls, | 57 | do_stop (void *cls, |
56 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 58 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -87,21 +89,19 @@ static struct StatValues stats[] = | |||
87 | { "fs", "# results found locally"}, | 89 | { "fs", "# results found locally"}, |
88 | { "fs", "# requests forwarded due to high load"}, | 90 | { "fs", "# requests forwarded due to high load"}, |
89 | { "fs", "# requests done for free (low load)"}, | 91 | { "fs", "# requests done for free (low load)"}, |
92 | { "fs", "# requests dropped, priority insufficient"}, | ||
93 | { "fs", "# requests done for a price (normal load)"}, | ||
94 | { "fs", "# requests dropped by datastore (queue length limit)"}, | ||
90 | { "fs", "# P2P searches received"}, | 95 | { "fs", "# P2P searches received"}, |
91 | { "fs", "# replies received for local clients"}, | ||
92 | { "fs", "# P2P searches discarded (queue length bound)"}, | 96 | { "fs", "# P2P searches discarded (queue length bound)"}, |
93 | { "fs", "# requests dropped due to high load"}, | 97 | { "fs", "# replies received for local clients"}, |
94 | { "fs", "# requests dropped by datastore (queue length limit)"}, | ||
95 | { "fs", "# queries retransmitted to same target"}, | 98 | { "fs", "# queries retransmitted to same target"}, |
96 | { "fs", "cummulative artificial delay introduced (ms)"}, | 99 | { "fs", "cummulative artificial delay introduced (ms)"}, |
97 | { "core", "# bytes decrypted"}, | 100 | { "core", "# bytes decrypted"}, |
98 | { "core", "# bytes encrypted"}, | 101 | { "core", "# bytes encrypted"}, |
99 | { "core", "# transmissions delayed due to corking"}, | ||
100 | { "transport", "# bytes received via TCP"}, | 102 | { "transport", "# bytes received via TCP"}, |
101 | { "transport", "# bytes transmitted via TCP"}, | 103 | { "transport", "# bytes transmitted via TCP"}, |
102 | { "datacache", "# bytes stored"}, | 104 | { "datacache", "# bytes stored"}, |
103 | { "dht", "# DHT ROUTE Requests Seen"}, | ||
104 | { "dht", "# DHT ROUTE Requests Forwarded"}, | ||
105 | { NULL, NULL} | 105 | { NULL, NULL} |
106 | }; | 106 | }; |
107 | 107 | ||
@@ -236,6 +236,8 @@ static void | |||
236 | do_download (void *cls, | 236 | do_download (void *cls, |
237 | const struct GNUNET_FS_Uri *uri) | 237 | const struct GNUNET_FS_Uri *uri) |
238 | { | 238 | { |
239 | int anonymity; | ||
240 | |||
239 | if (NULL == uri) | 241 | if (NULL == uri) |
240 | { | 242 | { |
241 | GNUNET_FS_TEST_daemons_stop (sched, | 243 | GNUNET_FS_TEST_daemons_stop (sched, |
@@ -250,10 +252,14 @@ do_download (void *cls, | |||
250 | "Downloading %llu bytes\n", | 252 | "Downloading %llu bytes\n", |
251 | (unsigned long long) FILESIZE); | 253 | (unsigned long long) FILESIZE); |
252 | start_time = GNUNET_TIME_absolute_get (); | 254 | start_time = GNUNET_TIME_absolute_get (); |
255 | if (NULL != strstr (progname, "dht")) | ||
256 | anonymity = 0; | ||
257 | else | ||
258 | anonymity = 1; | ||
253 | GNUNET_FS_TEST_download (sched, | 259 | GNUNET_FS_TEST_download (sched, |
254 | daemons[0], | 260 | daemons[0], |
255 | TIMEOUT, | 261 | TIMEOUT, |
256 | 1, SEED, uri, | 262 | anonymity, SEED, uri, |
257 | VERBOSE, | 263 | VERBOSE, |
258 | &do_report, NULL); | 264 | &do_report, NULL); |
259 | } | 265 | } |
@@ -263,6 +269,9 @@ static void | |||
263 | do_publish (void *cls, | 269 | do_publish (void *cls, |
264 | const char *emsg) | 270 | const char *emsg) |
265 | { | 271 | { |
272 | int do_index; | ||
273 | int anonymity; | ||
274 | |||
266 | if (NULL != emsg) | 275 | if (NULL != emsg) |
267 | { | 276 | { |
268 | GNUNET_FS_TEST_daemons_stop (sched, | 277 | GNUNET_FS_TEST_daemons_stop (sched, |
@@ -277,10 +286,20 @@ do_publish (void *cls, | |||
277 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
278 | "Publishing %llu bytes\n", | 287 | "Publishing %llu bytes\n", |
279 | (unsigned long long) FILESIZE); | 288 | (unsigned long long) FILESIZE); |
289 | if (NULL != strstr (progname, "index")) | ||
290 | do_index = GNUNET_YES; | ||
291 | else | ||
292 | do_index = GNUNET_NO; | ||
293 | if (NULL != strstr (progname, "dht")) | ||
294 | anonymity = 0; | ||
295 | else | ||
296 | anonymity = 1; | ||
297 | |||
280 | GNUNET_FS_TEST_publish (sched, | 298 | GNUNET_FS_TEST_publish (sched, |
281 | daemons[NUM_DAEMONS-1], | 299 | daemons[NUM_DAEMONS-1], |
282 | TIMEOUT, | 300 | TIMEOUT, |
283 | 1, GNUNET_NO, FILESIZE, SEED, | 301 | anonymity, |
302 | do_index, FILESIZE, SEED, | ||
284 | VERBOSE, | 303 | VERBOSE, |
285 | &do_download, NULL); | 304 | &do_download, NULL); |
286 | } | 305 | } |
@@ -343,9 +362,9 @@ main (int argc, char *argv[]) | |||
343 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 362 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
344 | GNUNET_GETOPT_OPTION_END | 363 | GNUNET_GETOPT_OPTION_END |
345 | }; | 364 | }; |
346 | 365 | progname = argv[0]; | |
347 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); | 366 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); |
348 | GNUNET_log_setup ("perf_gnunet_service_fs_p2p", | 367 | GNUNET_log_setup ("perf_gnunet_service_fs_p2p_index", |
349 | #if VERBOSE | 368 | #if VERBOSE |
350 | "DEBUG", | 369 | "DEBUG", |
351 | #else | 370 | #else |
@@ -353,10 +372,10 @@ main (int argc, char *argv[]) | |||
353 | #endif | 372 | #endif |
354 | NULL); | 373 | NULL); |
355 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, | 374 | GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, |
356 | argvx, "perf-gnunet-service-fs-p2p", | 375 | argvx, "perf-gnunet-service-fs-p2p-index", |
357 | "nohelp", options, &run, NULL); | 376 | "nohelp", options, &run, NULL); |
358 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); | 377 | GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); |
359 | return ok; | 378 | return ok; |
360 | } | 379 | } |
361 | 380 | ||
362 | /* end of perf_gnunet_service_fs_p2p.c */ | 381 | /* end of perf_gnunet_service_fs_p2p_index.c */ |