[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17599 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17599 - gnunet/src/ats |
Date: |
Wed, 19 Oct 2011 14:26:57 +0200 |
Author: grothoff
Date: 2011-10-19 14:26:57 +0200 (Wed, 19 Oct 2011)
New Revision: 17599
Added:
gnunet/src/ats/gnunet-service-ats.h
Modified:
gnunet/src/ats/Makefile.am
gnunet/src/ats/ats_api_scheduling.c
gnunet/src/ats/gnunet-service-ats.c
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/gnunet-service-ats_performance.c
gnunet/src/ats/gnunet-service-ats_scheduling.c
Log:
adding stats
Modified: gnunet/src/ats/Makefile.am
===================================================================
--- gnunet/src/ats/Makefile.am 2011-10-19 08:24:10 UTC (rev 17598)
+++ gnunet/src/ats/Makefile.am 2011-10-19 12:26:57 UTC (rev 17599)
@@ -22,12 +22,13 @@
gnunet-service-ats
gnunet_service_ats_SOURCES = \
- gnunet-service-ats.c \
+ gnunet-service-ats.c gnunet-service-ats.h\
gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \
gnunet-service-ats_performance.c gnunet-service-ats_performance.h \
gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \
gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h
gnunet_service_ats_LDADD = \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
@@ -35,7 +36,7 @@
check_PROGRAMS = \
test_ats_api_scheduling
# test_ats_api_bandwidth_consumption
-
+
if ENABLE_TEST_RUN
TESTS = $(check_PROGRAMS)
endif
Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2011-10-19 08:24:10 UTC (rev 17598)
+++ gnunet/src/ats/ats_api_scheduling.c 2011-10-19 12:26:57 UTC (rev 17599)
@@ -345,6 +345,7 @@
const struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert (session_id < sh->session_array_size);
+ GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used);
GNUNET_assert (0 == memcmp (peer,
&sh->session_array[session_id].peer,
sizeof (struct GNUNET_PeerIdentity)));
Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2011-10-19 08:24:10 UTC (rev 17598)
+++ gnunet/src/ats/gnunet-service-ats.c 2011-10-19 12:26:57 UTC (rev 17599)
@@ -27,12 +27,17 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_ats_service.h"
+#include "gnunet-service-ats.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_performance.h"
#include "gnunet-service-ats_scheduling.h"
#include "gnunet-service-ats_reservations.h"
#include "ats.h"
+/**
+ * Handle for statistics.
+ */
+struct GNUNET_STATISTICS_Handle *GSA_stats;
/**
* We have received a 'ClientStartMessage' from a client. Find out which
@@ -106,6 +111,11 @@
GAS_scheduling_done ();
GAS_performance_done ();
GAS_reservations_done ();
+ if (NULL != GSA_stats)
+ {
+ GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO);
+ GSA_stats = 0;
+ }
}
@@ -135,6 +145,7 @@
GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, 0},
{NULL, NULL, 0, 0}
};
+ GSA_stats = GNUNET_STATISTICS_create ("ats", cfg);
GAS_reservations_init ();
GAS_performance_init (server);
GAS_scheduling_init (server);
Added: gnunet/src/ats/gnunet-service-ats.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats.h (rev 0)
+++ gnunet/src/ats/gnunet-service-ats.h 2011-10-19 12:26:57 UTC (rev 17599)
@@ -0,0 +1,38 @@
+/*
+ This file is part of GNUnet.
+ (C) 2011 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 ats/gnunet-service-ats.h
+ * @brief ats service
+ * @author Matthias Wachs
+ * @author Christian Grothoff
+ */
+#ifndef GNUNET_SERVICE_ATS_H
+#define GNUNET_SERVICE_ATS_H
+
+#include "gnunet_statistics_service.h"
+
+/**
+ * Handle for statistics.
+ */
+extern struct GNUNET_STATISTICS_Handle *GSA_stats;
+
+
+#endif
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2011-10-19 08:24:10 UTC
(rev 17598)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2011-10-19 12:26:57 UTC
(rev 17599)
@@ -26,6 +26,7 @@
*/
#include "platform.h"
#include "gnunet_ats_service.h"
+#include "gnunet-service-ats.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_performance.h"
#include "gnunet-service-ats_scheduling.h"
@@ -134,6 +135,14 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Recalculating bandwidth for all active connections\n");
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# bandwidth recalculations performed",
+ 1,
+ GNUNET_NO);
+ GNUNET_STATISTICS_set (GSA_stats,
+ "# active addresses",
+ active_addr_count,
+ GNUNET_NO);
GNUNET_CONTAINER_multihashmap_iterate (addresses,
&update_bw_it,
NULL);
Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c 2011-10-19 08:24:10 UTC
(rev 17598)
+++ gnunet/src/ats/gnunet-service-ats_performance.c 2011-10-19 12:26:57 UTC
(rev 17599)
@@ -25,6 +25,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#include "gnunet-service-ats.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_performance.h"
#include "gnunet-service-ats_reservations.h"
@@ -183,10 +184,16 @@
strcpy (&addrp[plugin_addr_len], plugin_name);
for (pc = pc_head; pc != NULL; pc = pc->next)
if (pc->flag == START_FLAG_PERFORMANCE_WITH_PIC)
+ {
GNUNET_SERVER_notification_context_unicast (nc,
pc->client,
&msg->header,
GNUNET_YES);
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# performance updates given to clients",
+ 1,
+ GNUNET_NO);
+ }
}
@@ -225,6 +232,10 @@
result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT);
result.amount = htonl (amount);
result.res_delay = GNUNET_TIME_relative_hton (res_delay);
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# reservatin requests processed",
+ 1,
+ GNUNET_NO);
GNUNET_SERVER_notification_context_unicast (nc,
client,
&result.header,
@@ -266,6 +277,10 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# preference change requests processed",
+ 1,
+ GNUNET_NO);
pi = (const struct PreferenceInformation *) &msg[1];
for (i=0;i<nump;i++)
GAS_addresses_change_preference (&msg->peer,
Modified: gnunet/src/ats/gnunet-service-ats_scheduling.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.c 2011-10-19 08:24:10 UTC
(rev 17598)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.c 2011-10-19 12:26:57 UTC
(rev 17599)
@@ -25,6 +25,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#include "gnunet-service-ats.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_scheduling.h"
#include "ats.h"
@@ -114,6 +115,10 @@
if (my_client == NULL)
return;
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# address suggestions made",
+ 1,
+ GNUNET_NO);
GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct
GNUNET_ATS_Information));
msg = (struct AddressSuggestionMessage*) buf;
@@ -153,6 +158,10 @@
const struct RequestAddressMessage * msg = (const struct
RequestAddressMessage *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
"REQUEST_ADDRESS");
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# address requests received",
+ 1,
+ GNUNET_NO);
GNUNET_break (0 == ntohl (msg->reserved));
GAS_addresses_request_address (&msg->peer);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -210,6 +219,10 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# address updates received",
+ 1,
+ GNUNET_NO);
GAS_addresses_update (&m->peer,
plugin_name,
address,
@@ -276,6 +289,10 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
+ GNUNET_STATISTICS_update (GSA_stats,
+ "# addresses destroyed",
+ 1,
+ GNUNET_NO);
GAS_addresses_destroy (&m->peer,
plugin_name,
address,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17599 - gnunet/src/ats,
gnunet <=