[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6150 - GNUnet/src/server
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6150 - GNUnet/src/server |
Date: |
Mon, 4 Feb 2008 09:24:18 -0700 (MST) |
Author: grothoff
Date: 2008-02-04 09:24:18 -0700 (Mon, 04 Feb 2008)
New Revision: 6150
Modified:
GNUnet/src/server/connection.c
GNUnet/src/server/tcpserver.c
GNUnet/src/server/tcpserver.h
Log:
more stats, cleaner API
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2008-02-04 16:23:36 UTC (rev 6149)
+++ GNUnet/src/server/connection.c 2008-02-04 16:24:18 UTC (rev 6150)
@@ -659,6 +659,8 @@
static int stat_transport_switches;
+static int stat_avg_lifetime;
+
/* ******************** CODE ********************* */
static void
@@ -2767,6 +2769,8 @@
unsigned long long total_allowed_now;
unsigned long long total_allowed_recv;
unsigned long long total_send_buffer_size;
+ GNUNET_CronTime total_connection_lifetime;
+ unsigned int connection_count;
int load_nup;
int load_cpu;
GNUNET_TSession *tsession;
@@ -2780,7 +2784,9 @@
total_allowed_recv = 0;
total_allowed_now = 0;
total_send_buffer_size = 0;
- GNUNET_mutex_lock (lock);
+ connection_count = 0;
+ total_connection_lifetime = 0;
+ GNUNET_mutex_lock (lock);
for (i = 0; i < CONNECTION_MAX_HOSTS_; i++)
{
root = CONNECTION_buffer_[i];
@@ -2801,6 +2807,12 @@
GNUNET_free (tmp);
continue; /* no need to call 'send buffer' */
case STAT_UP:
+ if ( (root->time_established > now) &&
+ (root->time_established != 0) )
+ {
+ connection_count++;
+ total_connection_lifetime += root->time_established - now;
+ }
updateCurBPS (root);
total_allowed_sent += root->max_bpm;
total_allowed_recv += root->idealized_limit;
@@ -2949,6 +2961,10 @@
stats->set (stat_total_allowed_recv, total_allowed_recv / 60); /* bpm
to bps */
stats->set (stat_total_allowed_now, total_allowed_now);
stats->set (stat_total_send_buffer_size, total_send_buffer_size);
+ if (connection_count > 0)
+ stats->set(stat_avg_lifetime, total_connection_lifetime /
connection_count);
+ else
+ stats->set(stat_avg_lifetime, 0);
}
EXIT ();
}
@@ -3669,6 +3685,9 @@
stat_transport_switches =
stats->
create (gettext_noop ("# transports switched to stream transport"));
+ stat_avg_lifetime =
+ stats->
+ create (gettext_noop ("# average connection lifetime (in ms)"));
}
transport->start (&GNUNET_CORE_p2p_receive);
EXIT ();
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2008-02-04 16:23:36 UTC (rev 6149)
+++ GNUnet/src/server/tcpserver.c 2008-02-04 16:24:18 UTC (rev 6150)
@@ -611,10 +611,11 @@
}
struct GNUNET_GE_Context *
-GNUNET_CORE_cs_create_client_log_context (GNUNET_GE_KIND mask,
- struct GNUNET_ClientHandle *handle)
+GNUNET_CORE_cs_create_client_log_context (struct GNUNET_ClientHandle *handle)
{
- return GNUNET_GE_create_context_callback (mask,
+ return GNUNET_GE_create_context_callback (GNUNET_GE_USER |
+ GNUNET_GE_EVENTKIND |
+ GNUNET_GE_ROUTEKIND,
&logClientLogContext,
handle,
&freeClientLogContext,
Modified: GNUnet/src/server/tcpserver.h
===================================================================
--- GNUnet/src/server/tcpserver.h 2008-02-04 16:23:36 UTC (rev 6149)
+++ GNUnet/src/server/tcpserver.h 2008-02-04 16:24:18 UTC (rev 6150)
@@ -127,9 +127,8 @@
*/
unsigned int GNUNET_CORE_cs_test_handler_registered (unsigned short type);
-struct GNUNET_GE_Context
- *GNUNET_CORE_cs_create_client_log_context (GNUNET_GE_KIND mask,
- struct GNUNET_ClientHandle
+struct GNUNET_GE_Context *
+GNUNET_CORE_cs_create_client_log_context (struct GNUNET_ClientHandle
*handle);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6150 - GNUnet/src/server,
gnunet <=