diff options
author | Florian Dold <florian.dold@gmail.com> | 2013-08-13 23:39:08 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2013-08-13 23:39:08 +0000 |
commit | 4d3806a259258dcacc6c2a858967700c34b12086 (patch) | |
tree | 1b92d8346f28826ab5481cfa47321d3ea7d778ef /src/consensus/gnunet-consensus-profiler.c | |
parent | a23b776478202335270b516010466a660fed4ad1 (diff) | |
download | gnunet-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.c | 15 |
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 | ||
56 | static unsigned *results_for_peer; | 56 | static unsigned *results_for_peer; |
57 | 57 | ||
58 | static 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; |