[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] add a trivial tor-counting variable
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
main.c rephist.c
Log Message:
add a trivial tor-counting variable
Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.527
retrieving revision 1.528
diff -u -d -r1.527 -r1.528
--- main.c 15 Jul 2005 19:09:36 -0000 1.527
+++ main.c 18 Jul 2005 06:09:04 -0000 1.528
@@ -1132,12 +1132,13 @@
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
Index: rephist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/rephist.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- rephist.c 15 Jun 2005 18:34:46 -0000 1.60
+++ rephist.c 18 Jul 2005 06:09:04 -0000 1.61
@@ -15,7 +15,8 @@
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 @@
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 @@
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);
}