Skip to content

Commit

Permalink
print statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed Feb 14, 2025
1 parent d5ce5ac commit 00e2f0c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions worker/games.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import re
import shutil
import signal
import statistics
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -430,7 +431,7 @@ def run_parallel_benches(engine, concurrency, threads, signature=None):
message = f"Failed to run engine bench: {str(e)}"
raise WorkerException(message, e=e)

bench_nps = 0.0
bench_nps_values = []
for sig, nps in results:
if sig is None or nps is None:
message = f"Unable to parse bench output of {engine.name}"
Expand All @@ -443,9 +444,22 @@ def run_parallel_benches(engine, concurrency, threads, signature=None):
)
raise RunException(message)

bench_nps += nps
bench_nps_values.append(nps / threads)

return bench_nps / (concurrency * threads)
total = sum(bench_nps_values)
average_nps = total / concurrency
min_nps = min(bench_nps_values)
max_nps = max(bench_nps_values)
median_nps = statistics.median(bench_nps_values)
std_nps = statistics.stdev(bench_nps_values) if len(bench_nps_values) > 1 else 0.0

print(
f"Bench statistics for {engine.name}:\n"
f"average: {average_nps:.2f}, median: {median_nps:.2f}\n"
f"min: {min_nps:.2f}, max: {max_nps:.2f}, "
f"std: {std_nps:.2f}, std (%): {100 * std_nps / average_nps:.2f}"
)
return median_nps


def verify_signature(engine, signature, games_concurrency, threads):
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 262, "updater.py": "dpMIHELIfaXCmCM4Bpge2G7Oikl1AiQq5tvQIQeS7WJcMSzVdVX/XvtRf5xFYRSQ", "worker.py": "FDGKksHE6Exf13q5xPPIop4zpjBfvlT6xOrXJwLy8oVmegRGqCMwUHcCzet/3Erg", "games.py": "k9ODGqeD4q2L5uvEuLPE1IAMJjLHCn0k/xkxxBRJOliyNCmMIc+3rvFs60rPPilS"}
{"__version": 262, "updater.py": "dpMIHELIfaXCmCM4Bpge2G7Oikl1AiQq5tvQIQeS7WJcMSzVdVX/XvtRf5xFYRSQ", "worker.py": "FDGKksHE6Exf13q5xPPIop4zpjBfvlT6xOrXJwLy8oVmegRGqCMwUHcCzet/3Erg", "games.py": "1/oJ2pL0tac1uDsUjcDcKo9l97ZM+LX5EZXbeX4d+Xtq6QVgCKJInWobAdsSjudo"}

0 comments on commit 00e2f0c

Please sign in to comment.