[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [onionperf/master] Rename variables for consistency and clarity.
commit 86f746c3c6ee6dc3be342f53fea90e6c02d39991
Author: Philipp Winter <phw@xxxxxxxxx>
Date: Fri Aug 14 10:49:09 2020 -0700
Rename variables for consistency and clarity.
initial_pause -> pause_initial
inter_transfer_pause -> pause_between
Thanks to Rob for the suggestion.
---
onionperf/model.py | 19 ++++++++-----------
onionperf/onionperf | 12 ++++++------
2 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/onionperf/model.py b/onionperf/model.py
index b589249..3bfe35f 100644
--- a/onionperf/model.py
+++ b/onionperf/model.py
@@ -43,14 +43,14 @@ class TGenLoadableModel(TGenModel):
class TGenModelConf(object):
"""Represents a TGen traffic model configuration."""
- def __init__(self, initial_pause=0, num_transfers=1, transfer_size="5 MiB",
- continuous_transfers=False, inter_transfer_pause=5, port=None, servers=[],
+ def __init__(self, pause_initial=0, num_transfers=1, transfer_size="5 MiB",
+ continuous_transfers=False, pause_between=5, port=None, servers=[],
socks_port=None):
- self.initial_pause = initial_pause
+ self.pause_initial = pause_initial
+ self.pause_between = pause_between
self.num_transfers = num_transfers
self.transfer_size = transfer_size
self.continuous_transfers = continuous_transfers
- self.inter_transfer_pause = inter_transfer_pause
self.port = port
self.servers = servers
self.socks_port = socks_port
@@ -98,20 +98,17 @@ class TorperfModel(GeneratableTGenModel):
loglevel="info",
heartbeat="1 minute")
- g.add_node("pause", time="%d seconds" % self.config.initial_pause)
- g.add_edge("start", "pause")
-
- # "One-shot mode," i.e., onionperf will stop after the given number of
- # iterations. The idea is:
- # start -> pause -> stream-1 -> pause-1 -> ... -> stream-n -> pause-n -> end
+ g.add_node("pause_initial",
+ time="%d seconds" % self.config.pause_initial)
g.add_node("stream",
sendsize="0",
recvsize=self.config.transfer_size,
timeout="15 seconds",
stallout="10 seconds")
g.add_node("pause_between",
- time="%d seconds" % self.config.inter_transfer_pause)
+ time="%d seconds" % self.config.pause_between)
+ g.add_edge("start", "pause_initial")
g.add_edge("pause_initial", "stream")
# only add an end node if we need to stop
diff --git a/onionperf/onionperf b/onionperf/onionperf
index d95e691..a49982b 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -190,16 +190,16 @@ def main():
action="store", dest="tgenconnectport",
default=8080)
- measure_parser.add_argument('--tgen-start-pause',
+ measure_parser.add_argument('--tgen-pause-initial',
help="""the number of seconds TGen should wait before walking through its action graph""",
metavar="N", type=int,
- action="store", dest="tgenstartpause",
+ action="store", dest="tgenpauseinitial",
default=5)
- measure_parser.add_argument('--tgen-intertransfer-pause',
+ measure_parser.add_argument('--tgen-pause-between',
help="""the number of seconds TGen should wait in between two transfers""",
metavar="N", type=int,
- action="store", dest="tgenintertransferpause",
+ action="store", dest="tgenpausebetween",
default=300)
measure_parser.add_argument('--tgen-transfer-size',
@@ -377,11 +377,11 @@ def measure(args):
tor_ctl_port=server_tor_ctl_port,
tor_socks_port=server_tor_socks_port)
- tgen_model = TGenModelConf(initial_pause=args.tgenstartpause,
+ tgen_model = TGenModelConf(pause_initial=args.tgenpauseinitial,
transfer_size=args.tgentransfersize,
num_transfers=args.tgennumtransfers,
continuous_transfers=args.tgennumtransfers == 0,
- inter_transfer_pause=args.tgenintertransferpause)
+ pause_between=args.tgenpausebetween)
meas = Measurement(args.torpath,
args.tgenpath,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits