metrics: Record percentage of blocked channels

Part of #40708.
This commit is contained in:
Mike Perry 2022-11-08 18:25:07 +00:00
parent 00633bc619
commit 59bef48490
3 changed files with 48 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -401,6 +401,15 @@ fill_cc_values(void)
metrics_store_entry_update(sentry,
tor_llround(cc_stats_vegas_gamma_drop_ma));
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,
@ -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. */