diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-24 15:28:00 +0000 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-24 15:28:00 +0000 |
commit | 6ebf9d4919eb8725576df3c392b12adfab67afe1 (patch) | |
tree | 3fcd6eef97e3a36ac38c0c84f92f957b1398d104 | |
parent | 4bec7e4e4c1edb806da39c52e79dd049a8098e0d (diff) | |
download | psutil-6ebf9d4919eb8725576df3c392b12adfab67afe1.tar.gz |
fix #770: [NetBSD] disk_io_counters() metrics didn't update.
-rw-r--r-- | HISTORY.rst | 1 | ||||
-rw-r--r-- | psutil/_psbsd.py | 2 | ||||
-rw-r--r-- | psutil/arch/bsd/netbsd.c | 11 |
3 files changed, 6 insertions, 8 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 16ad1e2f..3fd664e8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -36,6 +36,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues - #764: [NetBSD] fix compilation on NetBSD-6.x. - #767: [Linux] disk_io_counters() may raise ValueError on 2.6 kernels and it's broken on 2.4 kernels. +- #770: [NetBSD] disk_io_counters() metrics didn't update. 3.4.2 - 2016-01-20 diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 2d703ca0..b9388b76 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -111,7 +111,7 @@ if FREEBSD: else: sdiskio = namedtuple('sdiskio', ['read_count', 'write_count', 'read_bytes', 'write_bytes', - 'busy_time']) + ]) # set later from __init__.py NoSuchProcess = None diff --git a/psutil/arch/bsd/netbsd.c b/psutil/arch/bsd/netbsd.c index 330a9235..5f66449a 100644 --- a/psutil/arch/bsd/netbsd.c +++ b/psutil/arch/bsd/netbsd.c @@ -643,22 +643,19 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) { PyErr_NoMemory(); goto error; } - if (sysctl(mib, 2, stats, &len, NULL, 0) < 0 ) { + if (sysctl(mib, 3, stats, &len, NULL, 0) < 0 ) { PyErr_SetFromErrno(PyExc_OSError); goto error; } for (i = 0; i < dk_ndrive; i++) { py_disk_info = Py_BuildValue( - "(KKKKLL)", + "(KKKK)", stats[i].rxfer, stats[i].wxfer, stats[i].rbytes, - stats[i].wbytes, - // assume half read - half writes. - // TODO: why? - (long long) PSUTIL_KPT2DOUBLE(stats[i].time) / 2, - (long long) PSUTIL_KPT2DOUBLE(stats[i].time) / 2); + stats[i].wbytes + ); if (!py_disk_info) goto error; if (PyDict_SetItemString(py_retdict, stats[i].name, py_disk_info)) |