import errno import os import sys import _psutil_osx import _psutil_posix from psutil import _psposix from psutil.error import AccessDenied, NoSuchProcess, TimeoutExpired from psutil._compat import namedtuple from psutil._common import * __extra__all__ = [] # --- constants NUM_CPUS = _psutil_osx.get_num_cpus() BOOT_TIME = _psutil_osx.get_system_boot_time() TOTAL_PHYMEM = _psutil_osx.get_virtual_mem()[0] _PAGESIZE = os.sysconf("SC_PAGE_SIZE") _cputimes_ntuple = namedtuple('cputimes', 'user nice system idle') # --- functions nt_virtmem_info = namedtuple('vmem', ' '.join([ # all platforms 'total', 'available', 'percent', 'used', 'free', # OSX specific 'active', 'inactive', 'wired']))
import _psutil_posix from psutil import _psposix from psutil._error import AccessDenied, NoSuchProcess, TimeoutExpired from psutil._compat import namedtuple, wraps from psutil._common import * __extra__all__ = [] # --- constants # Since these constants get determined at import time we do not want to # crash immediately; instead we'll set them to None and most likely # we'll crash later as they're used for determining process CPU stats # and creation_time try: NUM_CPUS = _psutil_osx.get_num_cpus() except Exception: NUM_CPUS = None warnings.warn("couldn't determine platform's NUM_CPUS", RuntimeWarning) try: BOOT_TIME = _psutil_osx.get_system_boot_time() except Exception: BOOT_TIME = None warnings.warn("couldn't determine platform's BOOT_TIME", RuntimeWarning) try: TOTAL_PHYMEM = _psutil_osx.get_virtual_mem()[0] except Exception: TOTAL_PHYMEM = None warnings.warn("couldn't determine platform's TOTAL_PHYMEM", RuntimeWarning) _PAGESIZE = os.sysconf("SC_PAGE_SIZE")