def get_process_terminal(self): hit_enoent = False tty = wrap_exceptions(_psutil_sunos.get_process_basic_info(self.pid)[0]) if tty != _psutil_sunos.PRNODEV: for x in (0, 1, 2, 255): try: return os.readlink('/proc/%d/path/%d' % (self.pid, x)) except OSError: err = sys.exc_info()[1] if err.errno == errno.ENOENT: hit_enoent = True continue raise if hit_enoent: # raise NSP if the process disappeared on us os.stat('/proc/%s' % self.pid)
def get_process_status(self): code = _psutil_sunos.get_process_basic_info(self.pid)[6] if code in _status_map: return _status_map[code] return constant(-1, "?")
def get_memory_info(self): ret = _psutil_sunos.get_process_basic_info(self.pid) rss, vms = ret[1] * 1024, ret[2] * 1024 return nt_meminfo(rss, vms)
def get_process_ppid(self): return _psutil_sunos.get_process_basic_info(self.pid)[0]
def get_process_num_threads(self): return _psutil_sunos.get_process_basic_info(self.pid)[5]
def get_process_create_time(self): return _psutil_sunos.get_process_basic_info(self.pid)[3]
import subprocess import socket import _psutil_sunos import _psutil_posix from psutil import _psposix from psutil._error import AccessDenied, NoSuchProcess, TimeoutExpired from psutil._compat import namedtuple, PY3 from psutil._common import * __extra__all__ = ["CONN_IDLE", "CONN_BOUND"] PAGE_SIZE = os.sysconf('SC_PAGE_SIZE') NUM_CPUS = os.sysconf("SC_NPROCESSORS_ONLN") BOOT_TIME = _psutil_sunos.get_process_basic_info(0)[3] TOTAL_PHYMEM = os.sysconf('SC_PHYS_PAGES') * PAGE_SIZE CONN_IDLE = constant(11, "IDLE") CONN_BOUND = constant(12, "BOUND") _PAGESIZE = os.sysconf("SC_PAGE_SIZE") _cputimes_ntuple = namedtuple('cputimes', 'user system idle iowait') disk_io_counters = _psutil_sunos.get_disk_io_counters net_io_counters = _psutil_sunos.get_net_io_counters get_disk_usage = _psposix.get_disk_usage get_system_boot_time = lambda: _psutil_sunos.get_process_basic_info(0)[3] nt_virtmem_info = namedtuple('vmem', ' '.join([ # all platforms
def get_process_status(self): code = _psutil_sunos.get_process_basic_info(self.pid)[6] # XXX is '?' legit? (we're not supposed to return it anyway) return PROC_STATUSES.get(code, '?')
import struct import subprocess import socket import _psutil_sunos import _psutil_posix from psutil import _psposix from psutil._error import AccessDenied, NoSuchProcess, TimeoutExpired from psutil._compat import namedtuple, PY3 from psutil._common import * __extra__all__ = ["CONN_IDLE", "CONN_BOUND"] PAGE_SIZE = os.sysconf('SC_PAGE_SIZE') NUM_CPUS = os.sysconf("SC_NPROCESSORS_ONLN") BOOT_TIME = _psutil_sunos.get_process_basic_info(0)[3] TOTAL_PHYMEM = os.sysconf('SC_PHYS_PAGES') * PAGE_SIZE CONN_IDLE = constant(11, "IDLE") CONN_BOUND = constant(12, "BOUND") _PAGESIZE = os.sysconf("SC_PAGE_SIZE") _cputimes_ntuple = namedtuple('cputimes', 'user system idle iowait') disk_io_counters = _psutil_sunos.get_disk_io_counters net_io_counters = _psutil_sunos.get_net_io_counters get_disk_usage = _psposix.get_disk_usage get_system_boot_time = lambda: _psutil_sunos.get_process_basic_info(0)[3] nt_virtmem_info = namedtuple( 'vmem',