diff options
author | MrSquanchee <usuraj35@gmail.com> | 2020-04-04 17:49:50 +0530 |
---|---|---|
committer | MrSquanchee <usuraj35@gmail.com> | 2020-07-31 21:12:16 +0530 |
commit | a93c3d7a8d98f04f8e651543e4031bb18008aa74 (patch) | |
tree | c38a4c9b1ce56e5f8c4423723fb9c74864c03ddb /src/feature/stats/bwhist.h | |
parent | 708f51637f138a14e5093e442f5ba7b5f8f2479d (diff) | |
download | tor-a93c3d7a8d98f04f8e651543e4031bb18008aa74.tar.gz tor-a93c3d7a8d98f04f8e651543e4031bb18008aa74.zip |
Added tests for bandwidth functions
Added tests for
1. commit_max
2. advance_obs
3. add_obs
4. rep_hist_fill_bandwidth_history
5. rep_hist_get_bandwidth_lines
(Lightly edited by nickm to use new names from bwhist refactoring.)
Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
Diffstat (limited to 'src/feature/stats/bwhist.h')
-rw-r--r-- | src/feature/stats/bwhist.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/feature/stats/bwhist.h b/src/feature/stats/bwhist.h index d556f5a026..f88b951447 100644 --- a/src/feature/stats/bwhist.h +++ b/src/feature/stats/bwhist.h @@ -31,6 +31,13 @@ typedef struct bw_array_t bw_array_t; STATIC uint64_t find_largest_max(bw_array_t *b); STATIC void commit_max(bw_array_t *b); STATIC void advance_obs(bw_array_t *b); +STATIC bw_array_t *bw_array_new(void); +STATIC void add_obs(bw_array_t *b, time_t when, uint64_t n); +#define bw_array_free(val) \ + FREE_AND_NULL(bw_array_t, bw_array_free_, (val)) +STATIC void bw_array_free_(bw_array_t *b); +STATIC size_t bwhist_fill_bandwidth_history(char *buf, size_t len, + const bw_array_t *b); #endif /* defined(REPHIST_PRIVATE) */ #ifdef TOR_UNIT_TESTS |