Count slow start separately.
Part of #40708
Signed-off-by: David Goulet <dgoulet@torproject.org>
/** Moving average of the cc->cwnd from each closed circuit. */
double cc_stats_circ_close_cwnd_ma = 0;
-/* Running count of this moving average. Needed so we can update it. */
+/** Moving average of the cc->cwnd from each closed slow-start circuit. */
+double cc_stats_circ_close_ss_cwnd_ma = 0;
+
+/* Running count of the above moving averages. Needed so we can update it. */
static double stats_circ_close_cwnd_ma_count = 0;
+static double stats_circ_close_ss_cwnd_ma_count = 0;
/********* END VARIABLES ************/
/* Update stats. */
if (circ->ccontrol) {
- stats_circ_close_cwnd_ma_count++;
- STATS_UPDATE_AVG(cc_stats_circ_close_cwnd_ma,
- circ->ccontrol->cwnd, stats_circ_close_cwnd_ma_count);
+ if (circ->ccontrol->in_slow_start) {
+ /* If we are in slow start, only count the ss cwnd if we've sent
+ * enough data to get RTT measurements such that we have a min
+ * and a max RTT, and they are not the same. This prevents us from
+ * averaging and reporting unused and low-use circuits here */
+ if (circ->ccontrol->max_rtt_usec != circ->ccontrol->min_rtt_usec) {
+ stats_circ_close_ss_cwnd_ma_count++;
+ STATS_UPDATE_AVG(cc_stats_circ_close_ss_cwnd_ma,
+ circ->ccontrol->cwnd, stats_circ_close_ss_cwnd_ma_count);
+ }
+ } else {
+ stats_circ_close_cwnd_ma_count++;
+ STATS_UPDATE_AVG(cc_stats_circ_close_cwnd_ma,
+ circ->ccontrol->cwnd, stats_circ_close_cwnd_ma_count);
+ }
}
if (circuits_pending_close == NULL)
/** Stats. */
extern double cc_stats_circ_close_cwnd_ma;
+extern double cc_stats_circ_close_ss_cwnd_ma;
/** Convert a circuit_t* to a pointer to the enclosing or_circuit_t. Assert
* if the cast is impossible. */
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,
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_store_entry_update(sentry,
tor_llround(cc_stats_circ_close_cwnd_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", "ss_cwnd"));
+ metrics_store_entry_update(sentry,
+ tor_llround(cc_stats_circ_close_ss_cwnd_ma));
+
sentry = metrics_store_add(the_store, rentry->type, rentry->name,
rentry->help);
metrics_store_entry_add_label(sentry,