[tor-commits] [onionperf/master] Make some tweaks to new TGen model.

karsten at torproject.org karsten at torproject.org
Tue Sep 1 20:40:04 UTC 2020


commit b8f1e5c2695c097a7494f7975403664c0c833825
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Aug 16 22:03:34 2020 +0200

    Make some tweaks to new TGen model.
    
     - Change timeout back to 270 seconds and stallout back to 0 seconds.
     - Change initial pause to 300 seconds to keep default behavior
       unchanged.
     - Change model, so that pause_between starts in parallel to a stream,
       not when the stream is completed. This is the same behavior as
       before.
    
    Also add a change log entry for all changes.
---
 CHANGELOG.md        |  7 +++++++
 onionperf/model.py  | 20 ++++++++------------
 onionperf/onionperf |  2 +-
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c4c4f2..ac6897b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# Changes in version 0.7 - 2020-??-??
+
+ - Remove the `onionperf measure --oneshot` switch and replace it with
+   new switches `--tgen-pause-initial`, `--tgen-pause-between`,
+   `--tgen-transfer-size`, and `--tgen-num-transfers ` to further
+   configure the generated TGen model.
+
 # Changes in version 0.6 - 2020-??-??
 
  - Update to TGen 1.0.0, use TGenTools for parsing TGen log files, and
diff --git a/onionperf/model.py b/onionperf/model.py
index d45763e..fde587f 100644
--- a/onionperf/model.py
+++ b/onionperf/model.py
@@ -43,8 +43,8 @@ class TGenLoadableModel(TGenModel):
 
 class TGenModelConf(object):
     """Represents a TGen traffic model configuration."""
-    def __init__(self, pause_initial=0, num_transfers=1, transfer_size="5 MiB",
-                 continuous_transfers=False, pause_between=5, port=None, servers=[],
+    def __init__(self, pause_initial=300, num_transfers=1, transfer_size="5 MiB",
+                 continuous_transfers=False, pause_between=300, port=None, servers=[],
                  socks_port=None):
         self.pause_initial = pause_initial
         self.pause_between = pause_between
@@ -103,28 +103,24 @@ class TorperfModel(GeneratableTGenModel):
         g.add_node("stream",
                    sendsize="0",
                    recvsize=self.config.transfer_size,
-                   timeout="15 seconds",
-                   stallout="10 seconds")
+                   timeout="270 seconds",
+                   stallout="0 seconds")
         g.add_node("pause_between",
                    time="%d seconds" % self.config.pause_between)
 
         g.add_edge("start", "pause_initial")
         g.add_edge("pause_initial", "stream")
+        g.add_edge("pause_initial", "pause_between")
+        g.add_edge("pause_between", "stream")
+        g.add_edge("pause_between", "pause_between")
 
         # only add an end node if we need to stop
-        if self.config.continuous_transfers:
-            # continuous mode, i.e., no end node
-            g.add_edge("stream", "pause_between")
-        else:
+        if not self.config.continuous_transfers:
             # one-shot mode, i.e., end after configured number of transfers
             g.add_node("end",
                        count="%d" % self.config.num_transfers)
             # check for end condition after every transfer
             g.add_edge("stream", "end")
-            # if end condition not met, pause
-            g.add_edge("end", "pause_between")
-
-        g.add_edge("pause_between", "stream")
 
         return g
 
diff --git a/onionperf/onionperf b/onionperf/onionperf
index a49982b..6a16da2 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -194,7 +194,7 @@ def main():
         help="""the number of seconds TGen should wait before walking through its action graph""",
         metavar="N", type=int,
         action="store", dest="tgenpauseinitial",
-        default=5)
+        default=300)
 
     measure_parser.add_argument('--tgen-pause-between',
         help="""the number of seconds TGen should wait in between two transfers""",





More information about the tor-commits mailing list