Documentation  
API reference

API Reference

Exceptions

psutil.NoSuchProcess

Raised when no process with the given PID/parameter was found in the current process list.

psutil.AccessDenied

Exception raised when permission to perform an action is denied.


Classes

psutil.Process(pid)

A class which represents an OS process.
New in 0.1.3
New in 0.1.3 - Availability Windows, Linux
New in 0.1.3
New in 0.1.3

Functions

psutil.get_pid_list()

Return a list of current running PIDs.

psutil.pid_exists(pid)

Check whether the given PID exists in the current process list.

psutil.process_iter()

Return an iterator yielding a Process class instances for all running processes on the local machine.


System related objects

psutil.cpu_percent()

Return the current system-wide CPU utilization as a percentage. For highest accuracy, it is recommended that this be called at least 1/10th of a second after importing the module or calling cpu_percent() in a previous call, to allow for a larger time delta from which to calculate the percentage value.

psutil.cpu_times()

Return system CPU times as a CPUTimes class object. Every CPU time is accessible in form of a CPUTimes attribute and represents the time CPU has spent in the given mode.
The attributes availability varies depending on the platform. Here follows a list of all available attributes:

- user
- system
- idle
- nice (UNIX)
- iowait (Linux)
- irq (Linux, FreeBSD)
- softirq (Linux)

psutil.TOTAL_PHYMEM
psutil.avail_phymem()
psutil.used_phymem()

Return the amount of total, available and used physical memory on the system, in bytes.

psutil.total_virtmem()
psutil.avail_virtmem()
psutil.used_virtmem()

Return the amount of total, available and used virtual memory on the system, in bytes.
On Linux they match the values returned by free command line utility. On OS X and FreeBSD they represent the same values as returned by sysctl vm.vmtotal. On Windows they are determined by reading the *PageFile values of
MEMORYSTATUSEX structure.