aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/main.c5
-rw-r--r--src/or/rephist.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index b6b3f8f6a0..7c9e2029ec 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1132,12 +1132,13 @@ dumpmemusage(int severity)
extern uint64_t buf_total_used;
extern uint64_t buf_total_alloc;
extern uint64_t rephist_total_alloc;
+ extern uint32_t rephist_total_num;
log(severity, "In buffers: "U64_FORMAT" used/"U64_FORMAT" allocated (%d conns).",
U64_PRINTF_ARG(buf_total_used), U64_PRINTF_ARG(buf_total_alloc),
nfds);
- log(severity, "In rephist: "U64_FORMAT" used.",
- U64_PRINTF_ARG(rephist_total_alloc));
+ log(severity, "In rephist: "U64_FORMAT" used by %d Tors.",
+ U64_PRINTF_ARG(rephist_total_alloc), rephist_total_num);
}
/** Write all statistics to the log, with log level 'severity'. Called
diff --git a/src/or/rephist.c b/src/or/rephist.c
index d3dbe02811..ea8756a721 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -15,7 +15,8 @@ const char rephist_c_id[] = "$Id$";
static void bw_arrays_init(void);
static void predicted_ports_init(void);
-uint64_t rephist_total_alloc;
+uint64_t rephist_total_alloc=0;
+uint32_t rephist_total_num=0;
/** History of an OR-\>OR link. */
typedef struct link_history_t {
@@ -73,6 +74,7 @@ get_or_history(const char* id)
if (!hist) {
hist = tor_malloc_zero(sizeof(or_history_t));
rephist_total_alloc += sizeof(or_history_t);
+ rephist_total_num++;
hist->link_history_map = strmap_new();
hist->since = hist->changed = time(NULL);
strmap_set(history_map, hexid, hist);
@@ -121,6 +123,7 @@ free_or_history(void *_hist)
or_history_t *hist = _hist;
strmap_free(hist->link_history_map, _free_link_history);
rephist_total_alloc -= sizeof(or_history_t);
+ rephist_total_num--;
tor_free(hist);
}