You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Benchmarking is a complex science, see: https://easyperf.net/blog/2019/08/02/Perf-measurement-environment-on-Linux.
It seems like an important aspect of benchmarking is asking the kernel to isolate a certain CPU, so that only a benchmark script can use it and avoid sharing that CPU with other processes.
It must be noted that psutil already provides some tools which one typically wants to run before a benchmark:
defset_highest_priority():
"""Set highest CPU and I/O priority (requires root)."""p=psutil.Process()
ifpsutil.WINDOWS:
p.nice(psutil.HIGH_PRIORITY_CLASS)
else:
p.nice(-20)
ifpsutil.LINUX:
p.ionice(psutil.IOPRIO_CLASS_RT, value=7)
elifpsutil.WINDOWS:
p.ionice(psutil.IOPRIO_HIGH)
It would be nice if the above code could be extended to allow something like this:
>>>psutil.cpu_isolation() # get
[]
>>>psutil.cpu_isolation([1, 2]) # set>>>psutil.cpu_isolation()
[1, 2]
>>>>>>psutil.Process().cpu_affinity([1, 2]) # isolate this process>>>
Benchmarking is a complex science, see: https://easyperf.net/blog/2019/08/02/Perf-measurement-environment-on-Linux.
It seems like an important aspect of benchmarking is asking the kernel to isolate a certain CPU, so that only a benchmark script can use it and avoid sharing that CPU with other processes.
It must be noted that psutil already provides some tools which one typically wants to run before a benchmark:
It would be nice if the above code could be extended to allow something like this:
Useful URLs
get()
on Linux: https://github.com/psf/pyperf/blob/db186b120a1b3abcb0a5ffc25585fa828c823566/pyperf/_cpu_utils.pycset
CLI command source code: https://github.com/lpechacek/cpusetThe text was updated successfully, but these errors were encountered: