diff options
-rw-r--r-- | IDEAS | 5 | ||||
-rw-r--r-- | MANIFEST.in | 4 | ||||
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | docs/index.rst | 3 | ||||
-rw-r--r-- | psutil/_pslinux.py | 6 | ||||
-rw-r--r-- | psutil/tests/test_process.py | 11 |
6 files changed, 19 insertions, 13 deletions
@@ -17,7 +17,7 @@ PLATFORMS FEATURES ======== -- (UNIX) process root (different from xwd) +- (UNIX) process root (different from cwd) - (Linux) locked files via /proc/locks: https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-proc-locks.html @@ -43,9 +43,6 @@ FEATURES - #604: emulate os.getloadavg() on Windows -- (Linux) extend Process.open_files() in order to read from /proc/pid/fdinfo - and return file position and flags/mode. - - scripts/taskmgr-gui.py (using tk). - system-wide number of open file descriptors: diff --git a/MANIFEST.in b/MANIFEST.in index ee26657b..67280314 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ include appveyor.yml include CREDITS include DEVGUIDE.rst include HISTORY.rst +include IDEAS include INSTALL.rst include LICENSE include make.bat @@ -13,10 +14,9 @@ include Makefile include MANIFEST.in include README.rst include setup.py -include TODO include tox.ini recursive-exclude docs/_build * recursive-include .ci * recursive-include docs * -recursive-include scripts *.py *.rst *README recursive-include psutil *.py *.c *.h README* +recursive-include scripts *.py @@ -254,7 +254,8 @@ Process management pio(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632) >>> >>> p.open_files() - [popenfile(path='/home/giampaolo/svn/psutil/somefile', fd=3)] + [popenfile(path='/home/giampaolo/svn/psutil/setup.py', fd=3, position=0, mode='r', flags=32768), + popenfile(path='/var/log/monitd', fd=4, position=235542, mode='a', flags=33793)] >>> >>> p.connections() [pconn(fd=115, family=<AddressFamily.AF_INET: 2>, type=<SocketType.SOCK_STREAM: 1>, laddr=('10.0.0.1', 48776), raddr=('93.186.135.91', 80), status='ESTABLISHED'), diff --git a/docs/index.rst b/docs/index.rst index 429e76b3..b6cf4d91 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1223,7 +1223,8 @@ Process class >>> f = open('file.ext', 'w') >>> p = psutil.Process() >>> p.open_files() - [popenfile(path='/home/giampaolo/svn/psutil/file.ext', fd=3)] + [popenfile(path='/home/giampaolo/svn/psutil/setup.py', fd=3, position=0, mode='r', flags=32768), + popenfile(path='/var/log/monitd', fd=4, position=235542, mode='a', flags=33793)] .. warning:: on Windows this is not fully reliable as due to some limitations of the diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 324ff5cb..9abbb876 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -251,6 +251,8 @@ popenfile = namedtuple('popenfile', ['path', 'fd', 'position', 'mode', 'flags']) pmem = namedtuple('pmem', 'rss vms shared text lib data dirty') pfullmem = namedtuple('pfullmem', pmem._fields + ('uss', 'pss', 'swap')) +pcputimes = namedtuple('pcputimes', + ['user', 'system', 'children_user', 'children_system']) pmmap_grouped = namedtuple( 'pmmap_grouped', ['path', 'rss', 'size', 'pss', 'shared_clean', @@ -989,7 +991,9 @@ class Process(object): values = st.split(b' ') utime = float(values[11]) / CLOCK_TICKS stime = float(values[12]) / CLOCK_TICKS - return _common.pcputimes(utime, stime) + children_utime = float(values[13]) / CLOCK_TICKS + children_stime = float(values[14]) / CLOCK_TICKS + return pcputimes(utime, stime, children_utime, children_stime) @wrap_exceptions def wait(self, timeout=None): diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index c556caf0..f52d629a 100644 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -267,9 +267,12 @@ class TestProcess(unittest.TestCase): def test_cpu_times(self): times = psutil.Process().cpu_times() assert (times.user > 0.0) or (times.system > 0.0), times + if LINUX: + assert (times.children_user >= 0.0), times + assert (times.children_system >= 0.0), times # make sure returned values can be pretty printed with strftime - time.strftime("%H:%M:%S", time.localtime(times.user)) - time.strftime("%H:%M:%S", time.localtime(times.system)) + for name in times._fields: + time.strftime("%H:%M:%S", time.localtime(getattr(times, name))) # Test Process.cpu_times() against os.times() # os.times() is broken on Python 2.6 @@ -279,8 +282,8 @@ class TestProcess(unittest.TestCase): @unittest.skipUnless(sys.version_info > (2, 6, 1) and not OSX, 'os.times() is not reliable on this Python version') - def test_cpu_times2(self): - user_time, kernel_time = psutil.Process().cpu_times() + def test_cpu_times_2(self): + user_time, kernel_time = psutil.Process().cpu_times()[:2] utime, ktime = os.times()[:2] # Use os.times()[:2] as base values to compare our results |