I've used psutil for this on Linux:

https://pypi.python.org/pypi/psutil/
On Sat, Jun 25, 2016 at 07:04, Serdar Yegulalp <[email protected]>
wrote:

> One of the little performance tweaks I've come across for Pyglet involves
> setting the processor affinity for the running app. The Python interpreter
> is effectively single-threaded, and so allowing it to run with the default
> affinity (all cores) can actually harm performance in some cases.
>
> Consequently, setting the affinity of the running process to a single core
> can sometimes speed it up, because there's less context switching and less
> cache eviction..
>
> I'm not sure how to accomplish this in Linux or on MacOS, but in Windows,
> it's easy enough:
>
> import ctypes
> k32 = ctypes.windll.kernel32
> k32.SetProcessAffinityMask(k32.GetCurrentProcess(), 1)
>
> I'm doing this with a game I'm working on now and it provides a
> noticeable, if not terribly dramatic, speedup.
>
> I also use this in conjunction with bumping the process priority slightly,
> something I've discussed before:
>
> ctypes.windll.kernel32.SetPriorityClass(-1, 0x8000))
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to