diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2022-11-08 18:25:07 +0000 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2022-11-08 18:25:07 +0000 |
commit | 59bef48490e4191be978aa023f05242f889be720 (patch) | |
tree | 027665393823f57be3a59479e6f363e648bdf451 | |
parent | 00633bc619046e09536d742e5f862d75c35e476f (diff) | |
download | tor-59bef48490e4191be978aa023f05242f889be720.tar.gz tor-59bef48490e4191be978aa023f05242f889be720.zip |
metrics: Record percentage of blocked channels
Part of #40708.
-rw-r--r-- | src/core/or/congestion_control_vegas.c | 28 | ||||
-rw-r--r-- | src/core/or/congestion_control_vegas.h | 2 | ||||
-rw-r--r-- | src/feature/relay/relay_metrics.c | 18 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c index 8351aa6e27..ee1312699c 100644 --- a/src/core/or/congestion_control_vegas.c +++ b/src/core/or/congestion_control_vegas.c @@ -54,10 +54,14 @@ double cc_stats_vegas_exit_ss_cwnd_ma = 0; double cc_stats_vegas_gamma_drop_ma = 0; double cc_stats_vegas_delta_drop_ma = 0; +double cc_stats_vegas_ss_csig_blocked_ma = 0; +double cc_stats_vegas_csig_blocked_ma = 0; /* Running count of this moving average. Needed so we can update it. */ static double stats_cwnd_exit_ss_ma_count = 0; static double stats_cwnd_gamma_drop_ma_count = 0; static double stats_cwnd_delta_drop_ma_count = 0; +static double stats_ss_csig_blocked_ma_count = 0; +static double stats_csig_blocked_ma_count = 0; /** Stats on how many times we reached "delta" param. */ uint64_t cc_stats_vegas_above_delta = 0; @@ -348,6 +352,18 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc, stats_update_running_avg(cc_stats_vegas_gamma_drop_ma, cwnd_diff, stats_cwnd_gamma_drop_ma_count); + stats_ss_csig_blocked_ma_count++; + /* Compute the percentage we experience a blocked csig vs RTT sig */ + if (cc->blocked_chan) { + cc_stats_vegas_ss_csig_blocked_ma = + stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma, + 100, stats_ss_csig_blocked_ma_count); + } else { + cc_stats_vegas_ss_csig_blocked_ma = + stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma, + 0, stats_ss_csig_blocked_ma_count); + } + congestion_control_vegas_exit_slow_start(circ, cc); } @@ -375,6 +391,18 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc, cc_stats_vegas_above_delta++; } else if (queue_use > cc->vegas_params.beta || cc->blocked_chan) { + stats_csig_blocked_ma_count++; + /* Compute the percentage we experience a blocked csig vs RTT sig */ + if (cc->blocked_chan) { + cc_stats_vegas_csig_blocked_ma = + stats_update_running_avg(cc_stats_vegas_csig_blocked_ma, + 100, stats_csig_blocked_ma_count); + } else { + cc_stats_vegas_csig_blocked_ma = + stats_update_running_avg(cc_stats_vegas_csig_blocked_ma, + 0, stats_csig_blocked_ma_count); + } + cc->cwnd -= CWND_INC(cc); } else if (queue_use < cc->vegas_params.alpha) { cc->cwnd += CWND_INC(cc); diff --git a/src/core/or/congestion_control_vegas.h b/src/core/or/congestion_control_vegas.h index 6048b1e26d..722ffde01a 100644 --- a/src/core/or/congestion_control_vegas.h +++ b/src/core/or/congestion_control_vegas.h @@ -15,6 +15,8 @@ extern double cc_stats_vegas_exit_ss_cwnd_ma; extern double cc_stats_vegas_gamma_drop_ma; extern double cc_stats_vegas_delta_drop_ma; +extern double cc_stats_vegas_ss_csig_blocked_ma; +extern double cc_stats_vegas_csig_blocked_ma; extern uint64_t cc_stats_vegas_above_delta; extern uint64_t cc_stats_vegas_above_ss_cwnd_max; diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c index cd80c5e95e..ca8fbe706d 100644 --- a/src/feature/relay/relay_metrics.c +++ b/src/feature/relay/relay_metrics.c @@ -404,6 +404,15 @@ fill_cc_values(void) sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, + metrics_format_label("state", "slow_start_exit")); + metrics_store_entry_add_label(sentry, + metrics_format_label("action", "chan_blocked_pct")); + metrics_store_entry_update(sentry, + tor_llround(cc_stats_vegas_ss_csig_blocked_ma)); + + sentry = metrics_store_add(the_store, rentry->type, rentry->name, + rentry->help); + metrics_store_entry_add_label(sentry, metrics_format_label("state", "on_circ_close")); metrics_store_entry_add_label(sentry, metrics_format_label("action", "cwnd")); @@ -479,6 +488,15 @@ fill_cc_values(void) metrics_format_label("action", "delta_drop")); metrics_store_entry_update(sentry, tor_llround(cc_stats_vegas_delta_drop_ma)); + + sentry = metrics_store_add(the_store, rentry->type, rentry->name, + rentry->help); + metrics_store_entry_add_label(sentry, + metrics_format_label("state", "process_sendme")); + metrics_store_entry_add_label(sentry, + metrics_format_label("action", "chan_blocked_pct")); + metrics_store_entry_update(sentry, + tor_llround(cc_stats_vegas_csig_blocked_ma)); } /** Helper: Fill in single stream metrics output. */ |