mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
refactor: one load threshold for every probe
This commit is contained in:
1 parent
91e385598e
commit
eddb26f104
5 files changed
+32
-8
No files matched your search
@@ -1587,8 +1587,13 @@ def probe(args: argparse.Namespace) -> int:
|
||||
return _probe(args)
|
||||
|
||||
|
||||
def default_max_load(cpus: int | None = None) -> float:
|
||||
"""The load above which a run records nothing without --max-load: a quarter of the CPUs."""
|
||||
return (cpus if cpus is not None else os.cpu_count() or 1) / 4
|
||||
|
||||
|
||||
def _probe(args: argparse.Namespace) -> int:
|
||||
max_load = args.max_load if args.max_load is not None else (os.cpu_count() or 1) / 4
|
||||
max_load = args.max_load if args.max_load is not None else default_max_load()
|
||||
load_before = load_average()
|
||||
if args.record and load_before and load_before[0] > max_load:
|
||||
print(f"ERROR: load average {load_before[0]} exceeds {max_load}: the machine is busy, "
|
||||
|
||||
Reference in new issue
Block a user