- allow getting statistics of a particular subsystem and name in testbed
authorSree Harsha Totakura <totakura@in.tum.de>
Tue, 26 Mar 2013 16:39:54 +0000 (16:39 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Tue, 26 Mar 2013 16:39:54 +0000 (16:39 +0000)
src/dht/test_dht_topo.c
src/fs/gnunet-fs-profiler.c
src/include/gnunet_testbed_service.h
src/nse/gnunet-nse-profiler.c
src/testbed/test_testbed_api_statistics.c
src/testbed/testbed_api_statistics.c

index c9036d2c192d60713979c711267f737605eba4d2..1ab580d5b4ac61f3c1966cdcfb6d57f76880bcb8 100644 (file)
@@ -239,6 +239,7 @@ shutdown_task (void *cls,
   }
   (void) GNUNET_TESTBED_get_statistics (NUM_PEERS,
                                        my_peers,
+                                        NULL, NULL,
                                        &handle_stats,
                                        &stats_finished,
                                        ctx);
index 7a0b7e8041de075f99a5b17ba49caf64995e9c15..aeb84315a40a8ca707cfdf6345cb4c429c63247f 100644 (file)
@@ -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);
index d410874848b64dfcb1cf26741f0d679ab1a9bd2f..438227538b1b2d4dab4044910762775d90ef2d9e 100644 (file)
@@ -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);
index 8f3bc6db25dbea5599945f6286040c0e5264c160..911143b5f287bb7ea95a21db944ec2a67c6085af 100644 (file)
@@ -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);
index 7d8761532268227b319bfd77b752614a9f613464..619719207d9ed710535fec8718e3df55128f4ad1 100644 (file)
@@ -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);
index bf401e0edeff0a8457230eefc61c59ad98f9e179..1e12a7c64fa9bf7655b19326284d2632b231d5aa 100644 (file)
@@ -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;