aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-07-11 23:59:50 +0200
committerChristian Grothoff <christian@grothoff.org>2018-07-11 23:59:50 +0200
commit92e1498718d150df76d41e610b70df5aabd5f467 (patch)
treed7a4b393cde0fb6f6b34cac546d019a4391e8319
parent26a43982bf3b705770603828043a92663e8dc280 (diff)
parent08159b18571f395aace0cfa11562517109900305 (diff)
downloadgnunet-92e1498718d150df76d41e610b70df5aabd5f467.tar.gz
gnunet-92e1498718d150df76d41e610b70df5aabd5f467.zip
Merge branch 'master' of git+ssh://gnunet.org/gnunet
-rw-r--r--doc/documentation/chapters/preface.texi29
-rw-r--r--doc/documentation/gnunet.texi2
-rw-r--r--src/rps/gnunet-rps-profiler.c273
3 files changed, 215 insertions, 89 deletions
diff --git a/doc/documentation/chapters/preface.texi b/doc/documentation/chapters/preface.texi
index 65e627368..29cf924a2 100644
--- a/doc/documentation/chapters/preface.texi
+++ b/doc/documentation/chapters/preface.texi
@@ -12,9 +12,9 @@ all kinds of basic applications for the foundation of a new Internet.
12 12
13@menu 13@menu
14* About this book:: 14* About this book::
15* Contributing to this book::
15* Introduction:: 16* Introduction::
16* Project governance:: 17* Project governance::
17* General Terminology::
18* Typography:: 18* Typography::
19@end menu 19@end menu
20 20
@@ -37,6 +37,26 @@ The first chapter (``Preface'') as well as the the second
37chapter (``Philosophy'') give an introduction to GNUnet as a project, 37chapter (``Philosophy'') give an introduction to GNUnet as a project,
38what GNUnet tries to achieve. 38what GNUnet tries to achieve.
39 39
40@node Contributing to this book
41@section Contributing to this book
42
43The GNUnet Reference Manual is a collective work produced by various
44people throughout the years. The version you are reading is derived
45from many individual efforts hosted on our website. This was a failed
46experiment, and with the conversion to Texinfo we hope to address this
47in the longterm. Texinfo is the documentation language of the GNU project.
48While it can be intimidating at first and look scary or complicated,
49it is just another way to express text format instructions. We encourage
50you to take this opportunity and learn about Texinfo, learn about GNUnet,
51and one word at a time we will arrive at a book which explains GNUnet in
52the least complicated way to you. Even when you don't want or can't learn
53Texinfo, you can contribute. Send us an Email or join our IRC chat room
54on freenode and talk with us about the documentation (the prefered way
55to reach out is the mailinglist, since you can communicate with us
56without waiting on someone in the chatroom). One way or another you
57can help shape the understanding of GNUnet without the ability to read
58and understand its sourcecode.
59
40@node Introduction 60@node Introduction
41@section Introduction 61@section Introduction
42 62
@@ -139,13 +159,6 @@ GNUnet e.V. may also choose to adjust the license of the
139software (with the constraint that it has to remain free software)@footnote{For example in 2018 we switched from GPL3 to AGPL3. In practice these changes do not happen very often.} 159software (with the constraint that it has to remain free software)@footnote{For example in 2018 we switched from GPL3 to AGPL3. In practice these changes do not happen very often.}
140 160
141 161
142@node General Terminology
143@section General Terminology
144
145In the following manual we may use words that can not be found in the
146Appendix. Since we want to keep the manual selfcontained, we will
147explain words here.
148
149@node Typography 162@node Typography
150@section Typography 163@section Typography
151 164
diff --git a/doc/documentation/gnunet.texi b/doc/documentation/gnunet.texi
index 3cce4deb8..50630d4fe 100644
--- a/doc/documentation/gnunet.texi
+++ b/doc/documentation/gnunet.texi
@@ -101,8 +101,8 @@ This document is the Reference Manual for GNUnet version @value{VERSION}.
101Preface 101Preface
102 102
103* About this book 103* About this book
104* Contributing to this book
104* Introduction 105* Introduction
105* General Terminology::
106* Typography:: 106* Typography::
107 107
108Philosophy 108Philosophy
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 09797eaf7..02259d628 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -49,7 +49,11 @@ static unsigned bits_needed;
49/** 49/**
50 * How long do we run the test? 50 * How long do we run the test?
51 */ 51 */
52//#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 52static struct GNUNET_TIME_Relative duration;
53
54/**
55 * When do we do a hard shutdown?
56 */
53static struct GNUNET_TIME_Relative timeout; 57static struct GNUNET_TIME_Relative timeout;
54 58
55 59
@@ -446,6 +450,10 @@ struct RPSPeer
446 * @brief statistics values 450 * @brief statistics values
447 */ 451 */
448 uint64_t stats[STAT_TYPE_MAX]; 452 uint64_t stats[STAT_TYPE_MAX];
453 /**
454 * @brief Handle for the statistics get request
455 */
456 struct GNUNET_STATISTICS_GetHandle *h_stat_get[STAT_TYPE_MAX];
449}; 457};
450 458
451/** 459/**
@@ -489,15 +497,16 @@ static unsigned int view_sizes;
489static int ok; 497static int ok;
490 498
491/** 499/**
492 * Identifier for the churn task that runs periodically 500 * Identifier for the task that runs after the test to collect results
493 */ 501 */
494static struct GNUNET_SCHEDULER_Task *post_test_task; 502static struct GNUNET_SCHEDULER_Task *post_test_task;
495 503
496/** 504/**
497 * Identifier for the churn task that runs periodically 505 * Identifier for the shutdown task
498 */ 506 */
499static struct GNUNET_SCHEDULER_Task *shutdown_task; 507static struct GNUNET_SCHEDULER_Task *shutdown_task;
500 508
509
501/** 510/**
502 * Identifier for the churn task that runs periodically 511 * Identifier for the churn task that runs periodically
503 */ 512 */
@@ -874,6 +883,81 @@ static int check_statistics_collect_completed ()
874 return GNUNET_YES; 883 return GNUNET_YES;
875} 884}
876 885
886
887static void
888cancel_pending_req (struct PendingRequest *pending_req)
889{
890 struct RPSPeer *rps_peer;
891
892 rps_peer = pending_req->rps_peer;
893 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
894 rps_peer->pending_req_tail,
895 pending_req);
896 rps_peer->num_pending_reqs--;
897 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
898 "Cancelling pending rps get request\n");
899 GNUNET_SCHEDULER_cancel (pending_req->request_task);
900 GNUNET_free (pending_req);
901}
902
903static void
904cancel_request (struct PendingReply *pending_rep)
905{
906 struct RPSPeer *rps_peer;
907
908 rps_peer = pending_rep->rps_peer;
909 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_rep_head,
910 rps_peer->pending_rep_tail,
911 pending_rep);
912 rps_peer->num_pending_reps--;
913 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
914 "Cancelling rps get reply\n");
915 GNUNET_RPS_request_cancel (pending_rep->req_handle);
916 GNUNET_free (pending_rep);
917}
918
919void
920clean_peer (unsigned peer_index)
921{
922 struct PendingReply *pending_rep;
923 struct PendingRequest *pending_req;
924
925 pending_rep = rps_peers[peer_index].pending_rep_head;
926 while (NULL != (pending_rep = rps_peers[peer_index].pending_rep_head))
927 {
928 cancel_request (pending_rep);
929 }
930 pending_req = rps_peers[peer_index].pending_req_head;
931 while (NULL != (pending_req = rps_peers[peer_index].pending_req_head))
932 {
933 cancel_pending_req (pending_req);
934 }
935 if (NULL != rps_peers[peer_index].rps_handle)
936 {
937 GNUNET_RPS_disconnect (rps_peers[peer_index].rps_handle);
938 rps_peers[peer_index].rps_handle = NULL;
939 }
940 for (unsigned stat_type = STAT_TYPE_ROUNDS;
941 stat_type < STAT_TYPE_MAX;
942 stat_type++)
943 {
944 if (NULL != rps_peers[peer_index].h_stat_get[stat_type])
945 {
946 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
947 "(%u) did not yet receive stat value for `%s'\n",
948 rps_peers[peer_index].index,
949 stat_type_2_str (stat_type));
950 GNUNET_STATISTICS_get_cancel (
951 rps_peers[peer_index].h_stat_get[stat_type]);
952 }
953 }
954 if (NULL != rps_peers[peer_index].op)
955 {
956 GNUNET_TESTBED_operation_done (rps_peers[peer_index].op);
957 rps_peers[peer_index].op = NULL;
958 }
959}
960
877/** 961/**
878 * Task run on timeout to shut everything down. 962 * Task run on timeout to shut everything down.
879 */ 963 */
@@ -881,10 +965,17 @@ static void
881shutdown_op (void *cls) 965shutdown_op (void *cls)
882{ 966{
883 unsigned int i; 967 unsigned int i;
968 struct OpListEntry *entry;
884 969
885 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 970 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
886 "Shutdown task scheduled, going down.\n"); 971 "Shutdown task scheduled, going down.\n");
887 in_shutdown = GNUNET_YES; 972 in_shutdown = GNUNET_YES;
973
974 if (NULL != shutdown_task)
975 {
976 GNUNET_SCHEDULER_cancel (shutdown_task);
977 shutdown_task = NULL;
978 }
888 if (NULL != post_test_task) 979 if (NULL != post_test_task)
889 { 980 {
890 GNUNET_SCHEDULER_cancel (post_test_task); 981 GNUNET_SCHEDULER_cancel (post_test_task);
@@ -895,24 +986,34 @@ shutdown_op (void *cls)
895 GNUNET_SCHEDULER_cancel (churn_task); 986 GNUNET_SCHEDULER_cancel (churn_task);
896 churn_task = NULL; 987 churn_task = NULL;
897 } 988 }
989 entry = oplist_head;
990 while (NULL != (entry = oplist_head))
991 {
992 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
993 "Operation still pending on shutdown (%u)\n",
994 entry->index);
995 GNUNET_TESTBED_operation_done (entry->op);
996 GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
997 GNUNET_free (entry);
998 }
898 for (i = 0; i < num_peers; i++) 999 for (i = 0; i < num_peers; i++)
899 { 1000 {
900 if (NULL != rps_peers[i].rps_handle) 1001 clean_peer (i);
901 {
902 GNUNET_RPS_disconnect (rps_peers[i].rps_handle);
903 rps_peers[i].rps_handle = NULL;
904 }
905 if (NULL != rps_peers[i].op)
906 {
907 GNUNET_TESTBED_operation_done (rps_peers[i].op);
908 rps_peers[i].op = NULL;
909 }
910 } 1002 }
911} 1003}
912 1004
1005static void
1006trigger_shutdown (void *cls)
1007{
1008 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1009 "Shutdown was triggerd by timeout, going down.\n");
1010 shutdown_task = NULL;
1011 GNUNET_SCHEDULER_shutdown ();
1012}
1013
913 1014
914/** 1015/**
915 * Task run on timeout to collect statistics and potentially shut down. 1016 * Task run after #duration to collect statistics and potentially shut down.
916 */ 1017 */
917static void 1018static void
918post_test_op (void *cls) 1019post_test_op (void *cls)
@@ -922,7 +1023,7 @@ post_test_op (void *cls)
922 post_test_task = NULL; 1023 post_test_task = NULL;
923 post_test = GNUNET_YES; 1024 post_test = GNUNET_YES;
924 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1025 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
925 "Post test task scheduled, going down.\n"); 1026 "Post test task scheduled.\n");
926 if (NULL != churn_task) 1027 if (NULL != churn_task)
927 { 1028 {
928 GNUNET_SCHEDULER_cancel (churn_task); 1029 GNUNET_SCHEDULER_cancel (churn_task);
@@ -946,7 +1047,7 @@ post_test_op (void *cls)
946 GNUNET_YES == check_statistics_collect_completed()) 1047 GNUNET_YES == check_statistics_collect_completed())
947 { 1048 {
948 GNUNET_SCHEDULER_cancel (shutdown_task); 1049 GNUNET_SCHEDULER_cancel (shutdown_task);
949 shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL); 1050 shutdown_task = NULL;
950 GNUNET_SCHEDULER_shutdown (); 1051 GNUNET_SCHEDULER_shutdown ();
951 } 1052 }
952} 1053}
@@ -1033,9 +1134,9 @@ info_cb (void *cb_cls,
1033 */ 1134 */
1034static void 1135static void
1035rps_connect_complete_cb (void *cls, 1136rps_connect_complete_cb (void *cls,
1036 struct GNUNET_TESTBED_Operation *op, 1137 struct GNUNET_TESTBED_Operation *op,
1037 void *ca_result, 1138 void *ca_result,
1038 const char *emsg) 1139 const char *emsg)
1039{ 1140{
1040 struct RPSPeer *rps_peer = cls; 1141 struct RPSPeer *rps_peer = cls;
1041 struct GNUNET_RPS_Handle *rps = ca_result; 1142 struct GNUNET_RPS_Handle *rps = ca_result;
@@ -1060,7 +1161,9 @@ rps_connect_complete_cb (void *cls,
1060 return; 1161 return;
1061 } 1162 }
1062 1163
1063 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started client successfully\n"); 1164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1165 "Started client successfully (%u)\n",
1166 rps_peer->index);
1064 1167
1065 cur_test_run.main_test (rps_peer); 1168 cur_test_run.main_test (rps_peer);
1066} 1169}
@@ -1078,7 +1181,7 @@ rps_connect_complete_cb (void *cls,
1078 */ 1181 */
1079static void * 1182static void *
1080rps_connect_adapter (void *cls, 1183rps_connect_adapter (void *cls,
1081 const struct GNUNET_CONFIGURATION_Handle *cfg) 1184 const struct GNUNET_CONFIGURATION_Handle *cfg)
1082{ 1185{
1083 struct GNUNET_RPS_Handle *h; 1186 struct GNUNET_RPS_Handle *h;
1084 1187
@@ -1170,12 +1273,14 @@ stat_complete_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
1170 */ 1273 */
1171static void 1274static void
1172rps_disconnect_adapter (void *cls, 1275rps_disconnect_adapter (void *cls,
1173 void *op_result) 1276 void *op_result)
1174{ 1277{
1175 struct RPSPeer *peer = cls; 1278 struct RPSPeer *peer = cls;
1176 struct GNUNET_RPS_Handle *h = op_result; 1279 struct GNUNET_RPS_Handle *h = op_result;
1177 1280
1178 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect_adapter()\n"); 1281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1282 "disconnect_adapter (%u)\n",
1283 peer->index);
1179 GNUNET_assert (NULL != peer); 1284 GNUNET_assert (NULL != peer);
1180 if (NULL != peer->rps_handle) 1285 if (NULL != peer->rps_handle)
1181 { 1286 {
@@ -1226,13 +1331,15 @@ default_reply_handle (void *cls,
1226 rps_peer->num_recv_ids++; 1331 rps_peer->num_recv_ids++;
1227 } 1332 }
1228 1333
1229 if (0 == evaluate () && HAVE_QUICK_QUIT == cur_test_run.have_quick_quit) 1334 if (GNUNET_YES != post_test) return;
1335 if (HAVE_QUICK_QUIT != cur_test_run.have_quick_quit) return;
1336 if (0 == evaluate())
1230 { 1337 {
1231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test succeeded before timeout\n"); 1338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1232 GNUNET_assert (NULL != post_test_task); 1339 "Test succeeded before end of duration\n");
1233 GNUNET_SCHEDULER_cancel (post_test_task); 1340 if (NULL != post_test_task) GNUNET_SCHEDULER_cancel (post_test_task);
1234 post_test_task = GNUNET_SCHEDULER_add_now (&post_test_op, NULL); 1341 post_test_task = GNUNET_SCHEDULER_add_now (&post_test_op, NULL);
1235 GNUNET_assert (NULL!= post_test_task); 1342 GNUNET_assert (NULL != post_test_task);
1236 } 1343 }
1237} 1344}
1238 1345
@@ -1246,13 +1353,13 @@ request_peers (void *cls)
1246 struct RPSPeer *rps_peer; 1353 struct RPSPeer *rps_peer;
1247 struct PendingReply *pending_rep; 1354 struct PendingReply *pending_rep;
1248 1355
1249 if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test)
1250 return;
1251 rps_peer = pending_req->rps_peer; 1356 rps_peer = pending_req->rps_peer;
1252 GNUNET_assert (1 <= rps_peer->num_pending_reqs); 1357 GNUNET_assert (1 <= rps_peer->num_pending_reqs);
1253 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head, 1358 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
1254 rps_peer->pending_req_tail, 1359 rps_peer->pending_req_tail,
1255 pending_req); 1360 pending_req);
1361 rps_peer->num_pending_reqs--;
1362 if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) return;
1256 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1257 "Requesting one peer\n"); 1364 "Requesting one peer\n");
1258 pending_rep = GNUNET_new (struct PendingReply); 1365 pending_rep = GNUNET_new (struct PendingReply);
@@ -1265,39 +1372,6 @@ request_peers (void *cls)
1265 rps_peer->pending_rep_tail, 1372 rps_peer->pending_rep_tail,
1266 pending_rep); 1373 pending_rep);
1267 rps_peer->num_pending_reps++; 1374 rps_peer->num_pending_reps++;
1268 rps_peer->num_pending_reqs--;
1269}
1270
1271static void
1272cancel_pending_req (struct PendingRequest *pending_req)
1273{
1274 struct RPSPeer *rps_peer;
1275
1276 rps_peer = pending_req->rps_peer;
1277 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
1278 rps_peer->pending_req_tail,
1279 pending_req);
1280 rps_peer->num_pending_reqs--;
1281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1282 "Cancelling pending request\n");
1283 GNUNET_SCHEDULER_cancel (pending_req->request_task);
1284 GNUNET_free (pending_req);
1285}
1286
1287static void
1288cancel_request (struct PendingReply *pending_rep)
1289{
1290 struct RPSPeer *rps_peer;
1291
1292 rps_peer = pending_rep->rps_peer;
1293 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_rep_head,
1294 rps_peer->pending_rep_tail,
1295 pending_rep);
1296 rps_peer->num_pending_reps--;
1297 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1298 "Cancelling request\n");
1299 GNUNET_RPS_request_cancel (pending_rep->req_handle);
1300 GNUNET_free (pending_rep);
1301} 1375}
1302 1376
1303 1377
@@ -2313,6 +2387,8 @@ post_test_shutdown_ready_cb (void *cls,
2313{ 2387{
2314 struct STATcls *stat_cls = (struct STATcls *) cls; 2388 struct STATcls *stat_cls = (struct STATcls *) cls;
2315 struct RPSPeer *rps_peer = stat_cls->rps_peer; 2389 struct RPSPeer *rps_peer = stat_cls->rps_peer;
2390
2391 rps_peer->h_stat_get[stat_cls->stat_type] = NULL;
2316 if (GNUNET_OK == success) 2392 if (GNUNET_OK == success)
2317 { 2393 {
2318 /* set flag that we we got the value */ 2394 /* set flag that we we got the value */
@@ -2364,6 +2440,7 @@ stat_iterator (void *cls,
2364{ 2440{
2365 const struct STATcls *stat_cls = (const struct STATcls *) cls; 2441 const struct STATcls *stat_cls = (const struct STATcls *) cls;
2366 struct RPSPeer *rps_peer = (struct RPSPeer *) stat_cls->rps_peer; 2442 struct RPSPeer *rps_peer = (struct RPSPeer *) stat_cls->rps_peer;
2443
2367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got stat value: %s - %" PRIu64 "\n", 2444 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got stat value: %s - %" PRIu64 "\n",
2368 //stat_type_2_str (stat_cls->stat_type), 2445 //stat_type_2_str (stat_cls->stat_type),
2369 name, 2446 name,
@@ -2456,12 +2533,13 @@ void post_profiler (struct RPSPeer *rps_peer)
2456 stat_cls->stat_type = stat_type; 2533 stat_cls->stat_type = stat_type;
2457 rps_peer->file_name_stats = 2534 rps_peer->file_name_stats =
2458 store_prefix_file_name (rps_peer->peer_id, "stats"); 2535 store_prefix_file_name (rps_peer->peer_id, "stats");
2459 GNUNET_STATISTICS_get (rps_peer->stats_h, 2536 rps_peer->h_stat_get[stat_type] = GNUNET_STATISTICS_get (
2460 "rps", 2537 rps_peer->stats_h,
2461 stat_type_2_str (stat_type), 2538 "rps",
2462 post_test_shutdown_ready_cb, 2539 stat_type_2_str (stat_type),
2463 stat_iterator, 2540 post_test_shutdown_ready_cb,
2464 (struct STATcls *) stat_cls); 2541 stat_iterator,
2542 (struct STATcls *) stat_cls);
2465 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2466 "Requested statistics for %s (peer %" PRIu32 ")\n", 2544 "Requested statistics for %s (peer %" PRIu32 ")\n",
2467 stat_type_2_str (stat_type), 2545 stat_type_2_str (stat_type),
@@ -2556,6 +2634,8 @@ test_run (void *cls,
2556 /* Connect all peers to statistics service */ 2634 /* Connect all peers to statistics service */
2557 if (COLLECT_STATISTICS == cur_test_run.have_collect_statistics) 2635 if (COLLECT_STATISTICS == cur_test_run.have_collect_statistics)
2558 { 2636 {
2637 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2638 "Connecting to statistics service\n");
2559 rps_peers[i].stat_op = 2639 rps_peers[i].stat_op =
2560 GNUNET_TESTBED_service_connect (NULL, 2640 GNUNET_TESTBED_service_connect (NULL,
2561 peers[i], 2641 peers[i],
@@ -2570,12 +2650,12 @@ test_run (void *cls,
2570 2650
2571 if (NULL != churn_task) 2651 if (NULL != churn_task)
2572 GNUNET_SCHEDULER_cancel (churn_task); 2652 GNUNET_SCHEDULER_cancel (churn_task);
2573 post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); 2653 post_test_task = GNUNET_SCHEDULER_add_delayed (duration, &post_test_op, NULL);
2574 timeout = GNUNET_TIME_relative_multiply (timeout, 0.2 + (0.01 * num_peers)); 2654 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "timeout for shutdown is %lu\n", timeout.rel_value_us/1000000);
2575 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "timeout for hard shutdown is %u\n", timeout.rel_value_us/1000000); 2655 shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout,
2576 shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); 2656 &trigger_shutdown,
2577 shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); 2657 NULL);
2578 2658 GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL);
2579} 2659}
2580 2660
2581 2661
@@ -2611,7 +2691,7 @@ run (void *cls,
2611 if (0 == cur_test_run.num_requests) cur_test_run.num_requests = 5; 2691 if (0 == cur_test_run.num_requests) cur_test_run.num_requests = 5;
2612 //cur_test_run.have_churn = HAVE_CHURN; 2692 //cur_test_run.have_churn = HAVE_CHURN;
2613 cur_test_run.have_churn = HAVE_NO_CHURN; 2693 cur_test_run.have_churn = HAVE_NO_CHURN;
2614 cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; 2694 cur_test_run.have_quick_quit = HAVE_QUICK_QUIT;
2615 cur_test_run.have_collect_statistics = COLLECT_STATISTICS; 2695 cur_test_run.have_collect_statistics = COLLECT_STATISTICS;
2616 cur_test_run.stat_collect_flags = BIT(STAT_TYPE_ROUNDS) | 2696 cur_test_run.stat_collect_flags = BIT(STAT_TYPE_ROUNDS) |
2617 BIT(STAT_TYPE_BLOCKS) | 2697 BIT(STAT_TYPE_BLOCKS) |
@@ -2634,10 +2714,38 @@ run (void *cls,
2634 /* 'Clean' directory */ 2714 /* 'Clean' directory */
2635 (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); 2715 (void) GNUNET_DISK_directory_remove ("/tmp/rps/");
2636 GNUNET_DISK_directory_create ("/tmp/rps/"); 2716 GNUNET_DISK_directory_create ("/tmp/rps/");
2637 if (0 == timeout.rel_value_us) 2717 if (0 == duration.rel_value_us)
2638 { 2718 {
2639 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90); 2719 if (0 == timeout.rel_value_us)
2720 {
2721 duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90);
2722 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2723 (90 * 1.2) +
2724 (0.01 * num_peers));
2725 }
2726 else
2727 {
2728 duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2729 (timeout.rel_value_us/1000000)
2730 * 0.75);
2731 }
2640 } 2732 }
2733 else
2734 {
2735 if (0 == timeout.rel_value_us)
2736 {
2737 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2738 ((duration.rel_value_us/1000000)
2739 * 1.2) + (0.01 * num_peers));
2740 }
2741 }
2742 GNUNET_assert (duration.rel_value_us < timeout.rel_value_us);
2743 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2744 "duration is %lus\n",
2745 duration.rel_value_us/1000000);
2746 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2747 "timeout is %lus\n",
2748 timeout.rel_value_us/1000000);
2641 2749
2642 /* Compute number of bits for representing largest peer id */ 2750 /* Compute number of bits for representing largest peer id */
2643 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++) 2751 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++)
@@ -2687,6 +2795,12 @@ main (int argc, char *argv[])
2687 gettext_noop ("number of peers to start"), 2795 gettext_noop ("number of peers to start"),
2688 &num_peers), 2796 &num_peers),
2689 2797
2798 GNUNET_GETOPT_option_relative_time ('d',
2799 "duration",
2800 "DURATION",
2801 gettext_noop ("duration of the profiling"),
2802 &duration),
2803
2690 GNUNET_GETOPT_option_relative_time ('t', 2804 GNUNET_GETOPT_option_relative_time ('t',
2691 "timeout", 2805 "timeout",
2692 "TIMEOUT", 2806 "TIMEOUT",
@@ -2734,7 +2848,6 @@ main (int argc, char *argv[])
2734 GNUNET_free (rps_peers); 2848 GNUNET_free (rps_peers);
2735 GNUNET_free (rps_peer_ids); 2849 GNUNET_free (rps_peer_ids);
2736 GNUNET_CONTAINER_multipeermap_destroy (peer_map); 2850 GNUNET_CONTAINER_multipeermap_destroy (peer_map);
2737 printf ("test -1\n");
2738 return ret_value; 2851 return ret_value;
2739} 2852}
2740 2853