aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-mesh-profiler.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-03-22 02:58:22 +0000
committerBart Polot <bart@net.in.tum.de>2014-03-22 02:58:22 +0000
commit40d3298c64ca4f81c09062be08ead120b5705df6 (patch)
tree299342b026d674a904541b303101c5b17aa252c1 /src/mesh/gnunet-mesh-profiler.c
parent000c31c37814757424ee0583c49d6583d2b29231 (diff)
downloadgnunet-40d3298c64ca4f81c09062be08ead120b5705df6.tar.gz
gnunet-40d3298c64ca4f81c09062be08ead120b5705df6.zip
- start test only after warmup
Diffstat (limited to 'src/mesh/gnunet-mesh-profiler.c')
-rw-r--r--src/mesh/gnunet-mesh-profiler.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesh/gnunet-mesh-profiler.c b/src/mesh/gnunet-mesh-profiler.c
index dbbff157b..9545e347c 100644
--- a/src/mesh/gnunet-mesh-profiler.c
+++ b/src/mesh/gnunet-mesh-profiler.c
@@ -233,6 +233,11 @@ static unsigned int current_round;
233static int do_warmup; 233static int do_warmup;
234 234
235/** 235/**
236 * Warmup progress.
237 */
238static unsigned int peers_warmup;
239
240/**
236 * Flag to notify callbacks not to generate any new traffic anymore. 241 * Flag to notify callbacks not to generate any new traffic anymore.
237 */ 242 */
238static int test_finished; 243static int test_finished;
@@ -776,6 +781,11 @@ incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
776 { 781 {
777 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u <= %u\n", 782 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u <= %u\n",
778 n, get_index (peer), channel); 783 n, get_index (peer), channel);
784 peers_warmup++;
785 if (peers_warmup < peers_total)
786 return NULL;
787 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
788 &start_test, NULL);
779 return NULL; 789 return NULL;
780 } 790 }
781 GNUNET_assert (peer == peers[n].incoming); 791 GNUNET_assert (peer == peers[n].incoming);
@@ -923,7 +933,6 @@ peer_id_cb (void *cls,
923 const char *emsg) 933 const char *emsg)
924{ 934{
925 long n = (long) cls; 935 long n = (long) cls;
926 struct GNUNET_TIME_Relative delay;
927 936
928 if (NULL == pinfo || NULL != emsg) 937 if (NULL == pinfo || NULL != emsg)
929 { 938 {
@@ -946,10 +955,12 @@ peer_id_cb (void *cls,
946 return; 955 return;
947 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got all IDs, starting profiler\n"); 956 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got all IDs, starting profiler\n");
948 if (do_warmup) 957 if (do_warmup)
958 {
949 warmup(); 959 warmup();
950 delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 960 return; /* start_test from incoming_channel */
951 150 * peers_total); 961 }
952 test_task = GNUNET_SCHEDULER_add_delayed (delay, &start_test, NULL); 962 test_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
963 &start_test, NULL);
953} 964}
954 965
955/** 966/**