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)
check_PROGRAMS = \
test_ats_api_scheduling
# test_ats_api_bandwidth_consumption
-
+
if ENABLE_TEST_RUN
TESTS = $(check_PROGRAMS)
endif
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)));
#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
GAS_scheduling_done ();
GAS_performance_done ();
GAS_reservations_done ();
+ if (NULL != GSA_stats)
+ {
+ GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO);
+ GSA_stats = 0;
+ }
}
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);
--- /dev/null
+/*
+ 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
*/
#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"
{
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);
* @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"
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);
+ }
}
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,
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,
* @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"
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;
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);
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,
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,