diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-26 16:39:54 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-03-26 16:39:54 +0000 |
commit | 0fb46b5b17698fb04373e55e4130f0635b1bcccc (patch) | |
tree | e9b6de3f7cb51ee96d6f9119698ff7863e54ae2e /src/testbed | |
parent | fec18deaff1382f2fc7598cb4a5c87865447ddda (diff) | |
download | gnunet-0fb46b5b17698fb04373e55e4130f0635b1bcccc.tar.gz gnunet-0fb46b5b17698fb04373e55e4130f0635b1bcccc.zip |
- allow getting statistics of a particular subsystem and name in testbed
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/test_testbed_api_statistics.c | 1 | ||||
-rw-r--r-- | src/testbed/testbed_api_statistics.c | 21 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c index 7d8761532..619719207 100644 --- a/src/testbed/test_testbed_api_statistics.c +++ b/src/testbed/test_testbed_api_statistics.c | |||
@@ -160,6 +160,7 @@ test_master (void *cls, unsigned int num_peers, | |||
160 | FAIL_TEST (NUM_PEERS == num_peers, return); | 160 | FAIL_TEST (NUM_PEERS == num_peers, return); |
161 | peers = peers_; | 161 | peers = peers_; |
162 | op = GNUNET_TESTBED_get_statistics (num_peers, peers, | 162 | op = GNUNET_TESTBED_get_statistics (num_peers, peers, |
163 | NULL, NULL, | ||
163 | &stats_iterator, | 164 | &stats_iterator, |
164 | &op_comp_cb, | 165 | &op_comp_cb, |
165 | dummy_cls); | 166 | dummy_cls); |
diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c index bf401e0ed..1e12a7c64 100644 --- a/src/testbed/testbed_api_statistics.c +++ b/src/testbed/testbed_api_statistics.c | |||
@@ -66,6 +66,16 @@ struct GetStatsContext | |||
66 | struct GNUNET_TESTBED_Peer **peers; | 66 | struct GNUNET_TESTBED_Peer **peers; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * The subsystem of peers for which statistics are requested | ||
70 | */ | ||
71 | char *subsystem; | ||
72 | |||
73 | /** | ||
74 | * The particular statistics value of interest | ||
75 | */ | ||
76 | char *name; | ||
77 | |||
78 | /** | ||
69 | * The iterator to call with statistics information | 79 | * The iterator to call with statistics information |
70 | */ | 80 | */ |
71 | GNUNET_TESTBED_StatisticsIterator proc; | 81 | GNUNET_TESTBED_StatisticsIterator proc; |
@@ -253,10 +263,10 @@ service_connect_comp (void *cls, | |||
253 | { | 263 | { |
254 | struct PeerGetStatsContext *peer_sc = cls; | 264 | struct PeerGetStatsContext *peer_sc = cls; |
255 | struct GNUNET_STATISTICS_Handle *h = ca_result; | 265 | struct GNUNET_STATISTICS_Handle *h = ca_result; |
256 | 266 | ||
257 | LOG_DEBUG ("Retrieving statistics of peer %u\n", peer_sc->peer_index); | 267 | LOG_DEBUG ("Retrieving statistics of peer %u\n", peer_sc->peer_index); |
258 | peer_sc->get_handle = | 268 | peer_sc->get_handle = |
259 | GNUNET_STATISTICS_get (h, NULL, NULL, | 269 | GNUNET_STATISTICS_get (h, peer_sc->sc->subsystem, peer_sc->sc->name, |
260 | GNUNET_TIME_UNIT_FOREVER_REL, | 270 | GNUNET_TIME_UNIT_FOREVER_REL, |
261 | &iteration_completion_cb, | 271 | &iteration_completion_cb, |
262 | iterator_cb, peer_sc); | 272 | iterator_cb, peer_sc); |
@@ -370,6 +380,8 @@ oprelease_get_stats (void *cls) | |||
370 | } | 380 | } |
371 | GNUNET_free (sc->ops); | 381 | GNUNET_free (sc->ops); |
372 | } | 382 | } |
383 | GNUNET_free_non_null (sc->subsystem); | ||
384 | GNUNET_free_non_null (sc->name); | ||
373 | GNUNET_free (sc); | 385 | GNUNET_free (sc); |
374 | if (GNUNET_YES == | 386 | if (GNUNET_YES == |
375 | GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue)) | 387 | GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue)) |
@@ -383,6 +395,8 @@ oprelease_get_stats (void *cls) | |||
383 | * | 395 | * |
384 | * @param num_peers number of peers to iterate over | 396 | * @param num_peers number of peers to iterate over |
385 | * @param peers array of peers to iterate over | 397 | * @param peers array of peers to iterate over |
398 | * @param subsystem limit to the specified subsystem, NULL for all subsystems | ||
399 | * @param name name of the statistic value, NULL for all values | ||
386 | * @param proc processing function for each statistic retrieved | 400 | * @param proc processing function for each statistic retrieved |
387 | * @param cont continuation to call once call is completed(?) | 401 | * @param cont continuation to call once call is completed(?) |
388 | * @param cls closure to pass to proc and cont | 402 | * @param cls closure to pass to proc and cont |
@@ -391,6 +405,7 @@ oprelease_get_stats (void *cls) | |||
391 | struct GNUNET_TESTBED_Operation * | 405 | struct GNUNET_TESTBED_Operation * |
392 | GNUNET_TESTBED_get_statistics (unsigned int num_peers, | 406 | GNUNET_TESTBED_get_statistics (unsigned int num_peers, |
393 | struct GNUNET_TESTBED_Peer **peers, | 407 | struct GNUNET_TESTBED_Peer **peers, |
408 | const char *subsystem, const char *name, | ||
394 | GNUNET_TESTBED_StatisticsIterator proc, | 409 | GNUNET_TESTBED_StatisticsIterator proc, |
395 | GNUNET_TESTBED_OperationCompletionCallback cont, | 410 | GNUNET_TESTBED_OperationCompletionCallback cont, |
396 | void *cls) | 411 | void *cls) |
@@ -404,6 +419,8 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers, | |||
404 | GNUNET_TESTBED_operation_queue_create_ (UINT_MAX); | 419 | GNUNET_TESTBED_operation_queue_create_ (UINT_MAX); |
405 | sc = GNUNET_malloc (sizeof (struct GetStatsContext)); | 420 | sc = GNUNET_malloc (sizeof (struct GetStatsContext)); |
406 | sc->peers = peers; | 421 | sc->peers = peers; |
422 | sc->subsystem = (NULL == subsystem) ? NULL : GNUNET_strdup (subsystem); | ||
423 | sc->name = (NULL == name) ? NULL : GNUNET_strdup (name); | ||
407 | sc->proc = proc; | 424 | sc->proc = proc; |
408 | sc->cont = cont; | 425 | sc->cont = cont; |
409 | sc->cb_cls = cls; | 426 | sc->cb_cls = cls; |