From: Sree Harsha Totakura Date: Tue, 26 Mar 2013 16:39:54 +0000 (+0000) Subject: - allow getting statistics of a particular subsystem and name in testbed X-Git-Tag: initial-import-from-subversion-38251~9473 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0fb46b5b17698fb04373e55e4130f0635b1bcccc;p=oweals%2Fgnunet.git - allow getting statistics of a particular subsystem and name in testbed --- diff --git a/src/dht/test_dht_topo.c b/src/dht/test_dht_topo.c index c9036d2c1..1ab580d5b 100644 --- a/src/dht/test_dht_topo.c +++ b/src/dht/test_dht_topo.c @@ -239,6 +239,7 @@ shutdown_task (void *cls, } (void) GNUNET_TESTBED_get_statistics (NUM_PEERS, my_peers, + NULL, NULL, &handle_stats, &stats_finished, ctx); diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index 7a0b7e804..aeb84315a 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c @@ -117,6 +117,7 @@ terminate_task (void *cls, { terminate_taskid = GNUNET_SCHEDULER_NO_TASK; GNUNET_TESTBED_get_statistics (0, NULL, + NULL, NULL, &process_stats, &shutdown_task, NULL); diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index d41087484..438227538 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h @@ -1339,6 +1339,8 @@ typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls, * * @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. The completion of this * operation is *ONLY* signalled through this callback -- no @@ -1349,6 +1351,7 @@ typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls, 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); diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index 8f3bc6db2..911143b5f 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c @@ -633,8 +633,9 @@ finish_round (void *cls, close_monitor_connections (); stats_context = GNUNET_malloc (sizeof (struct StatsContext)); get_stats_op = - GNUNET_TESTBED_get_statistics (num_peers_in_round[current_round], - daemons, + GNUNET_TESTBED_get_statistics (num_peers_in_round[current_round], + daemons, + NULL, NULL, &statistics_iterator, &stats_finished_callback, stats_context); 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, FAIL_TEST (NUM_PEERS == num_peers, return); peers = peers_; op = GNUNET_TESTBED_get_statistics (num_peers, peers, + NULL, NULL, &stats_iterator, &op_comp_cb, 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 @@ -65,6 +65,16 @@ struct GetStatsContext */ 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 */ @@ -253,10 +263,10 @@ service_connect_comp (void *cls, { 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); @@ -370,6 +380,8 @@ oprelease_get_stats (void *cls) } 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)) @@ -383,6 +395,8 @@ oprelease_get_stats (void *cls) * * @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 @@ -391,6 +405,7 @@ oprelease_get_stats (void *cls) 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) @@ -404,6 +419,8 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers, 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;