diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-19 12:26:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-19 12:26:57 +0000 |
commit | 1b41ef00317b5f38a7860bfa4711a03552744241 (patch) | |
tree | 99526288fa40d3577acf8742eff673bab254351f /src/ats | |
parent | b7619facf9cf6889deb181487b5aae133a577a5f (diff) | |
download | gnunet-1b41ef00317b5f38a7860bfa4711a03552744241.tar.gz gnunet-1b41ef00317b5f38a7860bfa4711a03552744241.zip |
adding stats
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/Makefile.am | 5 | ||||
-rw-r--r-- | src/ats/ats_api_scheduling.c | 1 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats.c | 11 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats.h | 38 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 9 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 15 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 17 |
7 files changed, 94 insertions, 2 deletions
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am index 6d945dd51..5cba4fccb 100644 --- a/src/ats/Makefile.am +++ b/src/ats/Makefile.am | |||
@@ -22,12 +22,13 @@ bin_PROGRAMS = \ | |||
22 | gnunet-service-ats | 22 | gnunet-service-ats |
23 | 23 | ||
24 | gnunet_service_ats_SOURCES = \ | 24 | gnunet_service_ats_SOURCES = \ |
25 | gnunet-service-ats.c \ | 25 | gnunet-service-ats.c gnunet-service-ats.h\ |
26 | gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \ | 26 | gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \ |
27 | gnunet-service-ats_performance.c gnunet-service-ats_performance.h \ | 27 | gnunet-service-ats_performance.c gnunet-service-ats_performance.h \ |
28 | gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \ | 28 | gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \ |
29 | gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h | 29 | gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h |
30 | gnunet_service_ats_LDADD = \ | 30 | gnunet_service_ats_LDADD = \ |
31 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
31 | $(top_builddir)/src/util/libgnunetutil.la \ | 32 | $(top_builddir)/src/util/libgnunetutil.la \ |
32 | $(GN_LIBINTL) | 33 | $(GN_LIBINTL) |
33 | 34 | ||
@@ -35,7 +36,7 @@ gnunet_service_ats_LDADD = \ | |||
35 | check_PROGRAMS = \ | 36 | check_PROGRAMS = \ |
36 | test_ats_api_scheduling | 37 | test_ats_api_scheduling |
37 | # test_ats_api_bandwidth_consumption | 38 | # test_ats_api_bandwidth_consumption |
38 | 39 | ||
39 | if ENABLE_TEST_RUN | 40 | if ENABLE_TEST_RUN |
40 | TESTS = $(check_PROGRAMS) | 41 | TESTS = $(check_PROGRAMS) |
41 | endif | 42 | endif |
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index e62574918..955b21286 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -345,6 +345,7 @@ remove_session (struct GNUNET_ATS_SchedulingHandle *sh, | |||
345 | const struct GNUNET_PeerIdentity *peer) | 345 | const struct GNUNET_PeerIdentity *peer) |
346 | { | 346 | { |
347 | GNUNET_assert (session_id < sh->session_array_size); | 347 | GNUNET_assert (session_id < sh->session_array_size); |
348 | GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used); | ||
348 | GNUNET_assert (0 == memcmp (peer, | 349 | GNUNET_assert (0 == memcmp (peer, |
349 | &sh->session_array[session_id].peer, | 350 | &sh->session_array[session_id].peer, |
350 | sizeof (struct GNUNET_PeerIdentity))); | 351 | sizeof (struct GNUNET_PeerIdentity))); |
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index 768bef1b7..e497a7aaf 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c | |||
@@ -27,12 +27,17 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_ats_service.h" | 29 | #include "gnunet_ats_service.h" |
30 | #include "gnunet-service-ats.h" | ||
30 | #include "gnunet-service-ats_addresses.h" | 31 | #include "gnunet-service-ats_addresses.h" |
31 | #include "gnunet-service-ats_performance.h" | 32 | #include "gnunet-service-ats_performance.h" |
32 | #include "gnunet-service-ats_scheduling.h" | 33 | #include "gnunet-service-ats_scheduling.h" |
33 | #include "gnunet-service-ats_reservations.h" | 34 | #include "gnunet-service-ats_reservations.h" |
34 | #include "ats.h" | 35 | #include "ats.h" |
35 | 36 | ||
37 | /** | ||
38 | * Handle for statistics. | ||
39 | */ | ||
40 | struct GNUNET_STATISTICS_Handle *GSA_stats; | ||
36 | 41 | ||
37 | /** | 42 | /** |
38 | * We have received a 'ClientStartMessage' from a client. Find out which | 43 | * We have received a 'ClientStartMessage' from a client. Find out which |
@@ -106,6 +111,11 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
106 | GAS_scheduling_done (); | 111 | GAS_scheduling_done (); |
107 | GAS_performance_done (); | 112 | GAS_performance_done (); |
108 | GAS_reservations_done (); | 113 | GAS_reservations_done (); |
114 | if (NULL != GSA_stats) | ||
115 | { | ||
116 | GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO); | ||
117 | GSA_stats = 0; | ||
118 | } | ||
109 | } | 119 | } |
110 | 120 | ||
111 | 121 | ||
@@ -135,6 +145,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
135 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0}, | 145 | GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0}, |
136 | {NULL, NULL, 0, 0} | 146 | {NULL, NULL, 0, 0} |
137 | }; | 147 | }; |
148 | GSA_stats = GNUNET_STATISTICS_create ("ats", cfg); | ||
138 | GAS_reservations_init (); | 149 | GAS_reservations_init (); |
139 | GAS_performance_init (server); | 150 | GAS_performance_init (server); |
140 | GAS_scheduling_init (server); | 151 | GAS_scheduling_init (server); |
diff --git a/src/ats/gnunet-service-ats.h b/src/ats/gnunet-service-ats.h new file mode 100644 index 000000000..b60332d20 --- /dev/null +++ b/src/ats/gnunet-service-ats.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011 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 ats/gnunet-service-ats.h | ||
23 | * @brief ats service | ||
24 | * @author Matthias Wachs | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | #ifndef GNUNET_SERVICE_ATS_H | ||
28 | #define GNUNET_SERVICE_ATS_H | ||
29 | |||
30 | #include "gnunet_statistics_service.h" | ||
31 | |||
32 | /** | ||
33 | * Handle for statistics. | ||
34 | */ | ||
35 | extern struct GNUNET_STATISTICS_Handle *GSA_stats; | ||
36 | |||
37 | |||
38 | #endif | ||
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index b3e838f39..99dc0e17a 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_ats_service.h" | 28 | #include "gnunet_ats_service.h" |
29 | #include "gnunet-service-ats.h" | ||
29 | #include "gnunet-service-ats_addresses.h" | 30 | #include "gnunet-service-ats_addresses.h" |
30 | #include "gnunet-service-ats_performance.h" | 31 | #include "gnunet-service-ats_performance.h" |
31 | #include "gnunet-service-ats_scheduling.h" | 32 | #include "gnunet-service-ats_scheduling.h" |
@@ -134,6 +135,14 @@ recalculate_assigned_bw () | |||
134 | { | 135 | { |
135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 136 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
136 | "Recalculating bandwidth for all active connections\n"); | 137 | "Recalculating bandwidth for all active connections\n"); |
138 | GNUNET_STATISTICS_update (GSA_stats, | ||
139 | "# bandwidth recalculations performed", | ||
140 | 1, | ||
141 | GNUNET_NO); | ||
142 | GNUNET_STATISTICS_set (GSA_stats, | ||
143 | "# active addresses", | ||
144 | active_addr_count, | ||
145 | GNUNET_NO); | ||
137 | GNUNET_CONTAINER_multihashmap_iterate (addresses, | 146 | GNUNET_CONTAINER_multihashmap_iterate (addresses, |
138 | &update_bw_it, | 147 | &update_bw_it, |
139 | NULL); | 148 | NULL); |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index e0e5e4c18..24450031f 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -25,6 +25,7 @@ | |||
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet-service-ats.h" | ||
28 | #include "gnunet-service-ats_addresses.h" | 29 | #include "gnunet-service-ats_addresses.h" |
29 | #include "gnunet-service-ats_performance.h" | 30 | #include "gnunet-service-ats_performance.h" |
30 | #include "gnunet-service-ats_reservations.h" | 31 | #include "gnunet-service-ats_reservations.h" |
@@ -183,10 +184,16 @@ GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer, | |||
183 | strcpy (&addrp[plugin_addr_len], plugin_name); | 184 | strcpy (&addrp[plugin_addr_len], plugin_name); |
184 | for (pc = pc_head; pc != NULL; pc = pc->next) | 185 | for (pc = pc_head; pc != NULL; pc = pc->next) |
185 | if (pc->flag == START_FLAG_PERFORMANCE_WITH_PIC) | 186 | if (pc->flag == START_FLAG_PERFORMANCE_WITH_PIC) |
187 | { | ||
186 | GNUNET_SERVER_notification_context_unicast (nc, | 188 | GNUNET_SERVER_notification_context_unicast (nc, |
187 | pc->client, | 189 | pc->client, |
188 | &msg->header, | 190 | &msg->header, |
189 | GNUNET_YES); | 191 | GNUNET_YES); |
192 | GNUNET_STATISTICS_update (GSA_stats, | ||
193 | "# performance updates given to clients", | ||
194 | 1, | ||
195 | GNUNET_NO); | ||
196 | } | ||
190 | } | 197 | } |
191 | 198 | ||
192 | 199 | ||
@@ -225,6 +232,10 @@ GAS_handle_reservation_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
225 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); | 232 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); |
226 | result.amount = htonl (amount); | 233 | result.amount = htonl (amount); |
227 | result.res_delay = GNUNET_TIME_relative_hton (res_delay); | 234 | result.res_delay = GNUNET_TIME_relative_hton (res_delay); |
235 | GNUNET_STATISTICS_update (GSA_stats, | ||
236 | "# reservatin requests processed", | ||
237 | 1, | ||
238 | GNUNET_NO); | ||
228 | GNUNET_SERVER_notification_context_unicast (nc, | 239 | GNUNET_SERVER_notification_context_unicast (nc, |
229 | client, | 240 | client, |
230 | &result.header, | 241 | &result.header, |
@@ -266,6 +277,10 @@ GAS_handle_preference_change (void *cls, struct GNUNET_SERVER_Client *client, | |||
266 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 277 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
267 | return; | 278 | return; |
268 | } | 279 | } |
280 | GNUNET_STATISTICS_update (GSA_stats, | ||
281 | "# preference change requests processed", | ||
282 | 1, | ||
283 | GNUNET_NO); | ||
269 | pi = (const struct PreferenceInformation *) &msg[1]; | 284 | pi = (const struct PreferenceInformation *) &msg[1]; |
270 | for (i=0;i<nump;i++) | 285 | for (i=0;i<nump;i++) |
271 | GAS_addresses_change_preference (&msg->peer, | 286 | GAS_addresses_change_preference (&msg->peer, |
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index 242076568..3ed5eb1dd 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c | |||
@@ -25,6 +25,7 @@ | |||
25 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet-service-ats.h" | ||
28 | #include "gnunet-service-ats_addresses.h" | 29 | #include "gnunet-service-ats_addresses.h" |
29 | #include "gnunet-service-ats_scheduling.h" | 30 | #include "gnunet-service-ats_scheduling.h" |
30 | #include "ats.h" | 31 | #include "ats.h" |
@@ -114,6 +115,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe | |||
114 | 115 | ||
115 | if (my_client == NULL) | 116 | if (my_client == NULL) |
116 | return; | 117 | return; |
118 | GNUNET_STATISTICS_update (GSA_stats, | ||
119 | "# address suggestions made", | ||
120 | 1, | ||
121 | GNUNET_NO); | ||
117 | GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); | 122 | GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); |
118 | GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)); | 123 | GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)); |
119 | msg = (struct AddressSuggestionMessage*) buf; | 124 | msg = (struct AddressSuggestionMessage*) buf; |
@@ -153,6 +158,10 @@ GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client, | |||
153 | const struct RequestAddressMessage * msg = (const struct RequestAddressMessage *) message; | 158 | const struct RequestAddressMessage * msg = (const struct RequestAddressMessage *) message; |
154 | 159 | ||
155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "REQUEST_ADDRESS"); | 160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "REQUEST_ADDRESS"); |
161 | GNUNET_STATISTICS_update (GSA_stats, | ||
162 | "# address requests received", | ||
163 | 1, | ||
164 | GNUNET_NO); | ||
156 | GNUNET_break (0 == ntohl (msg->reserved)); | 165 | GNUNET_break (0 == ntohl (msg->reserved)); |
157 | GAS_addresses_request_address (&msg->peer); | 166 | GAS_addresses_request_address (&msg->peer); |
158 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 167 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -210,6 +219,10 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client, | |||
210 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 219 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
211 | return; | 220 | return; |
212 | } | 221 | } |
222 | GNUNET_STATISTICS_update (GSA_stats, | ||
223 | "# address updates received", | ||
224 | 1, | ||
225 | GNUNET_NO); | ||
213 | GAS_addresses_update (&m->peer, | 226 | GAS_addresses_update (&m->peer, |
214 | plugin_name, | 227 | plugin_name, |
215 | address, | 228 | address, |
@@ -276,6 +289,10 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client, | |||
276 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 289 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
277 | return; | 290 | return; |
278 | } | 291 | } |
292 | GNUNET_STATISTICS_update (GSA_stats, | ||
293 | "# addresses destroyed", | ||
294 | 1, | ||
295 | GNUNET_NO); | ||
279 | GAS_addresses_destroy (&m->peer, | 296 | GAS_addresses_destroy (&m->peer, |
280 | plugin_name, | 297 | plugin_name, |
281 | address, | 298 | address, |