Python - get process names,CPU,Mem Usage and Peak Mem Usage in windows

cpu, memory, process, python, windows

Solution

You can use `psutil`.

For example, to obtain the list of process names:

process_names = [proc.name() for proc in psutil.process_iter()]

For info about the CPU use `psutil.cpu_percent` or `psutil.cpu_times`. For info about memory usage use `psutil.virtual_memory`.

Note that psutil works with Linux, OS X, Windows, Solaris and FreeBSD and with python 2.4 through 3.3.

Problem

I am wanting to get a list of all the process names, CPU, Mem Usage and Peak Mem Usage. I was hoping I could use ctypes. but I am happy to hear any other options. Thanks for your time.

Original source