summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2022-11-03 20:08:01 +0000
committerDavid Goulet <dgoulet@torproject.org>2022-11-07 09:55:06 -0500
commit2f7e05d89d710f09bff9377edfb6d30e78163084 (patch)
treefcf05a24986799f073641eaf96101bce7c457ab4
parent83fdaff7c0920c8943b483e4146d2762b8e6ca94 (diff)
downloadtor-2f7e05d89d710f09bff9377edfb6d30e78163084.tar.gz
tor-2f7e05d89d710f09bff9377edfb6d30e78163084.zip
metrics: Add stats when the clock stalls.
Part of #40708.
-rw-r--r--src/core/or/congestion_control_common.c11
-rw-r--r--src/core/or/congestion_control_common.h1
-rw-r--r--src/feature/relay/relay_metrics.c9
3 files changed, 21 insertions, 0 deletions
diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c
index 09d1d501da..c27eb2fca8 100644
--- a/src/core/or/congestion_control_common.c
+++ b/src/core/or/congestion_control_common.c
@@ -94,6 +94,9 @@ void congestion_control_set_cc_enabled(void);
/* Number of times the RTT value was reset. For MetricsPort. */
static uint64_t num_rtt_reset;
+/* Number of times the clock was stalled. For MetricsPort. */
+static uint64_t num_clock_stalls;
+
/* Consensus parameters cached. The non static ones are extern. */
static uint32_t cwnd_max = CWND_MAX_DFLT;
int32_t cell_queue_high = CELL_QUEUE_HIGH_DFLT;
@@ -136,6 +139,13 @@ congestion_control_get_num_rtt_reset(void)
return num_rtt_reset;
}
+/** Return the number of clock stalls that have been done. */
+uint64_t
+congestion_control_get_num_clock_stalls(void)
+{
+ return num_clock_stalls;
+}
+
/**
* Update global congestion control related consensus parameter values,
* every consensus update.
@@ -872,6 +882,7 @@ congestion_control_update_circuit_rtt(congestion_control_t *cc,
/* Do not update RTT at all if it looks fishy */
if (time_delta_stalled_or_jumped(cc, cc->ewma_rtt_usec, rtt)) {
+ num_clock_stalls++; /* Accounting */
return 0;
}
diff --git a/src/core/or/congestion_control_common.h b/src/core/or/congestion_control_common.h
index e62775ecce..a2740fb0b6 100644
--- a/src/core/or/congestion_control_common.h
+++ b/src/core/or/congestion_control_common.h
@@ -83,6 +83,7 @@ bool congestion_control_validate_sendme_increment(uint8_t sendme_inc);
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);
/* Ugh, C.. these are private. Use the getter instead, when
* external to the congestion control code. */
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index 9ceb61836e..af59eb3dcc 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -376,6 +376,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", "clock_stalls"));
+ metrics_store_entry_add_label(sentry,
+ metrics_format_label("action", "rtt_skipped"));
+ metrics_store_entry_update(sentry,
+ congestion_control_get_num_clock_stalls());
+
+ 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"));