aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-03-26 16:39:54 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-03-26 16:39:54 +0000
commit0fb46b5b17698fb04373e55e4130f0635b1bcccc (patch)
treee9b6de3f7cb51ee96d6f9119698ff7863e54ae2e /src
parentfec18deaff1382f2fc7598cb4a5c87865447ddda (diff)
downloadgnunet-0fb46b5b17698fb04373e55e4130f0635b1bcccc.tar.gz
gnunet-0fb46b5b17698fb04373e55e4130f0635b1bcccc.zip
- allow getting statistics of a particular subsystem and name in testbed
Diffstat (limited to 'src')
-rw-r--r--src/dht/test_dht_topo.c1
-rw-r--r--src/fs/gnunet-fs-profiler.c1
-rw-r--r--src/include/gnunet_testbed_service.h3
-rw-r--r--src/nse/gnunet-nse-profiler.c5
-rw-r--r--src/testbed/test_testbed_api_statistics.c1
-rw-r--r--src/testbed/testbed_api_statistics.c21
6 files changed, 28 insertions, 4 deletions
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,
239 } 239 }
240 (void) GNUNET_TESTBED_get_statistics (NUM_PEERS, 240 (void) GNUNET_TESTBED_get_statistics (NUM_PEERS,
241 my_peers, 241 my_peers,
242 NULL, NULL,
242 &handle_stats, 243 &handle_stats,
243 &stats_finished, 244 &stats_finished,
244 ctx); 245 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,
117{ 117{
118 terminate_taskid = GNUNET_SCHEDULER_NO_TASK; 118 terminate_taskid = GNUNET_SCHEDULER_NO_TASK;
119 GNUNET_TESTBED_get_statistics (0, NULL, 119 GNUNET_TESTBED_get_statistics (0, NULL,
120 NULL, NULL,
120 &process_stats, 121 &process_stats,
121 &shutdown_task, 122 &shutdown_task,
122 NULL); 123 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,
1339 * 1339 *
1340 * @param num_peers number of peers to iterate over 1340 * @param num_peers number of peers to iterate over
1341 * @param peers array of peers to iterate over 1341 * @param peers array of peers to iterate over
1342 * @param subsystem limit to the specified subsystem, NULL for all subsystems
1343 * @param name name of the statistic value, NULL for all values
1342 * @param proc processing function for each statistic retrieved 1344 * @param proc processing function for each statistic retrieved
1343 * @param cont continuation to call once call is completed. The completion of this 1345 * @param cont continuation to call once call is completed. The completion of this
1344 * operation is *ONLY* signalled through this callback -- no 1346 * operation is *ONLY* signalled through this callback -- no
@@ -1349,6 +1351,7 @@ typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
1349struct GNUNET_TESTBED_Operation * 1351struct GNUNET_TESTBED_Operation *
1350GNUNET_TESTBED_get_statistics (unsigned int num_peers, 1352GNUNET_TESTBED_get_statistics (unsigned int num_peers,
1351 struct GNUNET_TESTBED_Peer **peers, 1353 struct GNUNET_TESTBED_Peer **peers,
1354 const char *subsystem, const char *name,
1352 GNUNET_TESTBED_StatisticsIterator proc, 1355 GNUNET_TESTBED_StatisticsIterator proc,
1353 GNUNET_TESTBED_OperationCompletionCallback cont, 1356 GNUNET_TESTBED_OperationCompletionCallback cont,
1354 void *cls); 1357 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,
633 close_monitor_connections (); 633 close_monitor_connections ();
634 stats_context = GNUNET_malloc (sizeof (struct StatsContext)); 634 stats_context = GNUNET_malloc (sizeof (struct StatsContext));
635 get_stats_op = 635 get_stats_op =
636 GNUNET_TESTBED_get_statistics (num_peers_in_round[current_round], 636 GNUNET_TESTBED_get_statistics (num_peers_in_round[current_round],
637 daemons, 637 daemons,
638 NULL, NULL,
638 &statistics_iterator, 639 &statistics_iterator,
639 &stats_finished_callback, 640 &stats_finished_callback,
640 stats_context); 641 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,
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)
391struct GNUNET_TESTBED_Operation * 405struct GNUNET_TESTBED_Operation *
392GNUNET_TESTBED_get_statistics (unsigned int num_peers, 406GNUNET_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;