diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-10 09:17:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-10 09:27:42 -0400 |
commit | 515cc49cb7fce62db8256f2729e4473015574d1a (patch) | |
tree | cd02a705e014d9ebe0fb4dad5449a0f88fb22dc2 /src/feature/stats | |
parent | 3f2de0bcca301785c5f1911354f2d3f4d5ba1708 (diff) | |
download | tor-515cc49cb7fce62db8256f2729e4473015574d1a.tar.gz tor-515cc49cb7fce62db8256f2729e4473015574d1a.zip |
connstats: add and clarify some documentation.
Diffstat (limited to 'src/feature/stats')
-rw-r--r-- | src/feature/stats/connstats.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/feature/stats/connstats.c b/src/feature/stats/connstats.c index 32987ecf95..82b1adcd9c 100644 --- a/src/feature/stats/connstats.c +++ b/src/feature/stats/connstats.c @@ -8,8 +8,12 @@ * @file connstats.c * @brief Count bidirectional vs one-way connections. * - * Connection statistics, used by relays to count connections, and track - * one-way and bidirectional connections. + * Connection statistics, use to track one-way and bidirectional connections. + * + * Note that this code counts concurrent connections in each + * BIDI_INTERVAL-second interval, not total connections. It can tell you what + * fraction of connections are bidirectional at each time, not necessarily + * what number are bidirectional. **/ #include "orconfig.h" @@ -28,16 +32,16 @@ conn_stats_init(time_t now) start_of_conn_stats_interval = now; } -/* Count connections that we read and wrote less than these many bytes - * from/to as below threshold. */ +/** Count connections on which we read and wrote less than this many bytes + * as "below threshold." */ #define BIDI_THRESHOLD 20480 -/* Count connections that we read or wrote at least this factor as many +/** Count connections that we read or wrote at least this factor as many * bytes from/to than we wrote or read to/from as mostly reading or * writing. */ #define BIDI_FACTOR 10 -/* Interval length in seconds for considering read and written bytes for +/** Interval length in seconds for considering read and written bytes for * connection stats. */ #define BIDI_INTERVAL 10 @@ -75,13 +79,14 @@ typedef struct bidi_map_entry_t { static HT_HEAD(bidimap, bidi_map_entry_t) bidi_map = HT_INITIALIZER(); +/** Hashtable helper: return true if @a a and @a b have the same key. */ static int bidi_map_ent_eq(const bidi_map_entry_t *a, const bidi_map_entry_t *b) { return a->conn_id == b->conn_id; } -/* DOCDOC bidi_map_ent_hash */ +/** Hashtable helper: compute a digest for the key of @a entry. */ static unsigned bidi_map_ent_hash(const bidi_map_entry_t *entry) { |