diff options
author | George Kadianakis <desnacked@riseup.net> | 2021-03-09 15:36:40 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2021-03-17 18:22:38 +0200 |
commit | 0a5ecb334298187a64f58382231245111130aa76 (patch) | |
tree | 90ddab78a61f285b17ab01a7893763e5f39684a8 /src/feature/stats/rephist.h | |
parent | 80b6054bb016aca0b18f8da79f23a859a804ef07 (diff) | |
download | tor-0a5ecb334298187a64f58382231245111130aa76.tar.gz tor-0a5ecb334298187a64f58382231245111130aa76.zip |
Implement backbone of overload statistics.
- Implement overload statistics structure.
- Implement function that keeps track of overload statistics.
- Implement function that writes overload statistics to descriptor.
- Unittest for the whole logic.
Diffstat (limited to 'src/feature/stats/rephist.h')
-rw-r--r-- | src/feature/stats/rephist.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h index 7ecbfebfd7..45020d7967 100644 --- a/src/feature/stats/rephist.h +++ b/src/feature/stats/rephist.h @@ -140,6 +140,24 @@ void rep_hist_reset_padding_counts(void); void rep_hist_prep_published_padding_counts(time_t now); void rep_hist_padding_count_timers(uint64_t num_timers); +/** + * Represents the various types of overload we keep track of and expose in our + * extra-info descriptor. +*/ +typedef enum { + /* A general overload -- can have many different causes. */ + OVERLOAD_GENERAL, + /* We went over our configured read rate/burst bandwidth limit */ + OVERLOAD_READ, + /* We went over our configured write rate/burst bandwidth limit */ + OVERLOAD_WRITE, + /* We exhausted the file descriptors in this system */ + OVERLOAD_FD_EXHAUSTED, +} overload_type_t; + +void rep_hist_note_overload(overload_type_t overload); +char *rep_hist_get_overload_stats_lines(void); + #ifdef TOR_UNIT_TESTS struct hs_v2_stats_t; const struct hs_v2_stats_t *rep_hist_get_hs_v2_stats(void); |