summaryrefslogtreecommitdiff
path: root/src/or/status.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/status.c')
-rw-r--r--src/or/status.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/or/status.c b/src/or/status.c
index 04cd96eed5..d239e6ee75 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Tor Project, Inc. */
+/* Copyright (c) 2010-2013, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
@@ -10,9 +10,11 @@
#include "config.h"
#include "status.h"
#include "nodelist.h"
+#include "relay.h"
#include "router.h"
#include "circuitlist.h"
#include "main.h"
+#include "hibernate.h"
/** Return the total number of circuits. */
static int
@@ -21,7 +23,7 @@ count_circuits(void)
circuit_t *circ;
int nr=0;
- for (circ = _circuit_get_global_list(); circ; circ = circ->next)
+ for (circ = circuit_get_global_list_(); circ; circ = circ->next)
nr++;
return nr;
@@ -84,11 +86,13 @@ log_heartbeat(time_t now)
char *bw_rcvd = NULL;
char *uptime = NULL;
const routerinfo_t *me;
+ double r = tls_get_write_overhead_ratio();
+ const int hibernating = we_are_hibernating();
const or_options_t *options = get_options();
(void)now;
- if (public_server_mode(options)) {
+ if (public_server_mode(options) && !hibernating) {
/* Let's check if we are in the current cached consensus. */
if (!(me = router_get_my_routerinfo()))
return -1; /* Something stinks, we won't even attempt this. */
@@ -103,8 +107,19 @@ log_heartbeat(time_t now)
bw_sent = bytes_to_usage(get_bytes_written());
log_fn(LOG_NOTICE, LD_HEARTBEAT, "Heartbeat: Tor's uptime is %s, with %d "
- "circuits open. I've sent %s and received %s.",
- uptime, count_circuits(),bw_sent,bw_rcvd);
+ "circuits open. I've sent %s and received %s.%s",
+ uptime, count_circuits(),bw_sent,bw_rcvd,
+ hibernating?" We are currently hibernating.":"");
+
+ if (stats_n_data_cells_packaged && !hibernating)
+ log_notice(LD_HEARTBEAT, "Average packaged cell fullness: %2.3f%%",
+ 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
+ U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
+
+ if (r > 1.0) {
+ double overhead = ( r - 1.0 ) * 100.0;
+ log_notice(LD_HEARTBEAT, "TLS write overhead: %.f%%", overhead);
+ }
tor_free(uptime);
tor_free(bw_sent);