diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-08-21 12:37:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-08-22 10:15:57 -0400 |
commit | 8920fc545738393fc8320b61bac897f67a66e6c9 (patch) | |
tree | 06fef01046a2b1c765531a1ee47eebaf46193f66 /src/or/circuitstats.h | |
parent | 79cad08b4f9afd13a7151b8e15ae6481df82478f (diff) | |
download | tor-8920fc545738393fc8320b61bac897f67a66e6c9.tar.gz tor-8920fc545738393fc8320b61bac897f67a66e6c9.zip |
Hide the contents of the circuit_build_times structure.
There were only two functions outside of circuitstats that actually
wanted to know what was inside this. Making the structure itself
hidden should help isolation and prevent us from spaghettifying the
thing more.
Diffstat (limited to 'src/or/circuitstats.h')
-rw-r--r-- | src/or/circuitstats.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/or/circuitstats.h b/src/or/circuitstats.h index 196af3fab4..38a7e4efa8 100644 --- a/src/or/circuitstats.h +++ b/src/or/circuitstats.h @@ -40,6 +40,8 @@ void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt, double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt); double circuit_build_times_close_rate(const circuit_build_times_t *cbt); +void circuit_build_times_update_last_circ(circuit_build_times_t *cbt); + #ifdef CIRCUITSTATS_PRIVATE STATIC double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt, double quantile); @@ -65,5 +67,32 @@ void circuit_build_times_network_is_live(circuit_build_times_t *cbt); int circuit_build_times_network_check_live(const circuit_build_times_t *cbt); void circuit_build_times_network_circ_success(circuit_build_times_t *cbt); +#ifdef CIRCUITSTATS_PRIVATE +/** Structure for circuit build times history */ +struct circuit_build_times_s{ + /** The circular array of recorded build times in milliseconds */ + build_time_t circuit_build_times[CBT_NCIRCUITS_TO_OBSERVE]; + /** Current index in the circuit_build_times circular array */ + int build_times_idx; + /** Total number of build times accumulated. Max CBT_NCIRCUITS_TO_OBSERVE */ + int total_build_times; + /** Information about the state of our local network connection */ + network_liveness_t liveness; + /** Last time we built a circuit. Used to decide to build new test circs */ + time_t last_circ_at; + /** "Minimum" value of our pareto distribution (actually mode) */ + build_time_t Xm; + /** alpha exponent for pareto dist. */ + double alpha; + /** Have we computed a timeout? */ + int have_computed_timeout; + /** The exact value for that timeout in milliseconds. Stored as a double + * to maintain precision from calculations to and from quantile value. */ + double timeout_ms; + /** How long we wait before actually closing the circuit. */ + double close_ms; +}; +#endif + #endif |