[tor-commits] [tor] 04/15: metrics: Add stats when reaching vegas delta or ss_cwnd_max

gitolite role git at cupani.torproject.org
Tue Nov 8 17:49:40 UTC 2022


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 62ce557b0baaa463c523c71eb640cc4f4cff590f
Author: David Goulet <dgoulet at torproject.org>
AuthorDate: Thu Nov 3 13:12:47 2022 -0400

    metrics: Add stats when reaching vegas delta or ss_cwnd_max
    
    Part of #40708
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/core/or/congestion_control_vegas.c |  7 +++++++
 src/core/or/congestion_control_vegas.h |  2 ++
 src/feature/relay/relay_metrics.c      | 16 ++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c
index de89f294aa..0aecf592aa 100644
--- a/src/core/or/congestion_control_vegas.c
+++ b/src/core/or/congestion_control_vegas.c
@@ -55,6 +55,11 @@ 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;
 
+/** 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;
+
 /**
  * The original TCP Vegas congestion window BDP estimator.
  */
@@ -333,11 +338,13 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
     if (cc->cwnd >= cc->vegas_params.ss_cwnd_max) {
       cc->cwnd = cc->vegas_params.ss_cwnd_max;
       congestion_control_vegas_exit_slow_start(circ, cc);
+      cc_stats_vegas_above_ss_cwnd_max++;
     }
   /* After slow start, We only update once per window */
   } else if (cc->next_cc_event == 0) {
     if (queue_use > cc->vegas_params.delta) {
       cc->cwnd = vegas_bdp(cc) + cc->vegas_params.delta - CWND_INC(cc);
+      cc_stats_vegas_above_delta++;
     } else if (queue_use > cc->vegas_params.beta || cc->blocked_chan) {
       cc->cwnd -= CWND_INC(cc);
     } else if (queue_use < cc->vegas_params.alpha) {
diff --git a/src/core/or/congestion_control_vegas.h b/src/core/or/congestion_control_vegas.h
index 71f0ea571d..5aced07a8f 100644
--- a/src/core/or/congestion_control_vegas.h
+++ b/src/core/or/congestion_control_vegas.h
@@ -13,6 +13,8 @@
 #include "core/or/circuit_st.h"
 
 extern double cc_stats_vegas_exit_ss_cwnd_ma;
+extern uint64_t cc_stats_vegas_above_delta;
+extern uint64_t cc_stats_vegas_above_ss_cwnd_max;
 
 /* Processing SENDME cell. */
 int congestion_control_vegas_process_sendme(struct congestion_control_t *cc,
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index c034ca02bd..b95ca4ba06 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -392,6 +392,22 @@ fill_cc_values(void)
           metrics_format_label("action", "cwnd"));
   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", "process_sendme"));
+  metrics_store_entry_add_label(sentry,
+          metrics_format_label("action", "above_delta"));
+  metrics_store_entry_update(sentry, cc_stats_vegas_above_delta);
+
+  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", "above_ss_cwnd_max"));
+  metrics_store_entry_update(sentry, cc_stats_vegas_above_ss_cwnd_max);
 }
 
 /** Helper: Fill in single stream metrics output. */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list