aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-21 12:00:05 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-21 12:00:05 +0000
commit7e655d5542a9912e14e779915acef2791cfa55c7 (patch)
treea2871d809accd9f6fcee2e4be26800833a27953c /src/fs
parent71db17bc50adc7c959838ca0bc9d5190c841e3c8 (diff)
downloadgnunet-7e655d5542a9912e14e779915acef2791cfa55c7.tar.gz
gnunet-7e655d5542a9912e14e779915acef2791cfa55c7.zip
more testcases, allow location uris in fs_download
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Makefile.am20
-rw-r--r--src/fs/fs.h12
-rw-r--r--src/fs/fs_download.c14
-rw-r--r--src/fs/fs_test_lib.c81
-rw-r--r--src/fs/fs_test_lib_data.conf4
-rw-r--r--src/fs/gnunet-service-fs.c83
-rw-r--r--src/fs/perf_gnunet_service_fs_p2p.c47
7 files changed, 203 insertions, 58 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index bbac950a0..c798e9947 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -135,7 +135,9 @@ check_PROGRAMS = \
135 test_fs_uri \ 135 test_fs_uri \
136 test_gnunet_service_fs_migration \ 136 test_gnunet_service_fs_migration \
137 test_gnunet_service_fs_p2p \ 137 test_gnunet_service_fs_p2p \
138 perf_gnunet_service_fs_p2p 138 perf_gnunet_service_fs_p2p \
139 perf_gnunet_service_fs_p2p_dht \
140 perf_gnunet_service_fs_p2p_index
139 141
140 142
141if HAVE_PYTHON_PEXPECT 143if HAVE_PYTHON_PEXPECT
@@ -303,6 +305,22 @@ perf_gnunet_service_fs_p2p_LDADD = \
303 $(top_builddir)/src/fs/libgnunetfs.la \ 305 $(top_builddir)/src/fs/libgnunetfs.la \
304 $(top_builddir)/src/util/libgnunetutil.la 306 $(top_builddir)/src/util/libgnunetutil.la
305 307
308perf_gnunet_service_fs_p2p_index_SOURCES = \
309 perf_gnunet_service_fs_p2p.c
310perf_gnunet_service_fs_p2p_index_LDADD = \
311 $(top_builddir)/src/fs/libgnunetfstest.a \
312 $(top_builddir)/src/testing/libgnunettesting.la \
313 $(top_builddir)/src/fs/libgnunetfs.la \
314 $(top_builddir)/src/util/libgnunetutil.la
315
316perf_gnunet_service_fs_p2p_dht_SOURCES = \
317 perf_gnunet_service_fs_p2p.c
318perf_gnunet_service_fs_p2p_dht_LDADD = \
319 $(top_builddir)/src/fs/libgnunetfstest.a \
320 $(top_builddir)/src/testing/libgnunettesting.la \
321 $(top_builddir)/src/fs/libgnunetfs.la \
322 $(top_builddir)/src/util/libgnunetutil.la
323
306 324
307do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' 325do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
308 326
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 9d662b267..68ed2184e 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -37,6 +37,18 @@
37 37
38/** 38/**
39 * Maximum number of outgoing messages we queue per peer. 39 * Maximum number of outgoing messages we queue per peer.
40 *
41 * Performance measurements for 2 peer setup for 50 MB file
42 * (with MAX_DATASTORE_QUEUE = 1 and RETRY_PROBABILITY_INV = 1):
43 *
44 * 2: 1700 kb/s, 1372 kb/s
45 * 8: 2117 kb/s, 1284 kb/s, 1112 kb/s
46 * 16: 3500 kb/s, 3200 kb/s, 3388 kb/s
47 * 32: 3441 kb/s, 3163 kb/s, 3277 kb/s
48 * 128: 1700 kb/s; 2010 kb/s, 3383 kb/s, 1156 kb/s
49 *
50 * Conclusion: 16 seems to be a pretty good value (stable
51 * and high performance, no excessive memory use).
40 */ 52 */
41#define MAX_QUEUE_PER_PEER 16 53#define MAX_QUEUE_PER_PEER 16
42 54
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index c7596de14..2be58aa1a 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -32,7 +32,7 @@
32#include "fs.h" 32#include "fs.h"
33#include "fs_tree.h" 33#include "fs_tree.h"
34 34
35#define DEBUG_DOWNLOAD GNUNET_YES 35#define DEBUG_DOWNLOAD GNUNET_NO
36 36
37/** 37/**
38 * Determine if the given download (options and meta data) should cause 38 * Determine if the given download (options and meta data) should cause
@@ -1719,9 +1719,11 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
1719 struct GNUNET_FS_ProgressInfo pi; 1719 struct GNUNET_FS_ProgressInfo pi;
1720 struct GNUNET_FS_DownloadContext *dc; 1720 struct GNUNET_FS_DownloadContext *dc;
1721 1721
1722 GNUNET_assert (GNUNET_FS_uri_test_chk (uri)); 1722 GNUNET_assert (GNUNET_FS_uri_test_chk (uri) ||
1723 GNUNET_FS_uri_test_loc (uri) );
1724
1723 if ( (offset + length < offset) || 1725 if ( (offset + length < offset) ||
1724 (offset + length > uri->data.chk.file_length) ) 1726 (offset + length > GNUNET_FS_uri_chk_get_file_size (uri)) )
1725 { 1727 {
1726 GNUNET_break (0); 1728 GNUNET_break (0);
1727 return NULL; 1729 return NULL;
@@ -1762,7 +1764,7 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
1762 dc->anonymity = anonymity; 1764 dc->anonymity = anonymity;
1763 dc->options = options; 1765 dc->options = options;
1764 dc->active = GNUNET_CONTAINER_multihashmap_create (1 + 2 * (length / DBLOCK_SIZE)); 1766 dc->active = GNUNET_CONTAINER_multihashmap_create (1 + 2 * (length / DBLOCK_SIZE));
1765 dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length)); 1767 dc->treedepth = GNUNET_FS_compute_depth (GNUNET_FS_uri_chk_get_file_size(dc->uri));
1766 if ( (filename == NULL) && 1768 if ( (filename == NULL) &&
1767 (is_recursive_download (dc) ) ) 1769 (is_recursive_download (dc) ) )
1768 { 1770 {
@@ -1787,7 +1789,9 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
1787 pi.value.download.specifics.start.meta = meta; 1789 pi.value.download.specifics.start.meta = meta;
1788 GNUNET_FS_download_make_status_ (&pi, dc); 1790 GNUNET_FS_download_make_status_ (&pi, dc);
1789 schedule_block_download (dc, 1791 schedule_block_download (dc,
1790 &dc->uri->data.chk.chk, 1792 (dc->uri->type == chk)
1793 ? &dc->uri->data.chk.chk
1794 : &dc->uri->data.loc.fi.chk,
1791 0, 1795 0,
1792 1 /* 0 == CHK, 1 == top */); 1796 1 /* 0 == CHK, 1 == top */);
1793 GNUNET_FS_download_sync_ (dc); 1797 GNUNET_FS_download_sync_ (dc);
diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c
index dd646eafe..f91092c4e 100644
--- a/src/fs/fs_test_lib.c
+++ b/src/fs/fs_test_lib.c
@@ -27,6 +27,7 @@
27 * @author Christian Grothoff 27 * @author Christian Grothoff
28 */ 28 */
29#include "platform.h" 29#include "platform.h"
30#include "fs.h"
30#include "fs_test_lib.h" 31#include "fs_test_lib.h"
31#include "gnunet_testing_lib.h" 32#include "gnunet_testing_lib.h"
32 33
@@ -106,6 +107,11 @@ struct GNUNET_FS_TestDaemon
106 struct GNUNET_FS_Uri *publish_uri; 107 struct GNUNET_FS_Uri *publish_uri;
107 108
108 /** 109 /**
110 * Name of the temporary file used, or NULL for none.
111 */
112 char *publish_tmp_file;
113
114 /**
109 * Scheduler to use (for download_cont). 115 * Scheduler to use (for download_cont).
110 */ 116 */
111 struct GNUNET_SCHEDULER_Handle *download_sched; 117 struct GNUNET_SCHEDULER_Handle *download_sched;
@@ -562,6 +568,11 @@ GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched,
562 GNUNET_FS_stop (daemons[i]->fs); 568 GNUNET_FS_stop (daemons[i]->fs);
563 if (daemons[i]->cfg != NULL) 569 if (daemons[i]->cfg != NULL)
564 GNUNET_CONFIGURATION_destroy (daemons[i]->cfg); 570 GNUNET_CONFIGURATION_destroy (daemons[i]->cfg);
571 if (NULL != daemons[i]->publish_tmp_file)
572 {
573 GNUNET_DISK_directory_remove (daemons[i]->publish_tmp_file);
574 GNUNET_free (daemons[i]->publish_tmp_file);
575 }
565 GNUNET_free (daemons[i]); 576 GNUNET_free (daemons[i]);
566 daemons[i] = NULL; 577 daemons[i] = NULL;
567 } 578 }
@@ -647,25 +658,71 @@ GNUNET_FS_TEST_publish (struct GNUNET_SCHEDULER_Handle *sched,
647 GNUNET_FS_TEST_UriContinuation cont, 658 GNUNET_FS_TEST_UriContinuation cont,
648 void *cont_cls) 659 void *cont_cls)
649{ 660{
650 GNUNET_assert (daemon->publish_cont == NULL);
651 struct GNUNET_FS_FileInformation *fi; 661 struct GNUNET_FS_FileInformation *fi;
662 struct GNUNET_DISK_FileHandle *fh;
663 char *emsg;
664 uint64_t off;
665 char buf[DBLOCK_SIZE];
666 size_t bsize;
652 667
668 GNUNET_assert (daemon->publish_cont == NULL);
653 daemon->publish_cont = cont; 669 daemon->publish_cont = cont;
654 daemon->publish_cont_cls = cont_cls; 670 daemon->publish_cont_cls = cont_cls;
655 daemon->publish_seed = seed; 671 daemon->publish_seed = seed;
656 daemon->verbose = verbose; 672 daemon->verbose = verbose;
657 daemon->publish_sched = sched; 673 daemon->publish_sched = sched;
658 fi = GNUNET_FS_file_information_create_from_reader (daemon->fs, 674 if (GNUNET_YES == do_index)
659 daemon, 675 {
660 size, 676 GNUNET_assert (daemon->publish_tmp_file == NULL);
661 &file_generator, 677 daemon->publish_tmp_file = GNUNET_DISK_mktemp ("fs-test-publish-index");
662 daemon, 678 GNUNET_assert (daemon->publish_tmp_file != NULL);
663 NULL, 679 fh = GNUNET_DISK_file_open (daemon->publish_tmp_file,
664 NULL, 680 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
665 do_index, 681 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
666 anonymity, 682 GNUNET_assert (NULL != fh);
667 42 /* priority */, 683 off = 0;
668 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS)); 684 while (off < size)
685 {
686 bsize = GNUNET_MIN (sizeof (buf),
687 size - off);
688 GNUNET_assert (bsize ==
689 file_generator (daemon,
690 off,
691 bsize,
692 buf,
693 &emsg));
694 GNUNET_assert (emsg == NULL);
695 GNUNET_assert (bsize ==
696 GNUNET_DISK_file_write (fh,
697 buf,
698 bsize));
699 off += bsize;
700 }
701 GNUNET_assert (GNUNET_OK ==
702 GNUNET_DISK_file_close (fh));
703 fi = GNUNET_FS_file_information_create_from_file (daemon->fs,
704 daemon,
705 daemon->publish_tmp_file,
706 NULL, NULL,
707 do_index,
708 anonymity,
709 42 /* priority */,
710 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS));
711 }
712 else
713 {
714 fi = GNUNET_FS_file_information_create_from_reader (daemon->fs,
715 daemon,
716 size,
717 &file_generator,
718 daemon,
719 NULL,
720 NULL,
721 do_index,
722 anonymity,
723 42 /* priority */,
724 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS));
725 }
669 daemon->publish_context = GNUNET_FS_publish_start (daemon->fs, 726 daemon->publish_context = GNUNET_FS_publish_start (daemon->fs,
670 fi, 727 fi,
671 NULL, NULL, NULL, 728 NULL, NULL, NULL,
diff --git a/src/fs/fs_test_lib_data.conf b/src/fs/fs_test_lib_data.conf
index 4e7dabd9d..25f9979bb 100644
--- a/src/fs/fs_test_lib_data.conf
+++ b/src/fs/fs_test_lib_data.conf
@@ -20,7 +20,7 @@ HOSTNAME = localhost
20DEFAULTSERVICES = fs 20DEFAULTSERVICES = fs
21 21
22[datastore] 22[datastore]
23DEBUG = YES 23# DEBUG = YES
24#PREFIX = valgrind --tool=memcheck --leak-check=yes 24#PREFIX = valgrind --tool=memcheck --leak-check=yes
25QUOTA = 2000000000 25QUOTA = 2000000000
26 26
@@ -52,7 +52,7 @@ PORT = 43471
52HOSTNAME = localhost 52HOSTNAME = localhost
53#OPTIONS = -L DEBUG 53#OPTIONS = -L DEBUG
54ACTIVEMIGRATION = NO 54ACTIVEMIGRATION = NO
55DEBUG = YES 55# DEBUG = YES
56#PREFIX = valgrind --tool=memcheck --leak-check=yes 56#PREFIX = valgrind --tool=memcheck --leak-check=yes
57#BINARY = /home/grothoff/gn9/bin/gnunet-service-fs 57#BINARY = /home/grothoff/gn9/bin/gnunet-service-fs
58#PREFIX = xterm -e gdb -x cmd --args 58#PREFIX = xterm -e gdb -x cmd --args
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 9ba722c3c..f59f18546 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -54,15 +54,15 @@
54 * might want to consider changing 'RETRY_PROBABILITY_INV' to 1 for 54 * might want to consider changing 'RETRY_PROBABILITY_INV' to 1 for
55 * a rather wasteful mode of operation (that might still get the highest 55 * a rather wasteful mode of operation (that might still get the highest
56 * throughput overall). 56 * throughput overall).
57 *
58 * Performance measurements (for 50 MB file, 2 peers):
59 *
60 * - Without delays: 3300 kb/s
61 * - With delays: 101 kb/s
57 */ 62 */
58#define SUPPORT_DELAYS GNUNET_NO 63#define SUPPORT_DELAYS GNUNET_NO
59 64
60/** 65/**
61 * Currently experimental code...
62 */
63#define ENABLE_LOAD_MGMT GNUNET_YES
64
65/**
66 * Size for the hash map for DHT requests from the FS 66 * Size for the hash map for DHT requests from the FS
67 * service. Should be about the number of concurrent 67 * service. Should be about the number of concurrent
68 * DHT requests we plan to make. 68 * DHT requests we plan to make.
@@ -101,6 +101,24 @@
101 * give us 5 MB/s. OTOH, obviously re-trying the same peer can be 101 * give us 5 MB/s. OTOH, obviously re-trying the same peer can be
102 * rather inefficient in larger networks, hence picking 1 is in 102 * rather inefficient in larger networks, hence picking 1 is in
103 * general not the best choice. 103 * general not the best choice.
104 *
105 * Performance measurements (for 50 MB file, 2 peers, no delays):
106 *
107 * - 1: 3300 kb/s (consistently)
108 * - 3: 2046 kb/s, 754 kb/s, 3490 kb/s
109 * - 5: 759 kb/s, 968 kb/s, 1160 kb/s
110 *
111 * Note that this does NOT mean that the value should be 1 since
112 * a 2-peer network is far from representative here (and this fails
113 * to take into consideration bandwidth wasted by repeatedly
114 * sending queries to peers that don't have the content). Also,
115 * it is expected that higher values lead to more inconsistent
116 * measurements since this only affects lost messages towards the
117 * end of the download.
118 *
119 * Finally, we should probably consider changing this and making
120 * it dependent on the number of connected peers or a related
121 * metric (bad magic constants...).
104 */ 122 */
105#define RETRY_PROBABILITY_INV 1 123#define RETRY_PROBABILITY_INV 1
106 124
@@ -1565,7 +1583,7 @@ peer_connect_handler (void *cls,
1565 uint32_t trust; 1583 uint32_t trust;
1566 1584
1567 cp = GNUNET_malloc (sizeof (struct ConnectedPeer)); 1585 cp = GNUNET_malloc (sizeof (struct ConnectedPeer));
1568 cp->transmission_delay = GNUNET_LOAD_value_init (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1586 cp->transmission_delay = GNUNET_LOAD_value_init (latency);
1569 cp->pid = GNUNET_PEER_intern (peer); 1587 cp->pid = GNUNET_PEER_intern (peer);
1570 1588
1571 fn = get_trust_filename (peer); 1589 fn = get_trust_filename (peer);
@@ -1590,6 +1608,39 @@ peer_connect_handler (void *cls,
1590 1608
1591 1609
1592/** 1610/**
1611 * Method called whenever a given peer has a status change.
1612 *
1613 * @param cls closure
1614 * @param peer peer identity this notification is about
1615 * @param latency reported latency of the connection with 'other'
1616 * @param distance reported distance (DV) to 'other'
1617 * @param bandwidth_in available amount of inbound bandwidth
1618 * @param bandwidth_out available amount of outbound bandwidth
1619 * @param timeout absolute time when this peer will time out
1620 * unless we see some further activity from it
1621 */
1622static void
1623peer_status_handler (void *cls,
1624 const struct
1625 GNUNET_PeerIdentity * peer,
1626 struct GNUNET_TIME_Relative latency,
1627 uint32_t distance,
1628 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
1629 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
1630 struct GNUNET_TIME_Absolute timeout)
1631{
1632 struct ConnectedPeer *cp;
1633
1634 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers,
1635 &peer->hashPubKey);
1636 GNUNET_assert (cp != NULL);
1637 GNUNET_LOAD_value_set_decline (cp->transmission_delay,
1638 latency);
1639}
1640
1641
1642
1643/**
1593 * Increase the host credit by a value. 1644 * Increase the host credit by a value.
1594 * 1645 *
1595 * @param host which peer to change the trust value on 1646 * @param host which peer to change the trust value on
@@ -3804,12 +3855,8 @@ process_local_reply (void *cls,
3804 gettext_noop ("# processing result set cut short due to load"), 3855 gettext_noop ("# processing result set cut short due to load"),
3805 1, 3856 1,
3806 GNUNET_NO); 3857 GNUNET_NO);
3807 /* FIXME: if this is activated, we might stall large downloads
3808 indefinitely since (presumably) the load can never go down again! */
3809#if ENABLE_LOAD_MGMT
3810 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO); 3858 GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
3811 return; 3859 return;
3812#endif
3813 } 3860 }
3814 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES); 3861 GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
3815} 3862}
@@ -4021,14 +4068,7 @@ handle_p2p_get (void *cls,
4021 "Dropping query from `%s', this peer is too busy.\n", 4068 "Dropping query from `%s', this peer is too busy.\n",
4022 GNUNET_i2s (other)); 4069 GNUNET_i2s (other));
4023#endif 4070#endif
4024 GNUNET_STATISTICS_update (stats,
4025 gettext_noop ("# requests dropped due to high load"),
4026 1,
4027 GNUNET_NO);
4028#if ENABLE_LOAD_MGMT
4029 /* FIXME: this causes problems... */
4030 return GNUNET_OK; 4071 return GNUNET_OK;
4031#endif
4032 } 4072 }
4033#if DEBUG_FS 4073#if DEBUG_FS
4034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4074 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -4053,12 +4093,7 @@ handle_p2p_get (void *cls,
4053 /* don't have BW to send to peer, or would likely take longer than we have for it, 4093 /* don't have BW to send to peer, or would likely take longer than we have for it,
4054 so at best indirect the query */ 4094 so at best indirect the query */
4055 priority = 0; 4095 priority = 0;
4056#if ENABLE_LOAD_MGMT
4057 /* FIXME: if this line is enabled, the 'perf' test for larger files simply "hangs";
4058 the cause seems to be that the load goes up (to the point where we do this)
4059 and then never goes down again... (outch) */
4060 pr->forward_only = GNUNET_YES; 4096 pr->forward_only = GNUNET_YES;
4061#endif
4062 } 4097 }
4063 pr->type = type; 4098 pr->type = type;
4064 pr->mingle = ntohl (gm->filter_mutator); 4099 pr->mingle = ntohl (gm->filter_mutator);
@@ -4457,7 +4492,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s,
4457 } 4492 }
4458 connected_peers = GNUNET_CONTAINER_multihashmap_create (enc); 4493 connected_peers = GNUNET_CONTAINER_multihashmap_create (enc);
4459 query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests); 4494 query_request_map = GNUNET_CONTAINER_multihashmap_create (max_pending_requests);
4460 rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_SECONDS); 4495 rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL);
4461 peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc); 4496 peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc);
4462 requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 4497 requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
4463 core = GNUNET_CORE_connect (sched, 4498 core = GNUNET_CORE_connect (sched,
@@ -4467,7 +4502,7 @@ main_init (struct GNUNET_SCHEDULER_Handle *s,
4467 NULL, 4502 NULL,
4468 &peer_connect_handler, 4503 &peer_connect_handler,
4469 &peer_disconnect_handler, 4504 &peer_disconnect_handler,
4470 NULL, 4505 &peer_status_handler,
4471 NULL, GNUNET_NO, 4506 NULL, GNUNET_NO,
4472 NULL, GNUNET_NO, 4507 NULL, GNUNET_NO,
4473 p2p_handlers); 4508 p2p_handlers);
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
52static struct GNUNET_TIME_Absolute start_time; 52static struct GNUNET_TIME_Absolute start_time;
53 53
54static const char *progname;
55
54static void 56static void
55do_stop (void *cls, 57do_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
236do_download (void *cls, 236do_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
263do_publish (void *cls, 269do_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 */