mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
metrics: Add running average of CC cwnd when exiting slow start
Part of #40708 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "core/or/channel.h"
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/control/control_events.h"
|
||||
#include "lib/math/stats.h"
|
||||
|
||||
#define OUTBUF_CELLS (2*TLS_RECORD_MAX_CELLS)
|
||||
|
||||
@@ -49,6 +50,11 @@
|
||||
#define VEGAS_DELTA_ONION_DFLT (9*OUTBUF_CELLS)
|
||||
#define VEGAS_SSCAP_ONION_DFLT (600)
|
||||
|
||||
/** Moving average of the cc->cwnd from each circuit exiting slowstart. */
|
||||
double cc_stats_vegas_exit_ss_cwnd_ma = 0;
|
||||
/* Running count of this moving average. Needed so we can update it. */
|
||||
static double stats_cwnd_exit_ss_ma_count = 0;
|
||||
|
||||
/**
|
||||
* The original TCP Vegas congestion window BDP estimator.
|
||||
*/
|
||||
@@ -243,6 +249,11 @@ 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. */
|
||||
stats_cwnd_exit_ss_ma_count++;
|
||||
STATS_UPDATE_AVG(cc_stats_vegas_exit_ss_cwnd_ma,
|
||||
cc->cwnd, stats_cwnd_exit_ss_ma_count);
|
||||
|
||||
/* We need to report that slow start has exited ASAP,
|
||||
* for sbws bandwidth measurement. */
|
||||
if (CIRCUIT_IS_ORIGIN(circ)) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "core/or/crypt_path_st.h"
|
||||
#include "core/or/circuit_st.h"
|
||||
|
||||
extern double cc_stats_vegas_exit_ss_cwnd_ma;
|
||||
|
||||
/* Processing SENDME cell. */
|
||||
int congestion_control_vegas_process_sendme(struct congestion_control_t *cc,
|
||||
const circuit_t *circ,
|
||||
|
||||
@@ -14,16 +14,18 @@
|
||||
#include "core/mainloop/connection.h"
|
||||
#include "core/mainloop/mainloop.h"
|
||||
#include "core/or/congestion_control_common.h"
|
||||
#include "core/or/congestion_control_vegas.h"
|
||||
#include "core/or/circuitlist.h"
|
||||
#include "core/or/dos.h"
|
||||
#include "core/or/relay.h"
|
||||
|
||||
#include "app/config/config.h"
|
||||
|
||||
#include "lib/malloc/malloc.h"
|
||||
#include "lib/container/smartlist.h"
|
||||
#include "lib/metrics/metrics_store.h"
|
||||
#include "lib/log/util_bug.h"
|
||||
#include "lib/malloc/malloc.h"
|
||||
#include "lib/math/fp.h"
|
||||
#include "lib/metrics/metrics_store.h"
|
||||
|
||||
#include "feature/hs/hs_dos.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
@@ -370,6 +372,16 @@ fill_cc_values(void)
|
||||
metrics_store_entry_add_label(sentry,
|
||||
metrics_format_label("action", "rtt_reset"));
|
||||
metrics_store_entry_update(sentry, congestion_control_get_num_rtt_reset());
|
||||
|
||||
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", "cwnd"));
|
||||
metrics_store_entry_update(sentry,
|
||||
tor_llround(cc_stats_vegas_exit_ss_cwnd_ma));
|
||||
}
|
||||
|
||||
/** Helper: Fill in single stream metrics output. */
|
||||
|
||||
@@ -20,4 +20,5 @@ src_lib_libtor_math_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
|
||||
noinst_HEADERS += \
|
||||
src/lib/math/fp.h \
|
||||
src/lib/math/laplace.h \
|
||||
src/lib/math/prob_distr.h
|
||||
src/lib/math/prob_distr.h \
|
||||
src/lib/math/stats.h
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Copyright (c) 2022, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* \file stats.h
|
||||
*
|
||||
* \brief Header for stats.c
|
||||
**/
|
||||
|
||||
#ifndef TOR_STATS_H
|
||||
#define TOR_STATS_H
|
||||
|
||||
/** Update an average making it a "running average". The "avg" is the current
|
||||
* value that will be updated to the new one. The "value" is the new value to
|
||||
* add to the average and "n" is the new count as in including the "value". */
|
||||
#define STATS_UPDATE_AVG(avg, value, n) \
|
||||
avg = ((avg) * ((n) - 1) + (value)) / (n)
|
||||
|
||||
#endif /* !defined(TOR_STATS_H) */
|
||||
Reference in New Issue
Block a user