bbperf 0.0.26__tar.gz → 0.0.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {bbperf-0.0.26 → bbperf-0.0.28}/PKG-INFO +8 -4
  2. {bbperf-0.0.26 → bbperf-0.0.28}/README.md +7 -3
  3. {bbperf-0.0.26 → bbperf-0.0.28}/pyproject.toml +1 -1
  4. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/bbperf.py +11 -1
  5. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/client.py +18 -5
  6. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/const.py +1 -1
  7. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/graph.py +10 -2
  8. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/server.py +1 -1
  9. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/tcp-graph.gp +1 -1
  10. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/tcp_helper.py +4 -8
  11. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/udp-graph.gp +1 -1
  12. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/util.py +6 -0
  13. {bbperf-0.0.26 → bbperf-0.0.28}/.gitignore +0 -0
  14. {bbperf-0.0.26 → bbperf-0.0.28}/DEPLOY.txt +0 -0
  15. {bbperf-0.0.26 → bbperf-0.0.28}/LICENSE +0 -0
  16. {bbperf-0.0.26 → bbperf-0.0.28}/bbperf.service +0 -0
  17. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/.gitignore +0 -0
  18. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/__init__.py +0 -0
  19. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/control_receiver_thread.py +0 -0
  20. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/data_receiver_thread.py +0 -0
  21. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/data_sample_evaluator_class.py +0 -0
  22. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/data_sender_thread.py +0 -0
  23. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/exceptions.py +0 -0
  24. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/json_output_class.py +0 -0
  25. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/output.py +0 -0
  26. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/run_mode_manager_class.py +0 -0
  27. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/tcp_control_connection_class.py +0 -0
  28. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/udp_helper.py +0 -0
  29. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/udp_rate_manager_class.py +0 -0
  30. {bbperf-0.0.26 → bbperf-0.0.28}/src/bbperf/udp_string_sender_thread.py +0 -0
  31. {bbperf-0.0.26 → bbperf-0.0.28}/tests/run_test.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbperf
3
- Version: 0.0.26
3
+ Version: 0.0.28
4
4
  Summary: An end-to-end performance and bufferbloat measurement tool
5
5
  Project-URL: Homepage, https://github.com/cloudflare/bbperf
6
6
  Project-URL: Issues, https://github.com/cloudflare/bbperf/issues
@@ -80,8 +80,8 @@ Should `bbperf` not detect any valid data samples for 60 seconds after calibrati
80
80
 
81
81
  ```
82
82
  $ bbperf.py --help
83
- usage: bbperf.py [-h] [-s] [-c SERVER_ADDR] [-p SERVER_PORT] [-u] [-R] [--max-ramp-time SECONDS] [-t SECONDS] [-v] [-q]
84
- [-J JSON_FILE] [-g] [-k] [-B BIND_ADDR] [--local-data-port LOCAL_DATA_PORT]
83
+ usage: bbperf.py [-h] [-s] [-c SERVER_ADDR] [-p SERVER_PORT] [-u] [-R] [--max-ramp-time SECONDS] [-t SECONDS] [-v] [-q] [-J JSON_FILE] [-g]
84
+ [--graph-file GRAPH_FILE] [-k] [-B BIND_ADDR] [--local-data-port LOCAL_DATA_PORT] [-C CC_ALGORITHM]
85
85
 
86
86
  bbperf: end to end performance and bufferbloat measurement tool
87
87
 
@@ -102,12 +102,16 @@ options:
102
102
  -q, --quiet decrease output verbosity (can be repeated)
103
103
  -J JSON_FILE, --json-file JSON_FILE
104
104
  JSON output file
105
- -g, --graph generate graph (requires gnuplot)
105
+ -g, --graph generate graph and save in tmp file (requires gnuplot)
106
+ --graph-file GRAPH_FILE
107
+ generate graph and save in the specified file (requires gnuplot)
106
108
  -k, --keep keep data file
107
109
  -B BIND_ADDR, --bind BIND_ADDR
108
110
  bind server sockets to address
109
111
  --local-data-port LOCAL_DATA_PORT
110
112
  local port for data connection (default: ephemeral)
113
+ -C CC_ALGORITHM, --congestion CC_ALGORITHM
114
+ congestion control algorithm (default: cubic)
111
115
  ```
112
116
 
113
117
  Output from `bbperf` includes the following information:
@@ -62,8 +62,8 @@ Should `bbperf` not detect any valid data samples for 60 seconds after calibrati
62
62
 
63
63
  ```
64
64
  $ bbperf.py --help
65
- usage: bbperf.py [-h] [-s] [-c SERVER_ADDR] [-p SERVER_PORT] [-u] [-R] [--max-ramp-time SECONDS] [-t SECONDS] [-v] [-q]
66
- [-J JSON_FILE] [-g] [-k] [-B BIND_ADDR] [--local-data-port LOCAL_DATA_PORT]
65
+ usage: bbperf.py [-h] [-s] [-c SERVER_ADDR] [-p SERVER_PORT] [-u] [-R] [--max-ramp-time SECONDS] [-t SECONDS] [-v] [-q] [-J JSON_FILE] [-g]
66
+ [--graph-file GRAPH_FILE] [-k] [-B BIND_ADDR] [--local-data-port LOCAL_DATA_PORT] [-C CC_ALGORITHM]
67
67
 
68
68
  bbperf: end to end performance and bufferbloat measurement tool
69
69
 
@@ -84,12 +84,16 @@ options:
84
84
  -q, --quiet decrease output verbosity (can be repeated)
85
85
  -J JSON_FILE, --json-file JSON_FILE
86
86
  JSON output file
87
- -g, --graph generate graph (requires gnuplot)
87
+ -g, --graph generate graph and save in tmp file (requires gnuplot)
88
+ --graph-file GRAPH_FILE
89
+ generate graph and save in the specified file (requires gnuplot)
88
90
  -k, --keep keep data file
89
91
  -B BIND_ADDR, --bind BIND_ADDR
90
92
  bind server sockets to address
91
93
  --local-data-port LOCAL_DATA_PORT
92
94
  local port for data connection (default: ephemeral)
95
+ -C CC_ALGORITHM, --congestion CC_ALGORITHM
96
+ congestion control algorithm (default: cubic)
93
97
  ```
94
98
 
95
99
  Output from `bbperf` includes the following information:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bbperf"
7
- version = "0.0.26"
7
+ version = "0.0.28"
8
8
  authors = [
9
9
  { name="Mike Freemon", email="mfreemon@cloudflare.com" },
10
10
  ]
@@ -72,7 +72,12 @@ def mainline():
72
72
  parser.add_argument("-g", "--graph",
73
73
  action="store_true",
74
74
  default=False,
75
- help="generate graph (requires gnuplot)")
75
+ help="generate graph and save in tmp file (requires gnuplot)")
76
+
77
+ parser.add_argument("--graph-file",
78
+ metavar="GRAPH_FILE",
79
+ default=None,
80
+ help="generate graph and save in the specified file (requires gnuplot)")
76
81
 
77
82
  parser.add_argument("-k", "--keep",
78
83
  action="store_true",
@@ -90,6 +95,11 @@ def mainline():
90
95
  default=0,
91
96
  help="local port for data connection (default: ephemeral)")
92
97
 
98
+ parser.add_argument("-C", "--congestion",
99
+ metavar="CC_ALGORITHM",
100
+ default="cubic",
101
+ help="congestion control algorithm (default: cubic)")
102
+
93
103
  args = parser.parse_args()
94
104
 
95
105
  util.validate_and_finalize_args(args)
@@ -8,8 +8,8 @@ import time
8
8
  import queue
9
9
  import socket
10
10
  import uuid
11
- import json
12
11
  import ipaddress
12
+ import shutil
13
13
 
14
14
  from . import data_sender_thread
15
15
  from . import udp_string_sender_thread
@@ -127,7 +127,7 @@ def client_mainline(args):
127
127
  # bind client data connection to specific local port
128
128
  if args.local_data_port > 0:
129
129
  data_sock.bind(('0.0.0.0', args.local_data_port))
130
- tcp_helper.set_congestion_control(data_sock)
130
+ tcp_helper.set_congestion_control(args, data_sock)
131
131
  tcp_helper.set_tcp_notsent_lowat(data_sock)
132
132
  data_sock.connect(server_addr)
133
133
  data_sock.settimeout(const.SOCKET_TIMEOUT_SEC)
@@ -261,9 +261,22 @@ def client_mainline(args):
261
261
  graphdatafilename = output.get_graph_data_file_name()
262
262
  rawdatafilename = output.get_raw_data_file_name()
263
263
 
264
- if args.graph and not args.quiet:
265
- graph.create_graph(args, graphdatafilename)
266
- print("created graph: {}".format(graphdatafilename + ".png"), flush=True)
264
+ if (args.graph or args.graph_file) and not args.quiet:
265
+ pngfilename = graphdatafilename + ".png"
266
+
267
+ graph.create_graph(args, graphdatafilename, pngfilename)
268
+
269
+ if args.graph_file:
270
+ try:
271
+ # move the pngfile to the user specified destination
272
+ shutil.move(pngfilename, args.graph_file)
273
+ print("created graph: {}".format(args.graph_file), flush=True)
274
+
275
+ except Exception as e:
276
+ print("ERROR: during move of graph png file: {}".format(e), flush=True)
277
+
278
+ else:
279
+ print("created graph: {}".format(pngfilename), flush=True)
267
280
 
268
281
  if args.keep and not args.quiet:
269
282
  print("keeping graph data file: {}".format(graphdatafilename), flush=True)
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2024 Cloudflare, Inc.
2
2
  # Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
3
3
 
4
- BBPERF_VERSION = "0.0.26"
4
+ BBPERF_VERSION = "0.0.28"
5
5
 
6
6
  SERVER_PORT = 5301
7
7
 
@@ -6,16 +6,24 @@ import argparse
6
6
  import subprocess
7
7
 
8
8
 
9
- def create_graph(args, datafile1):
9
+ def create_graph(args, datafile1, pngfilename):
10
+
11
+ if args.graph_file:
12
+ filename_in_title = args.graph_file
13
+ else:
14
+ filename_in_title = pngfilename
10
15
 
11
16
  this_script_dir = os.path.dirname(os.path.abspath(__file__))
12
17
 
13
18
  if args.udp:
14
19
  gp_file = this_script_dir + "/udp-graph.gp"
20
+ graph_title = "bbperf UDP {}".format(filename_in_title)
15
21
  else:
16
22
  gp_file = this_script_dir + "/tcp-graph.gp"
23
+ graph_title = "bbperf TCP {}".format(filename_in_title)
17
24
 
18
- gnuplot_script = "datafile1 = \"" + datafile1 + "\" ; load \"" + gp_file + "\""
25
+ gnuplot_script = "datafile1 = \"{}\" ; graphtitle = \"{}\" ; load \"{}\"".format(
26
+ datafile1, graph_title, gp_file)
19
27
 
20
28
  result = subprocess.run(["gnuplot", "-e", gnuplot_script], capture_output=True)
21
29
 
@@ -115,7 +115,7 @@ def server_mainline(args):
115
115
 
116
116
  data_sock, _ = listen_sock.accept()
117
117
  data_sock.settimeout(const.SOCKET_TIMEOUT_SEC)
118
- tcp_helper.set_congestion_control(data_sock)
118
+ tcp_helper.set_congestion_control(client_args, data_sock)
119
119
  tcp_helper.set_tcp_notsent_lowat(data_sock)
120
120
  client_data_addr = data_sock.getpeername()
121
121
  if client_args.verbosity:
@@ -23,7 +23,7 @@ set output pngfile1
23
23
  # name - prefix
24
24
  stats datafile1 using 1 nooutput name "XRANGE"
25
25
 
26
- set multiplot title "bbperf TCP ".datafile1 layout 3,1
26
+ set multiplot title graphtitle layout 3,1
27
27
 
28
28
  set lmargin 12
29
29
 
@@ -39,19 +39,15 @@ def get_congestion_control(data_sock):
39
39
  return cc_algo_str
40
40
 
41
41
 
42
- # TODO will be turning this into a command line option
43
- CC_ALGO="cubic"
44
-
45
-
46
- def set_congestion_control(data_sock):
47
- if get_congestion_control(data_sock) == CC_ALGO:
42
+ def set_congestion_control(client_args, data_sock):
43
+ if get_congestion_control(data_sock) == client_args.congestion:
48
44
  # already set, nothing to do here
49
45
  return
50
46
 
51
- data_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_CONGESTION, CC_ALGO.encode())
47
+ data_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_CONGESTION, client_args.congestion.encode())
52
48
 
53
49
  cc_algo_str = get_congestion_control(data_sock)
54
- if cc_algo_str != CC_ALGO:
50
+ if cc_algo_str != client_args.congestion:
55
51
  raise Exception("ERROR: unexpected congestion control in effect: {}".format(cc_algo_str))
56
52
 
57
53
 
@@ -23,7 +23,7 @@ set output pngfile1
23
23
  # name - prefix
24
24
  stats datafile1 using 1 nooutput name "XRANGE"
25
25
 
26
- set multiplot title "bbperf UDP ".datafile1 layout 5,1
26
+ set multiplot title graphtitle layout 5,1
27
27
 
28
28
  set lmargin 12
29
29
 
@@ -20,6 +20,12 @@ def validate_and_finalize_args(args):
20
20
  if args.verbosity and args.quiet:
21
21
  raise Exception("ERROR: cannot specify both verbosity and quiet")
22
22
 
23
+ if args.congestion not in [ "cubic", "bbr"]:
24
+ raise Exception("ERROR: congestion control algorithm must be either cubic or bbr, but found {}".format(args.congestion))
25
+
26
+ if args.graph_file and (not args.graph_file.endswith(".png")):
27
+ raise Exception("ERROR: argument --graph-file must end with \".png\"")
28
+
23
29
  # set max_run_time_failsafe_sec
24
30
  # never run longer than this under any circumstances
25
31
  max_run_time_failsafe_sec = const.MAX_DURATION_CALIBRATION_TIME_SEC
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes