[tor-commits] [tor] 01/05: metrics: Record percentage of blocked channels

gitolite role git at cupani.torproject.org
Wed Nov 9 16:54:39 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 59bef48490e4191be978aa023f05242f889be720
Author: Mike Perry <mikeperry-git at torproject.org>
AuthorDate: Tue Nov 8 18:25:07 2022 +0000

    metrics: Record percentage of blocked channels
    
    Part of #40708.
---
 src/core/or/congestion_control_vegas.c | 28 ++++++++++++++++++++++++++++
 src/core/or/congestion_control_vegas.h |  2 ++
 src/feature/relay/relay_metrics.c      | 18 ++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c
index 8351aa6e27..ee1312699c 100644
--- a/src/core/or/congestion_control_vegas.c
+++ b/src/core/or/congestion_control_vegas.c
@@ -54,10 +54,14 @@
 double cc_stats_vegas_exit_ss_cwnd_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;
 /* Running count of this moving average. Needed so we can update it. */
 static double stats_cwnd_exit_ss_ma_count = 0;
 static double stats_cwnd_gamma_drop_ma_count = 0;
 static double stats_cwnd_delta_drop_ma_count = 0;
+static double stats_ss_csig_blocked_ma_count = 0;
+static double stats_csig_blocked_ma_count = 0;
 
 /** Stats on how many times we reached "delta" param. */
 uint64_t cc_stats_vegas_above_delta = 0;
@@ -348,6 +352,18 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
         stats_update_running_avg(cc_stats_vegas_gamma_drop_ma,
                              cwnd_diff, stats_cwnd_gamma_drop_ma_count);
 
+      stats_ss_csig_blocked_ma_count++;
+      /* 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, stats_ss_csig_blocked_ma_count);
+      } else {
+        cc_stats_vegas_ss_csig_blocked_ma =
+          stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma,
+                                   0, stats_ss_csig_blocked_ma_count);
+      }
+
       congestion_control_vegas_exit_slow_start(circ, cc);
     }
 
@@ -375,6 +391,18 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
 
       cc_stats_vegas_above_delta++;
     } else if (queue_use > cc->vegas_params.beta || cc->blocked_chan) {
+      stats_csig_blocked_ma_count++;
+      /* Compute the percentage we experience a blocked csig vs RTT sig */
+      if (cc->blocked_chan) {
+        cc_stats_vegas_csig_blocked_ma =
+          stats_update_running_avg(cc_stats_vegas_csig_blocked_ma,
+                                   100, stats_csig_blocked_ma_count);
+      } else {
+        cc_stats_vegas_csig_blocked_ma =
+          stats_update_running_avg(cc_stats_vegas_csig_blocked_ma,
+                                   0, stats_csig_blocked_ma_count);
+      }
+
       cc->cwnd -= CWND_INC(cc);
     } else if (queue_use < cc->vegas_params.alpha) {
       cc->cwnd += CWND_INC(cc);
diff --git a/src/core/or/congestion_control_vegas.h b/src/core/or/congestion_control_vegas.h
index 6048b1e26d..722ffde01a 100644
--- a/src/core/or/congestion_control_vegas.h
+++ b/src/core/or/congestion_control_vegas.h
@@ -15,6 +15,8 @@
 extern double cc_stats_vegas_exit_ss_cwnd_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;
+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;
 
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index cd80c5e95e..ca8fbe706d 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -401,6 +401,15 @@ fill_cc_values(void)
   metrics_store_entry_update(sentry,
                              tor_llround(cc_stats_vegas_gamma_drop_ma));
 
+  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", "chan_blocked_pct"));
+  metrics_store_entry_update(sentry,
+                             tor_llround(cc_stats_vegas_ss_csig_blocked_ma));
+
   sentry = metrics_store_add(the_store, rentry->type, rentry->name,
                              rentry->help);
   metrics_store_entry_add_label(sentry,
@@ -479,6 +488,15 @@ fill_cc_values(void)
           metrics_format_label("action", "delta_drop"));
   metrics_store_entry_update(sentry,
                              tor_llround(cc_stats_vegas_delta_drop_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", "chan_blocked_pct"));
+  metrics_store_entry_update(sentry,
+                             tor_llround(cc_stats_vegas_csig_blocked_ma));
 }
 
 /** 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