diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2010-06-15 18:02:19 -0700 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2010-06-15 20:04:49 -0700 |
commit | 2abe1ceccfacaa8deca3b7bb4caeb550572efd7f (patch) | |
tree | 121a7b7ab45ff3c0f7e9b40d4cd53921e5492e0d /src/or/circuitbuild.c | |
parent | 82922ea45a24e7f79ac4c1ddf4d9de02c604546d (diff) | |
download | tor-2abe1ceccfacaa8deca3b7bb4caeb550572efd7f.tar tor-2abe1ceccfacaa8deca3b7bb4caeb550572efd7f.tar.gz |
Add CLOSE_MS and CLOSE_RATE keywords to buildtimeout event.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f244aeaff..ddc7da4b3 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1089,6 +1089,25 @@ circuit_build_times_timeout_rate(const circuit_build_times_t *cbt) } /** + * Count the number of closed circuits in a set of cbt data. + */ +double +circuit_build_times_close_rate(const circuit_build_times_t *cbt) +{ + int i=0,closed=0; + for (i = 0; i < CBT_NCIRCUITS_TO_OBSERVE; i++) { + if (cbt->circuit_build_times[i] == CBT_BUILD_ABANDONED) { + closed++; + } + } + + if (!cbt->total_build_times) + return 0; + + return ((double)closed)/cbt->total_build_times; +} + +/** * Store a timeout as a synthetic value. * * Returns true if the store was successful and we should possibly |