aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-12-13 17:01:09 +0000
committerBart Polot <bart@net.in.tum.de>2011-12-13 17:01:09 +0000
commit01b9a6008fd38eef9b3951aa4b8345566f09a13b (patch)
tree60491aeb9a364f8c9a78c1aaaf6e40bbd132d115 /src/nse
parente97989b0bab8d38c26ea87a440a2e5fca3e8bb80 (diff)
downloadgnunet-01b9a6008fd38eef9b3951aa4b8345566f09a13b.tar.gz
gnunet-01b9a6008fd38eef9b3951aa4b8345566f09a13b.zip
- Wrong file commited, fixed.
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-nse-profiler.c40
-rw-r--r--src/nse/gnunet-service-nse.c4
2 files changed, 35 insertions, 9 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 988e6e15a..cf61d7ee8 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -50,6 +50,11 @@ struct NSEPeer
50struct StatsContext 50struct StatsContext
51{ 51{
52 /** 52 /**
53 * Whether or not shoutdown after finishing.
54 */
55 int shutdown;
56
57 /**
53 * How many messages have peers received during the test. 58 * How many messages have peers received during the test.
54 */ 59 */
55 unsigned long long total_nse_received_messages; 60 unsigned long long total_nse_received_messages;
@@ -397,7 +402,8 @@ stats_finished_callback (void *cls, int success)
397 /* Stats lookup successful, write out data */ 402 /* Stats lookup successful, write out data */
398 buf = NULL; 403 buf = NULL;
399 buf_len = 404 buf_len =
400 GNUNET_asprintf (&buf, "TOTAL_NSE_RECEIVED_MESSAGES: %u\n", 405 GNUNET_asprintf (&buf, "TOTAL_NSE_RECEIVED_MESSAGES_%d: %u \n",
406 stats_context->shutdown,
401 stats_context->total_nse_received_messages); 407 stats_context->total_nse_received_messages);
402 if (buf_len > 0) 408 if (buf_len > 0)
403 { 409 {
@@ -406,8 +412,9 @@ stats_finished_callback (void *cls, int success)
406 GNUNET_free_non_null (buf); 412 GNUNET_free_non_null (buf);
407 buf = NULL; 413 buf = NULL;
408 buf_len = 414 buf_len =
409 GNUNET_asprintf (&buf, "TOTAL_NSE_SENT_MESSAGES: %u\n", 415 GNUNET_asprintf (&buf, "TOTAL_NSE_SENT_MESSAGES_%d: %u\n",
410 stats_context->total_nse_sent_messages); 416 stats_context->shutdown,
417 stats_context->total_nse_received_messages);
411 if (buf_len > 0) 418 if (buf_len > 0)
412 { 419 {
413 GNUNET_DISK_file_write (data_file, buf, buf_len); 420 GNUNET_DISK_file_write (data_file, buf, buf_len);
@@ -415,8 +422,16 @@ stats_finished_callback (void *cls, int success)
415 GNUNET_free_non_null (buf); 422 GNUNET_free_non_null (buf);
416 } 423 }
417 424
418 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == shutdown_handle); 425 if (GNUNET_YES == stats_context->shutdown)
419 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 426 {
427 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == shutdown_handle);
428 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
429 }
430 else
431 {
432 GNUNET_assert (churn_task == GNUNET_SCHEDULER_NO_TASK);
433 churn_task = GNUNET_SCHEDULER_add_now (&churn_peers, NULL);
434 }
420 GNUNET_free (stats_context); 435 GNUNET_free (stats_context);
421} 436}
422 437
@@ -517,12 +532,23 @@ disconnect_nse_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
517 &peers_next_round)) 532 &peers_next_round))
518 { 533 {
519 current_round++; 534 current_round++;
520 GNUNET_assert (churn_task == GNUNET_SCHEDULER_NO_TASK); 535 if (current_round == 1)
521 churn_task = GNUNET_SCHEDULER_add_now (&churn_peers, NULL); 536 {
537 stats_context = GNUNET_malloc (sizeof (struct StatsContext));
538 stats_context->shutdown = GNUNET_NO;
539 GNUNET_TESTING_get_statistics (pg, &stats_finished_callback,
540 &statistics_iterator, stats_context);
541 }
542 else
543 {
544 GNUNET_assert (churn_task == GNUNET_SCHEDULER_NO_TASK);
545 churn_task = GNUNET_SCHEDULER_add_now (&churn_peers, NULL);
546 }
522 } 547 }
523 else /* No more rounds, let's shut it down! */ 548 else /* No more rounds, let's shut it down! */
524 { 549 {
525 stats_context = GNUNET_malloc (sizeof (struct StatsContext)); 550 stats_context = GNUNET_malloc (sizeof (struct StatsContext));
551 stats_context->shutdown = GNUNET_YES;
526 GNUNET_SCHEDULER_cancel (shutdown_handle); 552 GNUNET_SCHEDULER_cancel (shutdown_handle);
527 shutdown_handle = GNUNET_SCHEDULER_NO_TASK; 553 shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
528 GNUNET_TESTING_get_statistics (pg, &stats_finished_callback, 554 GNUNET_TESTING_get_statistics (pg, &stats_finished_callback,
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 7c223190e..5bf320ac4 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -59,7 +59,7 @@
59 * production). The associated code should also probably be removed 59 * production). The associated code should also probably be removed
60 * once we're done with experiments. 60 * once we're done with experiments.
61 */ 61 */
62#define ENABLE_HISTOGRAM GNUNET_YES 62#define ENABLE_HISTOGRAM GNUNET_NO
63 63
64/** 64/**
65 * Over how many values do we calculate the weighted average? 65 * Over how many values do we calculate the weighted average?
@@ -301,7 +301,7 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
301 double val; 301 double val;
302 double nsize; 302 double nsize;
303 303
304#define WEST 0 304#define WEST 1
305 /* Weighted incremental algorithm for stddev according to West (1979) */ 305 /* Weighted incremental algorithm for stddev according to West (1979) */
306#if WEST 306#if WEST
307 double sumweight; 307 double sumweight;