aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-consensus-profiler.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-08-13 23:39:08 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-08-13 23:39:08 +0000
commit4d3806a259258dcacc6c2a858967700c34b12086 (patch)
tree1b92d8346f28826ab5481cfa47321d3ea7d778ef /src/consensus/gnunet-consensus-profiler.c
parenta23b776478202335270b516010466a660fed4ad1 (diff)
downloadgnunet-4d3806a259258dcacc6c2a858967700c34b12086.tar.gz
gnunet-4d3806a259258dcacc6c2a858967700c34b12086.zip
- profiler can be verbose
Diffstat (limited to 'src/consensus/gnunet-consensus-profiler.c')
-rw-r--r--src/consensus/gnunet-consensus-profiler.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c
index 42040527f..baa6a3623 100644
--- a/src/consensus/gnunet-consensus-profiler.c
+++ b/src/consensus/gnunet-consensus-profiler.c
@@ -55,6 +55,8 @@ static unsigned int peers_done = 0;
55 55
56static unsigned *results_for_peer; 56static unsigned *results_for_peer;
57 57
58static int verbose;
59
58 60
59/** 61/**
60 * Signature of the event handler function called by the 62 * Signature of the event handler function called by the
@@ -202,10 +204,18 @@ new_element_cb (void *cls,
202 const struct GNUNET_SET_Element *element) 204 const struct GNUNET_SET_Element *element)
203{ 205{
204 struct GNUNET_CONSENSUS_Handle **chp = cls; 206 struct GNUNET_CONSENSUS_Handle **chp = cls;
207 int idx = chp - consensus_handles;
205 208
206 GNUNET_assert (NULL != cls); 209 GNUNET_assert (NULL != cls);
207 210
208 results_for_peer[chp - consensus_handles]++; 211 results_for_peer[idx]++;
212
213 GNUNET_assert (sizeof (struct GNUNET_HashCode) == element->size);
214
215 if (GNUNET_YES == verbose)
216 {
217 printf ("P%d received %s\n", idx, GNUNET_h2s ((struct GNUNET_HashCode *) element->data));
218 }
209} 219}
210 220
211 221
@@ -389,6 +399,9 @@ main (int argc, char **argv)
389 { 't', "timeout", NULL, 399 { 't', "timeout", NULL,
390 gettext_noop ("consensus timeout"), 400 gettext_noop ("consensus timeout"),
391 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &conclude_timeout }, 401 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &conclude_timeout },
402 { 'V', "verbose", NULL,
403 gettext_noop ("be more verbose (print received values)"),
404 GNUNET_NO, &GNUNET_GETOPT_set_one, &verbose },
392 GNUNET_GETOPT_OPTION_END 405 GNUNET_GETOPT_OPTION_END
393 }; 406 };
394 conclude_timeout = GNUNET_TIME_UNIT_SECONDS; 407 conclude_timeout = GNUNET_TIME_UNIT_SECONDS;