Skip to content

Commit 4008669

Browse files
committed
Split the shared sweep loop into a per-setup climb and its log line
1 parent 8919412 commit 4008669

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

‎benchmarks/loadkit.py‎

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -382,26 +382,34 @@ def sweep(results, setups, args, run_point, describe, entry_fields):
382382
"points": [],
383383
}
384384
results["setups"].append(entry)
385-
for browsers in sorted(args.browsers):
386-
try:
387-
point = run_point(setup, browsers, args)
388-
except RuntimeError as err:
389-
print(f"{setup.name} @ {browsers}: {err}", flush=True)
390-
break
391-
entry["points"].append(point)
392-
flags = (" SATURATED" if point["saturated"] else "") + (
393-
" CLIENT-BOUND" if point["client_bound"] else ""
394-
)
395-
print(
396-
f"{setup.name:24} {browsers:5} browsers {describe(point)}"
397-
f" err {point['error_rate']:.2%} server {point['server_cpu_cores']} cores"
398-
f" client peak {point['client_cpu_peak_pct']}%{flags}",
399-
flush=True,
400-
)
401-
with open(args.out, "w", encoding="utf-8") as f:
402-
json.dump(results, f, indent=1)
403-
if point["saturated"] or point["client_bound"]:
404-
break
385+
_climb(setup, entry, results, args, run_point, describe)
386+
387+
388+
def _climb(setup, entry, results, args, run_point, describe):
389+
for browsers in sorted(args.browsers):
390+
try:
391+
point = run_point(setup, browsers, args)
392+
except RuntimeError as err:
393+
print(f"{setup.name} @ {browsers}: {err}", flush=True)
394+
return
395+
entry["points"].append(point)
396+
_log(setup, browsers, point, describe)
397+
with open(args.out, "w", encoding="utf-8") as f:
398+
json.dump(results, f, indent=1)
399+
if point["saturated"] or point["client_bound"]:
400+
return
401+
402+
403+
def _log(setup, browsers, point, describe):
404+
flags = (" SATURATED" if point["saturated"] else "") + (
405+
" CLIENT-BOUND" if point["client_bound"] else ""
406+
)
407+
print(
408+
f"{setup.name:24} {browsers:5} browsers {describe(point)}"
409+
f" err {point['error_rate']:.2%} server {point['server_cpu_cores']} cores"
410+
f" client peak {point['client_cpu_peak_pct']}%{flags}",
411+
flush=True,
412+
)
405413

406414

407415
def add_common_args(parser, browsers):

0 commit comments

Comments
 (0)