aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-consensus-profiler.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-10-11 19:16:15 +0000
committerFlorian Dold <florian.dold@gmail.com>2015-10-11 19:16:15 +0000
commit97413eeadde62d7646b192348512abc4f4c36c2d (patch)
tree976e75557edd1ef9c2cd110fee45c476be9e7960 /src/consensus/gnunet-consensus-profiler.c
parent15f13cc7f9b59269a8b5ee8c750b5729b2c359ae (diff)
downloadgnunet-97413eeadde62d7646b192348512abc4f4c36c2d.tar.gz
gnunet-97413eeadde62d7646b192348512abc4f4c36c2d.zip
consensus
Diffstat (limited to 'src/consensus/gnunet-consensus-profiler.c')
-rw-r--r--src/consensus/gnunet-consensus-profiler.c43
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
88static void 88static void
89statistics_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 */
113static int
114statistics_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
126static void
89destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx) 127destroy (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