mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'maint-0.4.7'
This commit is contained in:
@@ -154,6 +154,8 @@ double cc_stats_circ_close_cwnd_ma = 0;
|
||||
/** Moving average of the cc->cwnd from each closed slow-start circuit. */
|
||||
double cc_stats_circ_close_ss_cwnd_ma = 0;
|
||||
|
||||
uint64_t cc_stats_circs_closed = 0;
|
||||
|
||||
/********* END VARIABLES ************/
|
||||
|
||||
/* Implement circuit handle helpers. */
|
||||
@@ -2249,6 +2251,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line,
|
||||
stats_update_running_avg(cc_stats_circ_close_cwnd_ma,
|
||||
circ->ccontrol->cwnd);
|
||||
}
|
||||
cc_stats_circs_closed++;
|
||||
}
|
||||
|
||||
if (circuits_pending_close == NULL)
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
/** Stats. */
|
||||
extern double cc_stats_circ_close_cwnd_ma;
|
||||
extern double cc_stats_circ_close_ss_cwnd_ma;
|
||||
extern uint64_t cc_stats_circs_closed;
|
||||
|
||||
/** Convert a circuit_t* to a pointer to the enclosing or_circuit_t. Assert
|
||||
* if the cast is impossible. */
|
||||
|
||||
@@ -132,6 +132,9 @@ static uint8_t bwe_sendme_min;
|
||||
*/
|
||||
static uint8_t rtt_reset_pct;
|
||||
|
||||
/** Metric to count the number of congestion control circuits **/
|
||||
uint64_t cc_stats_circs_created = 0;
|
||||
|
||||
/** Return the number of RTT reset that have been done. */
|
||||
uint64_t
|
||||
congestion_control_get_num_rtt_reset(void)
|
||||
@@ -422,6 +425,8 @@ congestion_control_new(const circuit_params_t *params, cc_path_t path)
|
||||
|
||||
congestion_control_init(cc, params, path);
|
||||
|
||||
cc_stats_circs_created++;
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ char *congestion_control_get_control_port_fields(const origin_circuit_t *);
|
||||
uint64_t congestion_control_get_num_rtt_reset(void);
|
||||
uint64_t congestion_control_get_num_clock_stalls(void);
|
||||
|
||||
extern uint64_t cc_stats_circs_created;
|
||||
|
||||
/* Ugh, C.. these are private. Use the getter instead, when
|
||||
* external to the congestion control code. */
|
||||
extern uint32_t or_conn_highwater;
|
||||
|
||||
@@ -52,15 +52,26 @@
|
||||
|
||||
/** Moving average of the cc->cwnd from each circuit exiting slowstart. */
|
||||
double cc_stats_vegas_exit_ss_cwnd_ma = 0;
|
||||
double cc_stats_vegas_exit_ss_bdp_ma = 0;
|
||||
double cc_stats_vegas_exit_ss_inc_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;
|
||||
double cc_stats_vegas_csig_alpha_ma = 0;
|
||||
double cc_stats_vegas_csig_beta_ma = 0;
|
||||
double cc_stats_vegas_csig_delta_ma = 0;
|
||||
|
||||
double cc_stats_vegas_ss_queue_ma = 0;
|
||||
double cc_stats_vegas_queue_ma = 0;
|
||||
double cc_stats_vegas_bdp_ma = 0;
|
||||
|
||||
/** Stats on how many times we reached "delta" param. */
|
||||
uint64_t cc_stats_vegas_above_delta = 0;
|
||||
/** Stats on how many times we reached "ss_cwnd_max" param. */
|
||||
uint64_t cc_stats_vegas_above_ss_cwnd_max = 0;
|
||||
uint64_t cc_stats_vegas_below_ss_inc_floor = 0;
|
||||
uint64_t cc_stats_vegas_circ_exited_ss = 0;
|
||||
|
||||
/**
|
||||
* The original TCP Vegas congestion window BDP estimator.
|
||||
@@ -256,10 +267,17 @@ congestion_control_vegas_exit_slow_start(const circuit_t *circ,
|
||||
cc->next_cc_event = CWND_UPDATE_RATE(cc);
|
||||
congestion_control_vegas_log(circ, cc);
|
||||
|
||||
/* Update running cc->cwnd average for metrics. */
|
||||
/* Update metricsport metrics */
|
||||
cc_stats_vegas_exit_ss_cwnd_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_exit_ss_cwnd_ma,
|
||||
cc->cwnd);
|
||||
cc_stats_vegas_exit_ss_bdp_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_exit_ss_bdp_ma,
|
||||
vegas_bdp(cc));
|
||||
cc_stats_vegas_exit_ss_inc_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_exit_ss_inc_ma,
|
||||
rfc3742_ss_inc(cc));
|
||||
cc_stats_vegas_circ_exited_ss++;
|
||||
|
||||
/* We need to report that slow start has exited ASAP,
|
||||
* for sbws bandwidth measurement. */
|
||||
@@ -327,32 +345,39 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
if (inc*SENDME_PER_CWND(cc) <= CWND_INC(cc)) {
|
||||
cc->cwnd += inc;
|
||||
congestion_control_vegas_exit_slow_start(circ, cc);
|
||||
|
||||
cc_stats_vegas_below_ss_inc_floor++;
|
||||
|
||||
/* We exited slow start without being blocked */
|
||||
cc_stats_vegas_ss_csig_blocked_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma,
|
||||
0);
|
||||
} else {
|
||||
cc->cwnd += inc;
|
||||
cc->next_cc_event = 1; // Technically irellevant, but for consistency
|
||||
}
|
||||
} else {
|
||||
uint64_t old_cwnd = cc->cwnd;
|
||||
uint64_t cwnd_diff;
|
||||
|
||||
/* Congestion signal: Set cwnd to gamma threshhold */
|
||||
cc->cwnd = vegas_bdp(cc) + cc->vegas_params.gamma;
|
||||
|
||||
/* Account the amount we reduced the cwnd by for the gamma cutoff */
|
||||
cwnd_diff = (old_cwnd > cc->cwnd ? old_cwnd - cc->cwnd : 0);
|
||||
cc_stats_vegas_gamma_drop_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_gamma_drop_ma,
|
||||
cwnd_diff);
|
||||
|
||||
/* 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);
|
||||
} else {
|
||||
uint64_t cwnd_diff = (old_cwnd > cc->cwnd ? old_cwnd - cc->cwnd : 0);
|
||||
|
||||
cc_stats_vegas_ss_csig_blocked_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma,
|
||||
0);
|
||||
|
||||
/* Account the amount we reduced the cwnd by for the gamma cutoff */
|
||||
cc_stats_vegas_gamma_drop_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_gamma_drop_ma,
|
||||
cwnd_diff);
|
||||
}
|
||||
|
||||
congestion_control_vegas_exit_slow_start(circ, cc);
|
||||
@@ -363,6 +388,10 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
congestion_control_vegas_exit_slow_start(circ, cc);
|
||||
cc_stats_vegas_above_ss_cwnd_max++;
|
||||
}
|
||||
|
||||
cc_stats_vegas_ss_queue_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_ss_queue_ma,
|
||||
queue_use);
|
||||
/* After slow start, We only update once per window */
|
||||
} else if (cc->next_cc_event == 0) {
|
||||
if (queue_use > cc->vegas_params.delta) {
|
||||
@@ -380,7 +409,20 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
cwnd_diff);
|
||||
|
||||
cc_stats_vegas_above_delta++;
|
||||
|
||||
/* Percentage metrics: Add 100% delta, 0 for other two */
|
||||
cc_stats_vegas_csig_alpha_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_alpha_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_beta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_beta_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_delta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_delta_ma,
|
||||
100);
|
||||
} else if (queue_use > cc->vegas_params.beta || cc->blocked_chan) {
|
||||
cc->cwnd -= CWND_INC(cc);
|
||||
|
||||
/* Compute the percentage we experience a blocked csig vs RTT sig */
|
||||
if (cc->blocked_chan) {
|
||||
cc_stats_vegas_csig_blocked_ma =
|
||||
@@ -392,9 +434,40 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
0);
|
||||
}
|
||||
|
||||
cc->cwnd -= CWND_INC(cc);
|
||||
/* Percentage counters: Add 100% beta, 0 for other two */
|
||||
cc_stats_vegas_csig_alpha_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_alpha_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_beta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_beta_ma,
|
||||
100);
|
||||
cc_stats_vegas_csig_delta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_delta_ma,
|
||||
0);
|
||||
} else if (queue_use < cc->vegas_params.alpha) {
|
||||
cc->cwnd += CWND_INC(cc);
|
||||
|
||||
/* Percentage counters: Add 100% alpha, 0 for other two */
|
||||
cc_stats_vegas_csig_alpha_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_alpha_ma,
|
||||
100);
|
||||
cc_stats_vegas_csig_beta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_beta_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_delta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_delta_ma,
|
||||
0);
|
||||
} else {
|
||||
/* Percentage counters: No signal this round. Add 0% to all */
|
||||
cc_stats_vegas_csig_alpha_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_alpha_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_beta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_beta_ma,
|
||||
0);
|
||||
cc_stats_vegas_csig_delta_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_csig_delta_ma,
|
||||
0);
|
||||
}
|
||||
|
||||
/* cwnd can never fall below 1 increment */
|
||||
@@ -405,6 +478,14 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
|
||||
congestion_control_vegas_log(circ, cc);
|
||||
|
||||
/* Update metrics */
|
||||
cc_stats_vegas_queue_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_queue_ma,
|
||||
queue_use);
|
||||
cc_stats_vegas_bdp_ma =
|
||||
stats_update_running_avg(cc_stats_vegas_bdp_ma,
|
||||
vegas_bdp(cc));
|
||||
|
||||
/* Log if we're above the ss_cap */
|
||||
if (cc->cwnd >= cc->vegas_params.ss_cwnd_max) {
|
||||
log_info(LD_CIRC,
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "core/or/circuit_st.h"
|
||||
|
||||
extern double cc_stats_vegas_exit_ss_cwnd_ma;
|
||||
extern double cc_stats_vegas_exit_ss_bdp_ma;
|
||||
extern double cc_stats_vegas_exit_ss_inc_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;
|
||||
@@ -20,6 +22,17 @@ 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;
|
||||
|
||||
extern double cc_stats_vegas_csig_alpha_ma;
|
||||
extern double cc_stats_vegas_csig_beta_ma;
|
||||
extern double cc_stats_vegas_csig_delta_ma;
|
||||
|
||||
extern double cc_stats_vegas_ss_queue_ma;
|
||||
extern double cc_stats_vegas_queue_ma;
|
||||
extern double cc_stats_vegas_bdp_ma;
|
||||
|
||||
extern uint64_t cc_stats_vegas_below_ss_inc_floor;
|
||||
extern uint64_t cc_stats_vegas_circ_exited_ss;
|
||||
|
||||
/* Processing SENDME cell. */
|
||||
int congestion_control_vegas_process_sendme(struct congestion_control_t *cc,
|
||||
const circuit_t *circ,
|
||||
|
||||
Reference in New Issue
Block a user