bbperf 0.0.3__tar.gz → 0.0.4__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 (29) hide show
  1. {bbperf-0.0.3 → bbperf-0.0.4}/DEPLOY.txt +3 -0
  2. {bbperf-0.0.3 → bbperf-0.0.4}/PKG-INFO +14 -11
  3. {bbperf-0.0.3 → bbperf-0.0.4}/README.md +13 -10
  4. {bbperf-0.0.3 → bbperf-0.0.4}/pyproject.toml +1 -1
  5. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/bbperf.py +6 -5
  6. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/client.py +2 -2
  7. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/control_receiver_thread.py +2 -2
  8. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/data_receiver_thread.py +3 -2
  9. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/data_sender_thread.py +11 -18
  10. bbperf-0.0.4/src/bbperf/json_output_class.py +98 -0
  11. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/output.py +15 -23
  12. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/tcp_control_connection_class.py +2 -2
  13. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/udp_rate_manager_class.py +1 -1
  14. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/util.py +5 -53
  15. bbperf-0.0.4/tests/run_test.sh +25 -0
  16. bbperf-0.0.3/src/bbperf/json_output_class.py +0 -69
  17. bbperf-0.0.3/tests/run_test.sh +0 -52
  18. {bbperf-0.0.3 → bbperf-0.0.4}/.gitignore +0 -0
  19. {bbperf-0.0.3 → bbperf-0.0.4}/LICENSE +0 -0
  20. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/.gitignore +0 -0
  21. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/__init__.py +0 -0
  22. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/calibration.py +0 -0
  23. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/const.py +0 -0
  24. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/data_udp_ping_sender_thread.py +0 -0
  25. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/exceptions.py +0 -0
  26. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/graph.py +0 -0
  27. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/server.py +0 -0
  28. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/tcp-graph.gp +0 -0
  29. {bbperf-0.0.3 → bbperf-0.0.4}/src/bbperf/udp-graph.gp +0 -0
@@ -12,9 +12,12 @@ Create tar.gz and whl files in dist directory:
12
12
  cd /path/to/bbperf/git/repo/dir <-- the directory with the pyproject.toml file
13
13
 
14
14
  vim pyproject.toml <-- increment the version number
15
+ git add pyproject.toml
16
+ git commit -m 'version 0.0.2'
15
17
 
16
18
  git tag -a v0.0.2 -m 'version 0.0.2'
17
19
 
20
+ git push origin
18
21
  git push origin --tags
19
22
 
20
23
  python3 -m build
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbperf
3
- Version: 0.0.3
3
+ Version: 0.0.4
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
@@ -26,11 +26,6 @@ Description-Content-Type: text/markdown
26
26
  * Usage of buffers between the endpoints
27
27
  * Bufferbloat (when the usage of buffers is excessive)
28
28
 
29
- For UDP, it also measures:
30
-
31
- * Packet rates
32
- * Packet loss rates
33
-
34
29
  Features that distinguish this tool from existing tools include:
35
30
 
36
31
  * Latency, both unloaded and loaded, is measured by the same flow that is under test.
@@ -43,7 +38,7 @@ Features that distinguish this tool from existing tools include:
43
38
 
44
39
  * Automatic generation of graphs
45
40
 
46
- * The UDP option will automatically adjust the sending rate to just above the goodput rate so that any bufferbloat issues are measured. This feature is enabled by default. Simply omit the `-b/--bandwidth` option when running a `-u/--udp` test.
41
+ * The UDP option will automatically adjust the sending rate to just above the goodput rate so that any bufferbloat issues are measured.
47
42
 
48
43
  ### Usage
49
44
 
@@ -67,13 +62,14 @@ The direction of data flow is from the client to the server. That is reversed w
67
62
 
68
63
  ```
69
64
  $ bbperf.py --help
70
- usage: bbperf.py [-h] [-v] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-R] [-t SECONDS] [-u] [-b BANDWIDTH] [-g] [-k] [-J JSON_FILE]
65
+ usage: bbperf.py [-h] [-v] [-q] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-R] [-t SECONDS] [-u] [-g] [-k] [-J JSON_FILE]
71
66
 
72
67
  bbperf: end to end performance and bufferbloat measurement tool
73
68
 
74
69
  options:
75
70
  -h, --help show this help message and exit
76
- -v, --verbosity increase output verbosity
71
+ -v, --verbosity increase output verbosity (can be repeated)
72
+ -q, --quiet decrease output verbosity (can be repeated)
77
73
  -s, --server run in server mode
78
74
  -c, --client SERVER_IP
79
75
  run in client mode
@@ -82,8 +78,6 @@ options:
82
78
  -R, --reverse data flow in download direction (server to client)
83
79
  -t, --time SECONDS duration of run in seconds
84
80
  -u, --udp run in UDP mode (default: TCP mode)
85
- -b, --bandwidth BANDWIDTH
86
- n[kmgKMG] | n[kmgKMG]pps, optional for both TCP and UDP
87
81
  -g, --graph generate graph (requires gnuplot)
88
82
  -k, --keep keep data file
89
83
  -J, --json-file JSON_FILE
@@ -107,6 +101,15 @@ Output from `bbperf` includes the following information:
107
101
  drop% percentage of packets dropped (UDP only)
108
102
  ```
109
103
 
104
+ Output to standard out is controlled via the `--verbosity` and `--quiet` options as follows:
105
+ ```
106
+ -qq nothing to stdout except errors
107
+ -q run summary in json format
108
+ (neither option) progress update once per second plus run summary in json format (default)
109
+ -v progress update once per 0.1 seconds, additional output, and run summary in json format
110
+ -vv debugging info useful for developers only
111
+ ```
112
+
110
113
  ### Installation
111
114
 
112
115
  `bbperf` is available via PyPI repository (pypi.org) and can be installed using pip.
@@ -8,11 +8,6 @@
8
8
  * Usage of buffers between the endpoints
9
9
  * Bufferbloat (when the usage of buffers is excessive)
10
10
 
11
- For UDP, it also measures:
12
-
13
- * Packet rates
14
- * Packet loss rates
15
-
16
11
  Features that distinguish this tool from existing tools include:
17
12
 
18
13
  * Latency, both unloaded and loaded, is measured by the same flow that is under test.
@@ -25,7 +20,7 @@ Features that distinguish this tool from existing tools include:
25
20
 
26
21
  * Automatic generation of graphs
27
22
 
28
- * The UDP option will automatically adjust the sending rate to just above the goodput rate so that any bufferbloat issues are measured. This feature is enabled by default. Simply omit the `-b/--bandwidth` option when running a `-u/--udp` test.
23
+ * The UDP option will automatically adjust the sending rate to just above the goodput rate so that any bufferbloat issues are measured.
29
24
 
30
25
  ### Usage
31
26
 
@@ -49,13 +44,14 @@ The direction of data flow is from the client to the server. That is reversed w
49
44
 
50
45
  ```
51
46
  $ bbperf.py --help
52
- usage: bbperf.py [-h] [-v] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-R] [-t SECONDS] [-u] [-b BANDWIDTH] [-g] [-k] [-J JSON_FILE]
47
+ usage: bbperf.py [-h] [-v] [-q] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-R] [-t SECONDS] [-u] [-g] [-k] [-J JSON_FILE]
53
48
 
54
49
  bbperf: end to end performance and bufferbloat measurement tool
55
50
 
56
51
  options:
57
52
  -h, --help show this help message and exit
58
- -v, --verbosity increase output verbosity
53
+ -v, --verbosity increase output verbosity (can be repeated)
54
+ -q, --quiet decrease output verbosity (can be repeated)
59
55
  -s, --server run in server mode
60
56
  -c, --client SERVER_IP
61
57
  run in client mode
@@ -64,8 +60,6 @@ options:
64
60
  -R, --reverse data flow in download direction (server to client)
65
61
  -t, --time SECONDS duration of run in seconds
66
62
  -u, --udp run in UDP mode (default: TCP mode)
67
- -b, --bandwidth BANDWIDTH
68
- n[kmgKMG] | n[kmgKMG]pps, optional for both TCP and UDP
69
63
  -g, --graph generate graph (requires gnuplot)
70
64
  -k, --keep keep data file
71
65
  -J, --json-file JSON_FILE
@@ -89,6 +83,15 @@ Output from `bbperf` includes the following information:
89
83
  drop% percentage of packets dropped (UDP only)
90
84
  ```
91
85
 
86
+ Output to standard out is controlled via the `--verbosity` and `--quiet` options as follows:
87
+ ```
88
+ -qq nothing to stdout except errors
89
+ -q run summary in json format
90
+ (neither option) progress update once per second plus run summary in json format (default)
91
+ -v progress update once per 0.1 seconds, additional output, and run summary in json format
92
+ -vv debugging info useful for developers only
93
+ ```
94
+
92
95
  ### Installation
93
96
 
94
97
  `bbperf` is available via PyPI repository (pypi.org) and can be installed using pip.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bbperf"
7
- version = "0.0.3"
7
+ version = "0.0.4"
8
8
  authors = [
9
9
  { name="Mike Freemon", email="mfreemon@cloudflare.com" },
10
10
  ]
@@ -17,7 +17,12 @@ def mainline():
17
17
  parser.add_argument("-v", "--verbosity",
18
18
  action="count",
19
19
  default=0,
20
- help="increase output verbosity")
20
+ help="increase output verbosity (can be repeated)")
21
+
22
+ parser.add_argument("-q", "--quiet",
23
+ action="count",
24
+ default=0,
25
+ help="decrease output verbosity (can be repeated)")
21
26
 
22
27
  parser.add_argument("-s", "--server",
23
28
  action="store_true",
@@ -51,10 +56,6 @@ def mainline():
51
56
  default=False,
52
57
  help="run in UDP mode (default: TCP mode)")
53
58
 
54
- parser.add_argument("-b", "--bandwidth",
55
- default=None,
56
- help="n[kmgKMG] | n[kmgKMG]pps, optional for both TCP and UDP")
57
-
58
59
  parser.add_argument("-g", "--graph",
59
60
  action="store_true",
60
61
  default=False,
@@ -214,11 +214,11 @@ def client_mainline(args):
214
214
  graphdatafilename = output.get_graph_data_file_name()
215
215
  rawdatafilename = output.get_raw_data_file_name()
216
216
 
217
- if args.graph:
217
+ if args.graph and not args.quiet:
218
218
  graph.create_graph(args, graphdatafilename)
219
219
  print("created graph: {}".format(graphdatafilename + ".png"))
220
220
 
221
- if args.keep:
221
+ if args.keep and not args.quiet:
222
222
  print("keeping graph data file: {}".format(graphdatafilename))
223
223
  print("keeping raw data file: {}".format(rawdatafilename))
224
224
  else:
@@ -41,7 +41,7 @@ def run_recv_term_queue(args, stdout_queue, control_conn, results_queue, shared_
41
41
  results_queue.put(new_str)
42
42
 
43
43
  # udp autorate
44
- if args.udp and not args.bandwidth:
44
+ if args.udp:
45
45
  udp_rate_manager.update(new_str)
46
46
 
47
47
  control_conn.close()
@@ -84,7 +84,7 @@ def run_recv_term_send(args, stdout_queue, control_conn, shared_udp_sending_rate
84
84
  control_conn.send(new_str.encode())
85
85
 
86
86
  # udp autorate
87
- if args.udp and not args.bandwidth:
87
+ if args.udp:
88
88
  udp_rate_manager.update(new_str)
89
89
 
90
90
  control_conn.close()
@@ -7,7 +7,7 @@ import socket
7
7
  from . import const
8
8
  from . import util
9
9
 
10
-
10
+ # args are client args
11
11
  def run(args, stdout_queue, control_conn, data_sock, peer_addr):
12
12
 
13
13
  if args.verbosity:
@@ -45,7 +45,8 @@ def run(args, stdout_queue, control_conn, data_sock, peer_addr):
45
45
  if peer_addr_for_udp is None:
46
46
  # first packet is received
47
47
  peer_addr_for_udp = pkt_from_addr
48
- print("peer address: {}".format(peer_addr_for_udp))
48
+ if not args.quiet:
49
+ print("peer address: {}".format(peer_addr_for_udp))
49
50
  else:
50
51
  raise Exception("ERROR: datagram from wrong peer address")
51
52
 
@@ -29,17 +29,10 @@ def run(args, stdout_queue, data_sock, peer_addr, shared_udp_sending_rate_pps):
29
29
  stdout_queue.put("data sender: peer address: {}".format(peer_addr_for_udp))
30
30
  break
31
31
 
32
- # calculate sending rate
33
-
34
- if args.bandwidth or args.udp:
35
- if args.bandwidth:
36
- bandwidth_is_pps, bandwidth_val_int = util.convert_bandwidth_str_to_int(args.bandwidth)
37
- else:
38
- # must be UDP with no bandwidth specified, so use UDP autorate
39
- bandwidth_is_pps = True
40
- bandwidth_val_int = shared_udp_sending_rate_pps.value
41
-
42
- batch_size, delay_between_batches = util.convert_bandwidth_spec_to_batch_info(args, bandwidth_is_pps, bandwidth_val_int)
32
+ # udp autorate
33
+ if args.udp:
34
+ udp_pps = shared_udp_sending_rate_pps.value
35
+ batch_size, delay_between_batches = util.convert_udp_pps_to_batch_info(udp_pps)
43
36
 
44
37
  # start sending
45
38
 
@@ -139,7 +132,7 @@ def run(args, stdout_queue, data_sock, peer_addr, shared_udp_sending_rate_pps):
139
132
  interval_send_count = accum_send_count
140
133
  interval_bytes_sent = accum_bytes_sent
141
134
 
142
- if args.verbosity == 3:
135
+ if args.verbosity > 1:
143
136
  print("data_sender: a {} {} {} {} {} {} b".format(
144
137
  record_type, curr_time_sec, interval_time_sec, interval_send_count, interval_bytes_sent, total_send_counter)
145
138
  )
@@ -149,11 +142,10 @@ def run(args, stdout_queue, data_sock, peer_addr, shared_udp_sending_rate_pps):
149
142
  accum_send_count = 0
150
143
  accum_bytes_sent = 0
151
144
 
152
- # update udp rate when autorate in effect
153
- if args.udp and not args.bandwidth:
154
- bandwidth_is_pps = True
155
- bandwidth_val_int = shared_udp_sending_rate_pps.value
156
- batch_size, delay_between_batches = util.convert_bandwidth_spec_to_batch_info(args, bandwidth_is_pps, bandwidth_val_int)
145
+ # update udp autorate
146
+ if args.udp:
147
+ udp_pps = shared_udp_sending_rate_pps.value
148
+ batch_size, delay_between_batches = util.convert_udp_pps_to_batch_info(udp_pps)
157
149
 
158
150
  # send very slowly at first to establish unloaded latency
159
151
  if not is_calibrated:
@@ -167,7 +159,8 @@ def run(args, stdout_queue, data_sock, peer_addr, shared_udp_sending_rate_pps):
167
159
  if curr_time_sec > end_time:
168
160
  break
169
161
 
170
- if args.bandwidth or args.udp:
162
+ # pause between udp batches if necessary
163
+ if args.udp:
171
164
  current_batch_counter += 1
172
165
  if current_batch_counter >= batch_size:
173
166
  this_delay = delay_between_batches - (curr_time_sec - current_batch_start_time)
@@ -0,0 +1,98 @@
1
+
2
+ import json
3
+ import numpy
4
+
5
+ class JsonOutputClass:
6
+
7
+ def __init__(self, args):
8
+ self.args = args
9
+ self.output_dict = {}
10
+ self.output_dict["entries"] = []
11
+ self.unloaded_rtt_ms = None
12
+
13
+ if self.args.json_file:
14
+ self.json_output_file = open(self.args.json_file, 'w')
15
+
16
+ def set_unloaded_rtt_ms(self, rtt_ms):
17
+ self.unloaded_rtt_ms = rtt_ms
18
+
19
+ def add_entry(self, entry):
20
+ self.output_dict["entries"].append(entry)
21
+
22
+ def create_aggregate_stats(self):
23
+ loaded_rtt_ms_list = []
24
+ receiver_throughput_rate_mbps_list = []
25
+ excess_buffered_bytes_list = []
26
+ receiver_pps_list = []
27
+ pkt_loss_percent_list = []
28
+
29
+ for entry in self.output_dict["entries"]:
30
+
31
+ sender_throughput_rate_mbps = entry["sender_throughput_rate_mbps"]
32
+ receiver_throughput_rate_mbps = entry["receiver_throughput_rate_mbps"]
33
+ throughput_rate_ratio = abs(sender_throughput_rate_mbps - receiver_throughput_rate_mbps) / receiver_throughput_rate_mbps
34
+
35
+ # only add entries that capture then flow when it is at max bloat potential
36
+ if ( (self.args.udp and entry["pkt_loss_percent"] > 0) or
37
+ ((not self.args.udp) and throughput_rate_ratio < 0.03) and (receiver_throughput_rate_mbps > 1.0) ):
38
+
39
+ loaded_rtt_ms_list.append(entry["loaded_rtt_ms"])
40
+ receiver_throughput_rate_mbps_list.append(entry["receiver_throughput_rate_mbps"])
41
+ excess_buffered_bytes_list.append(entry["excess_buffered_bytes"])
42
+ receiver_pps_list.append(entry["receiver_pps"])
43
+ pkt_loss_percent_list.append(entry["pkt_loss_percent"])
44
+
45
+ num_samples = len(loaded_rtt_ms_list)
46
+ if num_samples < 10:
47
+ if not self.args.quiet:
48
+ print("WARNING: not enough valid samples for summary statistics: {} samples. Increase the duration of the run using the '-t' option.".format(num_samples))
49
+ return
50
+
51
+ summary_dict = self.output_dict["summary"] = {}
52
+
53
+ summary_dict["num_samples"] = num_samples
54
+
55
+ summary_dict["unloaded_rtt_ms"] = self.unloaded_rtt_ms
56
+
57
+ p50, p90, p99 = numpy.percentile(loaded_rtt_ms_list, [50, 90, 99])
58
+ summary_dict["loaded_rtt_ms"] = {}
59
+ summary_dict["loaded_rtt_ms"]["p50"] = p50
60
+ summary_dict["loaded_rtt_ms"]["p90"] = p90
61
+ summary_dict["loaded_rtt_ms"]["p99"] = p99
62
+
63
+ p50, p90, p99 = numpy.percentile(receiver_throughput_rate_mbps_list, [50, 90, 99])
64
+ summary_dict["receiver_throughput_rate_mbps"] = {}
65
+ summary_dict["receiver_throughput_rate_mbps"]["p50"] = p50
66
+ summary_dict["receiver_throughput_rate_mbps"]["p90"] = p90
67
+ summary_dict["receiver_throughput_rate_mbps"]["p99"] = p99
68
+
69
+ p50, p90, p99 = numpy.percentile(excess_buffered_bytes_list, [50, 90, 99])
70
+ summary_dict["excess_buffered_bytes"] = {}
71
+ summary_dict["excess_buffered_bytes"]["p50"] = p50
72
+ summary_dict["excess_buffered_bytes"]["p90"] = p90
73
+ summary_dict["excess_buffered_bytes"]["p99"] = p99
74
+
75
+ p50, p90, p99 = numpy.percentile(receiver_pps_list, [50, 90, 99])
76
+ summary_dict["receiver_pps"] = {}
77
+ summary_dict["receiver_pps"]["p50"] = p50
78
+ summary_dict["receiver_pps"]["p90"] = p90
79
+ summary_dict["receiver_pps"]["p99"] = p99
80
+
81
+ p50, p90, p99 = numpy.percentile(pkt_loss_percent_list, [50, 90, 99])
82
+ summary_dict["pkt_loss_percent"] = {}
83
+ summary_dict["pkt_loss_percent"]["p50"] = p50
84
+ summary_dict["pkt_loss_percent"]["p90"] = p90
85
+ summary_dict["pkt_loss_percent"]["p99"] = p99
86
+
87
+ def write_output(self):
88
+ self.create_aggregate_stats()
89
+
90
+ # write to stdout
91
+ if (self.args.quiet < 2) and ("summary" in self.output_dict):
92
+ str_out = json.dumps(self.output_dict["summary"], indent=4)
93
+ print(str_out)
94
+
95
+ # write to file if requested
96
+ if self.args.json_file:
97
+ json.dump(self.output_dict, self.json_output_file, indent=4)
98
+ self.json_output_file.close()
@@ -43,13 +43,7 @@ def init(args0):
43
43
  tmpfile1 = tempfile.NamedTemporaryFile(prefix=tmp_graph_filename_prefix, delete=False)
44
44
  tmpfile2 = tempfile.NamedTemporaryFile(prefix=tmp_raw_filename_prefix, delete=False)
45
45
 
46
- # requested JSON output file
47
- if args.json_file:
48
- try:
49
- json_output = JsonOutputClass(args)
50
- except Exception as e:
51
- print("ERROR creating json output: {} {}".format(type(e), str(e)))
52
- json_output = None
46
+ json_output = JsonOutputClass(args)
53
47
 
54
48
 
55
49
  def get_graph_data_file_name():
@@ -62,8 +56,7 @@ def term():
62
56
  tmpfile1.close()
63
57
  tmpfile2.close()
64
58
 
65
- if json_output:
66
- json_output.write_output_file()
59
+ json_output.write_output()
67
60
 
68
61
 
69
62
  def delete_data_files():
@@ -117,8 +110,7 @@ def print_output(s1):
117
110
  unloaded_rtt_sec = calibration.get_unloaded_latency_rtt_sec()
118
111
  unloaded_rtt_ms = unloaded_rtt_sec * 1000
119
112
 
120
- if json_output:
121
- json_output.set_unloaded_rtt_ms(unloaded_rtt_ms)
113
+ json_output.set_unloaded_rtt_ms(unloaded_rtt_ms)
122
114
 
123
115
  bdp_bytes = int( r_record["receiver_interval_rate_bytes_per_sec"] * unloaded_rtt_sec )
124
116
 
@@ -164,20 +156,20 @@ def print_output(s1):
164
156
  write_graph_data_to_file(lineout)
165
157
 
166
158
  # add to JSON output
167
- if json_output:
168
- new_entry = {
169
- "sent_time_sec": r_record["r_pkt_sent_time_sec"],
170
- "loaded_rtt_ms": r_record["rtt_ms"],
171
- "receiver_throughput_rate_mbps": r_record["receiver_interval_rate_mbps"],
172
- "excess_buffered_bytes": (r_record["buffered_bytes"] - bdp_bytes),
173
- "receiver_pps": r_record["receiver_pps"],
174
- "pkt_loss_percent": dropped_this_interval_percent
175
- }
176
- json_output.add_entry(new_entry)
159
+ new_entry = {
160
+ "sent_time_sec": r_record["r_pkt_sent_time_sec"],
161
+ "loaded_rtt_ms": r_record["rtt_ms"],
162
+ "sender_throughput_rate_mbps": r_record["sender_interval_rate_mbps"],
163
+ "receiver_throughput_rate_mbps": r_record["receiver_interval_rate_mbps"],
164
+ "excess_buffered_bytes": (r_record["buffered_bytes"] - bdp_bytes),
165
+ "receiver_pps": r_record["receiver_pps"],
166
+ "pkt_loss_percent": dropped_this_interval_percent
167
+ }
168
+ json_output.add_entry(new_entry)
177
169
 
178
170
  # write to stdout at the rate of one line per second
179
171
  # each stdout line will be a 0.1s snapshot
180
- if (curr_time > (last_line_to_stdout_time + const.STDOUT_INTERVAL_SEC)) or args.verbosity:
172
+ if ((curr_time > (last_line_to_stdout_time + const.STDOUT_INTERVAL_SEC)) and not args.quiet) or args.verbosity:
181
173
  if print_header2:
182
174
  print(" sent_time recv_time sender_pps sender_Mbps receiver_pps receiver_Mbps unloaded_rtt_ms rtt_ms BDP_bytes buffered_bytes bloat pkts_dropped drop%")
183
175
  print_header2 = False
@@ -208,7 +200,7 @@ def print_output(s1):
208
200
  else:
209
201
  calibration.update_rtt_sec(r_record["rtt_sec"])
210
202
 
211
- if curr_time > (last_line_to_stdout_time + const.STDOUT_INTERVAL_SEC):
203
+ if ((curr_time > (last_line_to_stdout_time + const.STDOUT_INTERVAL_SEC)) and not args.quiet) or args.verbosity:
212
204
  if print_header1:
213
205
  print("calibrating")
214
206
  print(" sent_time recv_time rtt_ms")
@@ -45,7 +45,7 @@ class TcpControlConnectionClass:
45
45
  num_bytes_sent
46
46
  ))
47
47
 
48
- if self.args and self.args.verbosity == 3:
48
+ if self.args and self.args.verbosity > 1:
49
49
  print("control connection: send: {}".format(payload_bytes.decode()))
50
50
 
51
51
 
@@ -73,7 +73,7 @@ class TcpControlConnectionClass:
73
73
  if len(recv_bytes) == 0:
74
74
  raise PeerDisconnectedException()
75
75
 
76
- if self.args and self.args.verbosity == 3:
76
+ if self.args and self.args.verbosity > 1:
77
77
  print("control connection: recv: {}".format(recv_bytes.decode()))
78
78
 
79
79
  return recv_bytes
@@ -44,7 +44,7 @@ class UdpRateManagerClass:
44
44
  # do not bother with tiny changes
45
45
  return
46
46
 
47
- if self.args.verbosity == 3:
47
+ if self.args.verbosity > 1:
48
48
  print("UdpRateManager: update: receiver pps {} old rate {} new rate {}".format(
49
49
  r_record["receiver_pps"],
50
50
  self.shared_udp_sending_rate_pps.value,
@@ -26,63 +26,15 @@ def validate_args(args):
26
26
  if args.time < 10:
27
27
  raise Exception("ERROR: time must be at least 10 seconds")
28
28
 
29
+ if args.verbosity and args.quiet:
30
+ raise Exception("ERROR: cannot specify both verbosity and quiet")
29
31
 
30
- def convert_bandwidth_str_to_int(arg_str):
31
- # input string:
32
- # n[kmgKMG] | n[kmgKMG]pps
33
32
 
34
- idx = arg_str.find("pps")
35
- if idx > -1:
36
- # found, so pps
37
- is_pps = True
38
- human_num_str = arg_str[:idx]
39
- else:
40
- # bps
41
- is_pps = False
42
- human_num_str = arg_str
43
-
44
- last_char = human_num_str[-1:]
45
-
46
- if last_char in [ "k", "K" ]:
47
- ret_val = int(human_num_str[0:-1]) * (10 ** 3)
48
-
49
- elif last_char in [ "m", "M" ]:
50
- ret_val = int(human_num_str[0:-1]) * (10 ** 6)
51
-
52
- elif last_char in [ "g", "G" ]:
53
- ret_val = int(human_num_str[0:-1]) * (10 ** 9)
54
-
55
- else:
56
- ret_val = int(human_num_str)
57
-
58
- return is_pps, ret_val
59
-
60
-
61
- def convert_bandwidth_spec_to_batch_info(args, bandwidth_is_pps, bandwidth_val_int):
62
-
63
- if args.udp:
64
- if bandwidth_is_pps:
65
- packets_per_sec = bandwidth_val_int
66
- sends_per_sec = packets_per_sec
67
- else:
68
- # udp/bps
69
- packets_per_sec = (bandwidth_val_int / 8.0) / len(const.PAYLOAD_1K)
70
- sends_per_sec = packets_per_sec
71
-
72
- batch_size = const.RATE_LIMITED_BATCH_SIZE_PKTS_UDP_PKTS
73
-
74
- else:
75
- # tcp
76
- if bandwidth_is_pps:
77
- packets_per_sec = bandwidth_val_int
78
- sends_per_sec = bandwidth_val_int / ( len(const.PAYLOAD_4K) / 1400.0 )
79
- else:
80
- packets_per_sec = (bandwidth_val_int / 8.0) / 1400.0
81
- sends_per_sec = packets_per_sec / ( len(const.PAYLOAD_4K) / 1400.0 )
33
+ def convert_udp_pps_to_batch_info(packets_per_sec):
82
34
 
83
- batch_size = const.RATE_LIMITED_BATCH_SIZE_PKTS_TCP_PKTS
35
+ batch_size = const.RATE_LIMITED_BATCH_SIZE_PKTS_UDP_PKTS
84
36
 
85
- batches_per_sec = sends_per_sec / batch_size
37
+ batches_per_sec = packets_per_sec / batch_size
86
38
 
87
39
  if batches_per_sec < 1:
88
40
  batches_per_sec = 1
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+
3
+ # Copyright (c) 2024 Cloudflare, Inc.
4
+ # Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ SERVER_ADDR=127.0.0.1
7
+
8
+ DURATION=10
9
+
10
+ OPTARGS=""
11
+ #OPTARGS="-k -g"
12
+
13
+ set -x
14
+
15
+ bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS
16
+
17
+ bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -R
18
+
19
+ bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -u -t 20
20
+
21
+ bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -u -R -t 20
22
+
23
+ bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -J /tmp/foo578439759837.out
24
+ rm /tmp/foo578439759837.out
25
+
@@ -1,69 +0,0 @@
1
-
2
- import json
3
- import numpy
4
-
5
- class JsonOutputClass:
6
-
7
- def __init__(self, args):
8
- self.args = args
9
-
10
- self.json_output_file = open(args.json_file, 'w')
11
-
12
- self.output_dict = {}
13
- self.output_dict["entries"] = []
14
-
15
- def set_unloaded_rtt_ms(self, rtt_ms):
16
- if "unloaded_rtt_ms" not in self.output_dict:
17
- self.output_dict["unloaded_rtt_ms"] = rtt_ms
18
-
19
- def add_entry(self, entry):
20
- self.output_dict["entries"].append(entry)
21
-
22
- def create_aggregate_stats(self):
23
- loaded_rtt_ms_list = []
24
- receiver_throughput_rate_mbps_list = []
25
- excess_buffered_bytes_list = []
26
- receiver_pps_list = []
27
- pkt_loss_percent_list = []
28
-
29
- for entry in self.output_dict["entries"]:
30
- loaded_rtt_ms_list.append(entry["loaded_rtt_ms"])
31
- receiver_throughput_rate_mbps_list.append(entry["receiver_throughput_rate_mbps"])
32
- excess_buffered_bytes_list.append(entry["excess_buffered_bytes"])
33
- receiver_pps_list.append(entry["receiver_pps"])
34
- pkt_loss_percent_list.append(entry["pkt_loss_percent"])
35
-
36
- p50, p90, p99 = numpy.percentile(loaded_rtt_ms_list, [50, 90, 99])
37
- self.output_dict["loaded_rtt_ms"] = {}
38
- self.output_dict["loaded_rtt_ms"]["p50"] = p50
39
- self.output_dict["loaded_rtt_ms"]["p90"] = p90
40
- self.output_dict["loaded_rtt_ms"]["p99"] = p99
41
-
42
- p50, p90, p99 = numpy.percentile(receiver_throughput_rate_mbps_list, [50, 90, 99])
43
- self.output_dict["receiver_throughput_rate_mbps"] = {}
44
- self.output_dict["receiver_throughput_rate_mbps"]["p50"] = p50
45
- self.output_dict["receiver_throughput_rate_mbps"]["p90"] = p90
46
- self.output_dict["receiver_throughput_rate_mbps"]["p99"] = p99
47
-
48
- p50, p90, p99 = numpy.percentile(excess_buffered_bytes_list, [50, 90, 99])
49
- self.output_dict["excess_buffered_bytes"] = {}
50
- self.output_dict["excess_buffered_bytes"]["p50"] = p50
51
- self.output_dict["excess_buffered_bytes"]["p90"] = p90
52
- self.output_dict["excess_buffered_bytes"]["p99"] = p99
53
-
54
- p50, p90, p99 = numpy.percentile(receiver_pps_list, [50, 90, 99])
55
- self.output_dict["receiver_pps"] = {}
56
- self.output_dict["receiver_pps"]["p50"] = p50
57
- self.output_dict["receiver_pps"]["p90"] = p90
58
- self.output_dict["receiver_pps"]["p99"] = p99
59
-
60
- p50, p90, p99 = numpy.percentile(pkt_loss_percent_list, [50, 90, 99])
61
- self.output_dict["pkt_loss_percent"] = {}
62
- self.output_dict["pkt_loss_percent"]["p50"] = p50
63
- self.output_dict["pkt_loss_percent"]["p90"] = p90
64
- self.output_dict["pkt_loss_percent"]["p99"] = p99
65
-
66
- def write_output_file(self):
67
- self.create_aggregate_stats()
68
- json.dump(self.output_dict, self.json_output_file, indent=4)
69
- self.json_output_file.close()
@@ -1,52 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Copyright (c) 2024 Cloudflare, Inc.
4
- # Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
5
-
6
- SERVER_ADDR=127.0.0.1
7
-
8
- DURATION=10
9
-
10
- OPTARGS=""
11
- #OPTARGS="-k -g"
12
-
13
- set -x
14
-
15
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS
16
-
17
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -R
18
-
19
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -J /tmp/foo578439759837.out
20
- rm /tmp/foo578439759837.out
21
-
22
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -R -J /tmp/foo578439759837.out
23
- rm /tmp/foo578439759837.out
24
-
25
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -u
26
-
27
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -u -R
28
-
29
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5M
30
-
31
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5M -R
32
-
33
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5Kpps
34
-
35
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5Kpps -R
36
-
37
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 20Kpps
38
-
39
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 20Kpps -R
40
-
41
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5M -u
42
-
43
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5M -u -R
44
-
45
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5Kpps -u
46
-
47
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 5Kpps -u -R
48
-
49
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 20Kpps -u
50
-
51
- bbperf -c $SERVER_ADDR -t $DURATION $EXTRAARGS -b 20Kpps -u -R
52
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes