gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23740 - in gnunet/src: include testbed


From: gnunet
Subject: [GNUnet-SVN] r23740 - in gnunet/src: include testbed
Date: Mon, 10 Sep 2012 20:58:23 +0200

Author: grothoff
Date: 2012-09-10 20:58:23 +0200 (Mon, 10 Sep 2012)
New Revision: 23740

Added:
   gnunet/src/testbed/testbed_api_statistics.c
Modified:
   gnunet/src/include/gnunet_testbed_service.h
   gnunet/src/testbed/Makefile.am
Log:
adding another testbed API function: convenience function to get all stats from 
all peers

Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-09-10 15:02:48 UTC (rev 
23739)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-09-10 18:58:23 UTC (rev 
23740)
@@ -1202,6 +1202,44 @@
 
 
 /**
+ * Callback function to process statistic values from all peers.
+ *
+ * @param cls closure
+ * @param peer the peer the statistic belong to
+ * @param subsystem name of subsystem that created the statistic
+ * @param name the name of the datum
+ * @param value the current value
+ * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
+ * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ */
+typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
+                                                 const struct 
GNUNET_TESTBED_Peer *peer,
+                                                 const char *subsystem,
+                                                 const char *name,
+                                                 uint64_t value,
+                                                 int is_persistent);
+
+
+/**
+ * Convenience method that iterates over all (running) peers 
+ * and retrieves all statistics from each peer.
+ *
+ * @param num_peers number of peers to iterate over
+ * @param peers array of peers to iterate over
+ * @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
+ * @return operation handle to cancel the operation
+ */
+struct GNUNET_TESTBED_Operation *
+GNUNET_TESTBED_get_statistics (unsigned int num_peers,
+                              struct GNUNET_TESTBED_Peer **peers,
+                               GNUNET_TESTBED_StatisticsIterator proc,
+                               GNUNET_TESTBED_OperationCompletionCallback cont,
+                               void *cls);
+
+
+/**
  * Convenience method for running a testbed with
  * a single call.  Underlay and overlay topology
  * are configured using the "UNDERLAY" and "OVERLAY"

Modified: gnunet/src/testbed/Makefile.am
===================================================================
--- gnunet/src/testbed/Makefile.am      2012-09-10 15:02:48 UTC (rev 23739)
+++ gnunet/src/testbed/Makefile.am      2012-09-10 18:58:23 UTC (rev 23740)
@@ -51,6 +51,7 @@
   testbed_api_operations.c testbed_api_operations.h \
   testbed_api_peers.c testbed_api_peers.h \
   testbed_api_services.c \
+  testbed_api_statistics.c \
   testbed_api_testbed.c \
   testbed_api_test.c \
   testbed_api_topology.c

Added: gnunet/src/testbed/testbed_api_statistics.c
===================================================================
--- gnunet/src/testbed/testbed_api_statistics.c                         (rev 0)
+++ gnunet/src/testbed/testbed_api_statistics.c 2012-09-10 18:58:23 UTC (rev 
23740)
@@ -0,0 +1,56 @@
+/*
+      This file is part of GNUnet
+      (C) 2008--2012 Christian Grothoff (and other contributing authors)
+
+      GNUnet is free software; you can redistribute it and/or modify
+      it under the terms of the GNU General Public License as published
+      by the Free Software Foundation; either version 3, or (at your
+      option) any later version.
+
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      General Public License for more details.
+
+      You should have received a copy of the GNU General Public License
+      along with GNUnet; see the file COPYING.  If not, write to the
+      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+      Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * @file testbed/testbed_api_statistics.c
+ * @brief high-level statistics function
+ * @author Christian Grothoff
+ * @author Sree Harsha Totakura
+ */
+#include "platform.h"
+#include "gnunet_testbed_service.h"
+
+
+/**
+ * Convenience method that iterates over all (running) peers 
+ * and retrieves all statistics from each peer.
+ *
+ * @param num_peers number of peers to iterate over
+ * @param peers array of peers to iterate over
+ * @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
+ * @return operation handle to cancel the operation
+ */
+struct GNUNET_TESTBED_Operation *
+GNUNET_TESTBED_get_statistics (unsigned int num_peers,
+                              struct GNUNET_TESTBED_Peer **peers,
+                               GNUNET_TESTBED_StatisticsIterator proc,
+                               GNUNET_TESTBED_OperationCompletionCallback cont,
+                               void *cls)
+{
+  // FIXME: not implemented, but clients will kind-of work if we do this:
+  GNUNET_break (0);
+  cont (cls, NULL, NULL);
+  return NULL;
+}
+
+
+/* end of testbed_api_statistics.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]