summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psutil/_psbsd.py4
-rw-r--r--psutil/arch/bsd/freebsd.c5
-rw-r--r--psutil/tests/test_process.py4
-rw-r--r--psutil/tests/test_system.py3
4 files changed, 14 insertions, 2 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py
index 4806161b..0b51cd77 100644
--- a/psutil/_psbsd.py
+++ b/psutil/_psbsd.py
@@ -103,6 +103,10 @@ pmmap_grouped = namedtuple(
'pmmap_grouped', 'path rss, private, ref_count, shadow_count')
pmmap_ext = namedtuple(
'pmmap_ext', 'addr, perms path rss, private, ref_count, shadow_count')
+sdiskio = namedtuple('sdiskio', ['read_count', 'write_count',
+ 'read_bytes', 'write_bytes',
+ 'read_time', 'write_time',
+ 'busy_time'])
# set later from __init__.py
NoSuchProcess = None
diff --git a/psutil/arch/bsd/freebsd.c b/psutil/arch/bsd/freebsd.c
index 36700092..f25feba6 100644
--- a/psutil/arch/bsd/freebsd.c
+++ b/psutil/arch/bsd/freebsd.c
@@ -759,13 +759,14 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) {
current.unit_number);
py_disk_info = Py_BuildValue(
- "(KKKKLL)",
+ "(KKKKLLL)",
current.operations[DEVSTAT_READ], // no reads
current.operations[DEVSTAT_WRITE], // no writes
current.bytes[DEVSTAT_READ], // bytes read
current.bytes[DEVSTAT_WRITE], // bytes written
(long long) PSUTIL_BT2MSEC(current.duration[DEVSTAT_READ]), // r time
- (long long) PSUTIL_BT2MSEC(current.duration[DEVSTAT_WRITE]) // w time
+ (long long) PSUTIL_BT2MSEC(current.duration[DEVSTAT_WRITE]), // w time
+ (long long) PSUTIL_BT2MSEC(current.busy_time) // busy time
); // finished transactions
if (!py_disk_info)
goto error;
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index e96cf233..8de14ab3 100644
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -1883,6 +1883,8 @@ class TestUnicode(unittest.TestCase):
self.assertIsInstance(path, str)
self.assertEqual(os.path.normcase(path), os.path.normcase(self.uexe))
+ @unittest.skipUnless(hasattr(psutil.Process, "environ"),
+ "environ not available")
def test_proc_environ(self):
env = os.environ.copy()
env['FUNNY_ARG'] = self.uexe
@@ -1998,6 +2000,8 @@ class TestNonUnicode(unittest.TestCase):
self.assertIsInstance(path, str)
self.assertIn(funny_file, encode_path(path))
+ @unittest.skipUnless(hasattr(psutil.Process, "environ"),
+ "environ not available")
def test_proc_environ(self):
env = os.environ.copy()
funny_path = self.temp_directory
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 87403731..1b6127f9 100644
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -619,6 +619,9 @@ class TestSystemAPIs(unittest.TestCase):
assert nt.read_merged_count >= 0, nt
assert nt.write_merged_count >= 0, nt
assert nt.busy_time >= 0, nt
+ elif BSD:
+ self.assertEqual(nt[6], nt.busy_time)
+ assert nt.busy_time >= 0, nt
assert nt.read_count >= 0, nt
assert nt.write_count >= 0, nt
assert nt.read_bytes >= 0, nt