[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10583 - gnunet/src/topology
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10583 - gnunet/src/topology |
Date: |
Sat, 13 Mar 2010 11:00:36 +0100 |
Author: grothoff
Date: 2010-03-13 11:00:36 +0100 (Sat, 13 Mar 2010)
New Revision: 10583
Modified:
gnunet/src/topology/Makefile.am
gnunet/src/topology/gnunet-daemon-topology.c
Log:
stats
Modified: gnunet/src/topology/Makefile.am
===================================================================
--- gnunet/src/topology/Makefile.am 2010-03-13 10:00:28 UTC (rev 10582)
+++ gnunet/src/topology/Makefile.am 2010-03-13 10:00:36 UTC (rev 10583)
@@ -13,6 +13,7 @@
gnunet_daemon_topology_LDADD = \
$(top_builddir)/src/core/libgnunetcore.la \
$(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c 2010-03-13 10:00:28 UTC
(rev 10582)
+++ gnunet/src/topology/gnunet-daemon-topology.c 2010-03-13 10:00:36 UTC
(rev 10583)
@@ -29,6 +29,7 @@
#include "gnunet_core_service.h"
#include "gnunet_protocols.h"
#include "gnunet_peerinfo_service.h"
+#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
#include "gnunet_util_lib.h"
@@ -209,6 +210,11 @@
static struct PeerList *peers;
/**
+ * Handle for reporting statistics.
+ */
+static struct GNUNET_STATISTICS_Handle *stats;
+
+/**
* Flag to disallow non-friend connections (pure F2F mode).
*/
static int friends_only;
@@ -263,6 +269,10 @@
{
struct DisconnectList *dl = cls;
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# peers blacklisted"),
+ 1,
+ GNUNET_NO);
GNUNET_CONTAINER_DLL_remove (disconnect_head,
disconnect_tail,
dl);
@@ -314,6 +324,10 @@
struct PeerList *pl = cls;
pl->wh = NULL;
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# peers blacklisted"),
+ -1,
+ GNUNET_NO);
}
@@ -386,6 +400,10 @@
"Asking core to connect to `%s'\n",
GNUNET_i2s (&pos->id));
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# connect requests issued to core"),
+ 1,
+ GNUNET_NO);
pos->connect_req = GNUNET_CORE_peer_request_connect (sched, cfg,
GNUNET_TIME_UNIT_MINUTES,
&pos->id,
@@ -669,6 +687,10 @@
GNUNET_i2s (peer));
#endif
connection_count++;
+ GNUNET_STATISTICS_set (stats,
+ gettext_noop ("# peers connected"),
+ connection_count,
+ GNUNET_NO);
pos = find_peer (peer);
if (pos == NULL)
{
@@ -698,6 +720,10 @@
(GNUNET_YES != friends_only) )
whitelist_peers ();
friend_count++;
+ GNUNET_STATISTICS_set (stats,
+ gettext_noop ("# friends connected"),
+ connection_count,
+ GNUNET_NO);
}
reschedule_hellos (pos);
}
@@ -780,8 +806,18 @@
return;
}
connection_count--;
+ GNUNET_STATISTICS_set (stats,
+ gettext_noop ("# peers connected"),
+ connection_count,
+ GNUNET_NO);
if (pos->is_friend)
- friend_count--;
+ {
+ friend_count--;
+ GNUNET_STATISTICS_set (stats,
+ gettext_noop ("# friends connected"),
+ connection_count,
+ GNUNET_NO);
+ }
if ( (connection_count < target_connection_count) ||
(friend_count < minimum_friend_count) )
try_add_peers ();
@@ -1127,6 +1163,10 @@
}
GNUNET_free (data);
GNUNET_free (fn);
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# friends in configuration"),
+ entries_found,
+ GNUNET_NO);
if ( (minimum_friend_count > entries_found) &&
(friends_only == GNUNET_NO) )
{
@@ -1169,6 +1209,10 @@
"HELLO",
GNUNET_i2s (other));
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# HELLO messages received"),
+ 1,
+ GNUNET_NO);
if (transport != NULL)
GNUNET_TRANSPORT_offer_hello (transport,
message);
@@ -1236,6 +1280,10 @@
(unsigned int) want,
"HELLO");
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# HELLO messages gossipped"),
+ 1,
+ GNUNET_NO);
}
}
pl->next_hello_allowed = GNUNET_TIME_relative_to_absolute
(HELLO_ADVERTISEMENT_MIN_FREQUENCY);
@@ -1278,6 +1326,11 @@
GNUNET_TRANSPORT_blacklist_cancel (dl->rh);
GNUNET_free (dl);
}
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+ stats = NULL;
+ }
}
@@ -1306,6 +1359,7 @@
sched = s;
cfg = c;
+ stats = GNUNET_STATISTICS_create (sched, "topology", cfg);
autoconnect = GNUNET_CONFIGURATION_get_value_yesno (cfg,
"TOPOLOGY",
"AUTOCONNECT");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10583 - gnunet/src/topology,
gnunet <=