diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_testbed_service.h | 38 | ||||
-rw-r--r-- | src/testbed/Makefile.am | 1 | ||||
-rw-r--r-- | src/testbed/testbed_api_statistics.c | 56 |
3 files changed, 95 insertions, 0 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index 0c1cf985f..bd9e51bfa 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -1202,6 +1202,44 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed); | |||
1202 | 1202 | ||
1203 | 1203 | ||
1204 | /** | 1204 | /** |
1205 | * Callback function to process statistic values from all peers. | ||
1206 | * | ||
1207 | * @param cls closure | ||
1208 | * @param peer the peer the statistic belong to | ||
1209 | * @param subsystem name of subsystem that created the statistic | ||
1210 | * @param name the name of the datum | ||
1211 | * @param value the current value | ||
1212 | * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not | ||
1213 | * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration | ||
1214 | */ | ||
1215 | typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls, | ||
1216 | const struct GNUNET_TESTBED_Peer *peer, | ||
1217 | const char *subsystem, | ||
1218 | const char *name, | ||
1219 | uint64_t value, | ||
1220 | int is_persistent); | ||
1221 | |||
1222 | |||
1223 | /** | ||
1224 | * Convenience method that iterates over all (running) peers | ||
1225 | * and retrieves all statistics from each peer. | ||
1226 | * | ||
1227 | * @param num_peers number of peers to iterate over | ||
1228 | * @param peers array of peers to iterate over | ||
1229 | * @param proc processing function for each statistic retrieved | ||
1230 | * @param cont continuation to call once call is completed(?) | ||
1231 | * @param cls closure to pass to proc and cont | ||
1232 | * @return operation handle to cancel the operation | ||
1233 | */ | ||
1234 | struct GNUNET_TESTBED_Operation * | ||
1235 | GNUNET_TESTBED_get_statistics (unsigned int num_peers, | ||
1236 | struct GNUNET_TESTBED_Peer **peers, | ||
1237 | GNUNET_TESTBED_StatisticsIterator proc, | ||
1238 | GNUNET_TESTBED_OperationCompletionCallback cont, | ||
1239 | void *cls); | ||
1240 | |||
1241 | |||
1242 | /** | ||
1205 | * Convenience method for running a testbed with | 1243 | * Convenience method for running a testbed with |
1206 | * a single call. Underlay and overlay topology | 1244 | * a single call. Underlay and overlay topology |
1207 | * are configured using the "UNDERLAY" and "OVERLAY" | 1245 | * are configured using the "UNDERLAY" and "OVERLAY" |
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index a94193305..5efaef97e 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am | |||
@@ -51,6 +51,7 @@ libgnunettestbed_la_SOURCES = \ | |||
51 | testbed_api_operations.c testbed_api_operations.h \ | 51 | testbed_api_operations.c testbed_api_operations.h \ |
52 | testbed_api_peers.c testbed_api_peers.h \ | 52 | testbed_api_peers.c testbed_api_peers.h \ |
53 | testbed_api_services.c \ | 53 | testbed_api_services.c \ |
54 | testbed_api_statistics.c \ | ||
54 | testbed_api_testbed.c \ | 55 | testbed_api_testbed.c \ |
55 | testbed_api_test.c \ | 56 | testbed_api_test.c \ |
56 | testbed_api_topology.c | 57 | testbed_api_topology.c |
diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c new file mode 100644 index 000000000..8fe104be2 --- /dev/null +++ b/src/testbed/testbed_api_statistics.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2008--2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testbed/testbed_api_statistics.c | ||
23 | * @brief high-level statistics function | ||
24 | * @author Christian Grothoff | ||
25 | * @author Sree Harsha Totakura | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_testbed_service.h" | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Convenience method that iterates over all (running) peers | ||
33 | * and retrieves all statistics from each peer. | ||
34 | * | ||
35 | * @param num_peers number of peers to iterate over | ||
36 | * @param peers array of peers to iterate over | ||
37 | * @param proc processing function for each statistic retrieved | ||
38 | * @param cont continuation to call once call is completed(?) | ||
39 | * @param cls closure to pass to proc and cont | ||
40 | * @return operation handle to cancel the operation | ||
41 | */ | ||
42 | struct GNUNET_TESTBED_Operation * | ||
43 | GNUNET_TESTBED_get_statistics (unsigned int num_peers, | ||
44 | struct GNUNET_TESTBED_Peer **peers, | ||
45 | GNUNET_TESTBED_StatisticsIterator proc, | ||
46 | GNUNET_TESTBED_OperationCompletionCallback cont, | ||
47 | void *cls) | ||
48 | { | ||
49 | // FIXME: not implemented, but clients will kind-of work if we do this: | ||
50 | GNUNET_break (0); | ||
51 | cont (cls, NULL, NULL); | ||
52 | return NULL; | ||
53 | } | ||
54 | |||
55 | |||
56 | /* end of testbed_api_statistics.c */ | ||