diff options
Diffstat (limited to 'src/consensus/gnunet-consensus-profiler.c')
-rw-r--r-- | src/consensus/gnunet-consensus-profiler.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c index a075cc291..143264f21 100644 --- a/src/consensus/gnunet-consensus-profiler.c +++ b/src/consensus/gnunet-consensus-profiler.c | |||
@@ -86,6 +86,44 @@ controller_cb (void *cls, | |||
86 | 86 | ||
87 | 87 | ||
88 | static void | 88 | static void |
89 | statistics_done_db (void *cls, | ||
90 | struct | ||
91 | GNUNET_TESTBED_Operation | ||
92 | *op, | ||
93 | const char *emsg) | ||
94 | { | ||
95 | GNUNET_assert (NULL == emsg); | ||
96 | GNUNET_TESTBED_operation_done (op); | ||
97 | printf ("statistics done\n"); | ||
98 | GNUNET_SCHEDULER_shutdown (); | ||
99 | } | ||
100 | |||
101 | |||
102 | /** | ||
103 | * Callback function to process statistic values from all peers. | ||
104 | * | ||
105 | * @param cls closure | ||
106 | * @param peer the peer the statistic belong to | ||
107 | * @param subsystem name of subsystem that created the statistic | ||
108 | * @param name the name of the datum | ||
109 | * @param value the current value | ||
110 | * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not | ||
111 | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | ||
112 | */ | ||
113 | static int | ||
114 | statistics_cb (void *cls, | ||
115 | const struct GNUNET_TESTBED_Peer *peer, | ||
116 | const char *subsystem, | ||
117 | const char *name, | ||
118 | uint64_t value, | ||
119 | int is_persistent) | ||
120 | { | ||
121 | printf ("stat P%u: %s/%s=%lu\n", GNUNET_TESTBED_get_index (peer), subsystem, name, (unsigned long) value); | ||
122 | return GNUNET_OK; | ||
123 | } | ||
124 | |||
125 | |||
126 | static void | ||
89 | destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) | 127 | destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) |
90 | { | 128 | { |
91 | struct GNUNET_CONSENSUS_Handle *consensus = cls; | 129 | struct GNUNET_CONSENSUS_Handle *consensus = cls; |
@@ -104,7 +142,10 @@ destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) | |||
104 | i, | 142 | i, |
105 | results_for_peer[i], | 143 | results_for_peer[i], |
106 | num_values); | 144 | num_values); |
107 | GNUNET_SCHEDULER_shutdown (); | 145 | GNUNET_TESTBED_get_statistics (num_peers, peers, NULL, NULL, |
146 | statistics_cb, | ||
147 | statistics_done_db, | ||
148 | NULL); | ||
108 | } | 149 | } |
109 | } | 150 | } |
110 | 151 | ||