def phymem_usage(): """Physical system memory as a (total, used, free) tuple.""" total = _psutil_bsd.get_total_phymem() free = _psutil_bsd.get_avail_phymem() used = total - free # XXX check out whether we have to do the same math we do on Linux percent = usage_percent(used, total, _round=1) return nt_sysmeminfo(total, used, free, percent)
import errno import os try: from collections import namedtuple except ImportError: from psutil.compat import namedtuple # python < 2.6 import _psutil_bsd import _psposix from psutil.error import AccessDenied, NoSuchProcess # --- constants NUM_CPUS = _psutil_bsd.get_num_cpus() TOTAL_PHYMEM = _psutil_bsd.get_total_phymem() # --- public functions def avail_phymem(): "Return the amount of physical memory available on the system, in bytes." return _psutil_bsd.get_avail_phymem() def used_phymem(): "Return the amount of physical memory currently in use on the system, in bytes." return TOTAL_PHYMEM - _psutil_bsd.get_avail_phymem() def total_virtmem():
import os try: from collections import namedtuple except ImportError: from psutil.compat import namedtuple # python < 2.6 import _psutil_bsd import _psposix from psutil.error import AccessDenied, NoSuchProcess # --- constants NUM_CPUS = _psutil_bsd.get_num_cpus() TOTAL_PHYMEM = _psutil_bsd.get_total_phymem() # --- public functions def avail_phymem(): "Return the amount of physical memory available on the system, in bytes." return _psutil_bsd.get_avail_phymem() def used_phymem(): "Return the amount of physical memory currently in use on the system, in bytes." return TOTAL_PHYMEM - _psutil_bsd.get_avail_phymem() def total_virtmem():