*/
struct GNUNET_TESTBED_Peer **peers;
+ /**
+ * The subsystem of peers for which statistics are requested
+ */
+ char *subsystem;
+
+ /**
+ * The particular statistics value of interest
+ */
+ char *name;
+
/**
* The iterator to call with statistics information
*/
struct PeerGetStatsContext *peer_sc = cls;
struct GetStatsContext *sc;
- if (NULL == peer_sc->get_handle)
- {
- /* We are being called synchronously in call to GNUNET_STATISTICS_destroy()
- in statistics_da() after we cancelled the GetHandle */
- GNUNET_assert (GNUNET_SYSERR == success);
- return;
- }
GNUNET_break (GNUNET_OK == success);
sc = peer_sc->sc;
peer_sc->get_handle = NULL;
{
struct PeerGetStatsContext *peer_sc = cls;
struct GNUNET_STATISTICS_Handle *h = ca_result;
-
+
LOG_DEBUG ("Retrieving statistics of peer %u\n", peer_sc->peer_index);
peer_sc->get_handle =
- GNUNET_STATISTICS_get (h, NULL, NULL,
+ GNUNET_STATISTICS_get (h, peer_sc->sc->subsystem, peer_sc->sc->name,
GNUNET_TIME_UNIT_FOREVER_REL,
&iteration_completion_cb,
iterator_cb, peer_sc);
statistics_da (void *cls, void *op_result)
{
struct PeerGetStatsContext *peer_sc = cls;
+ struct GNUNET_STATISTICS_Handle *sh = op_result;
if (NULL != peer_sc->get_handle)
{
GNUNET_STATISTICS_get_cancel (peer_sc->get_handle);
peer_sc->get_handle = NULL;
}
- GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) op_result,
- GNUNET_NO);
+ GNUNET_STATISTICS_destroy (sh, GNUNET_NO);
if (GNUNET_SCHEDULER_NO_TASK != peer_sc->op_done_task_id)
GNUNET_SCHEDULER_cancel (peer_sc->op_done_task_id);
GNUNET_free (peer_sc);
sizeof (struct GNUNET_TESTBED_Operation *));
for (peer = 0; peer < sc->num_peers; peer++)
{
+ if (NULL == sc->peers[peer])
+ {
+ GNUNET_break (0);
+ continue;
+ }
peer_sc = GNUNET_malloc (sizeof (struct PeerGetStatsContext));
peer_sc->sc = sc;
peer_sc->peer_index = peer;
}
GNUNET_free (sc->ops);
}
+ GNUNET_free_non_null (sc->subsystem);
+ GNUNET_free_non_null (sc->name);
GNUNET_free (sc);
if (GNUNET_YES ==
GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue))
*
* @param num_peers number of peers to iterate over
* @param peers array of peers to iterate over
+ * @param subsystem limit to the specified subsystem, NULL for all subsystems
+ * @param name name of the statistic value, NULL for all values
* @param proc processing function for each statistic retrieved
* @param cont continuation to call once call is completed(?)
* @param cls closure to pass to proc and cont
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_get_statistics (unsigned int num_peers,
struct GNUNET_TESTBED_Peer **peers,
+ const char *subsystem, const char *name,
GNUNET_TESTBED_StatisticsIterator proc,
GNUNET_TESTBED_OperationCompletionCallback cont,
void *cls)
GNUNET_TESTBED_operation_queue_create_ (UINT_MAX);
sc = GNUNET_malloc (sizeof (struct GetStatsContext));
sc->peers = peers;
+ sc->subsystem = (NULL == subsystem) ? NULL : GNUNET_strdup (subsystem);
+ sc->name = (NULL == name) ? NULL : GNUNET_strdup (name);
sc->proc = proc;
sc->cont = cont;
sc->cb_cls = cls;