From 39d5ce2871782b77fab5ccdb8e9d772afd48b6ef Mon Sep 17 00:00:00 2001 From: shBLOCK <50770712+shBLOCK@users.noreply.github.com> Date: Fri, 5 Apr 2024 22:02:29 +0800 Subject: [PATCH] Benchmarking: set process priority --- benchmark/benchmark.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index 6cd8c9f..778b0f0 100644 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -1,3 +1,4 @@ +import sys import timeit import enum from collections import OrderedDict @@ -5,6 +6,16 @@ # Get rid of pygame import message import pygame + +import platform +if platform.system() == "Windows": + import psutil + import os + psutil.Process(os.getpid()).nice(psutil.REALTIME_PRIORITY_CLASS) + print("Setting process priority to realtime class!") +else: + print("Warning: Not on windows, not setting process priority!", file=sys.stderr) + print() class Subject(enum.Enum):