Skip to content

Commit

Permalink
(Partial) Fix giampaolo#694
Browse files Browse the repository at this point in the history
  • Loading branch information
alxchk committed May 19, 2017
1 parent d2b3066 commit cc0caa4
Show file tree
Hide file tree
Showing 2 changed files with 317 additions and 7 deletions.
12 changes: 12 additions & 0 deletions psutil/_pssunos.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,26 @@ def __init__(self, pid):

def oneshot_enter(self):
self._proc_name_and_args.cache_activate()
self._proc_environ.cache_activate()
self._proc_basic_info.cache_activate()
self._proc_cred.cache_activate()

def oneshot_exit(self):
self._proc_name_and_args.cache_deactivate()
self._proc_environ.cache_deactivate()
self._proc_basic_info.cache_deactivate()
self._proc_cred.cache_deactivate()

@memoize_when_activated
def _proc_name_and_args(self):
return cext.proc_name_and_args(self.pid, self._procfs_path)

@memoize_when_activated
def _proc_environ(self):
args = cext.proc_environ(self.pid, self._procfs_path)
if args:
return dict(args)

@memoize_when_activated
def _proc_basic_info(self):
ret = cext.proc_basic_info(self.pid, self._procfs_path)
Expand Down Expand Up @@ -414,6 +422,10 @@ def exe(self):
def cmdline(self):
return self._proc_name_and_args()[1].split(' ')

@wrap_exceptions
def environ(self):
return self._proc_environ()

@wrap_exceptions
def create_time(self):
return self._proc_basic_info()[proc_info_map['create_time']]
Expand Down
Loading

0 comments on commit cc0caa4

Please sign in to comment.