diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-24 18:59:48 +0000 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-24 18:59:48 +0000 |
commit | fbda723ad0ad96d5f28753605adeffe63a618dcf (patch) | |
tree | afea682bac499325e50c0cb1e3480e81691c49dc /psutil/_psbsd.py | |
parent | a991494e4502e1235ebc62b5ba450287d0dedec0 (diff) | |
download | psutil-792-cpu-stats.tar.gz |
add netbsd tests792-cpu-stats
Diffstat (limited to 'psutil/_psbsd.py')
-rw-r--r-- | psutil/_psbsd.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index ad98b4f9..89bbf7c6 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -234,11 +234,21 @@ def cpu_stats(): return scpustats( ctx_switches, interrupts, soft_interrupts, syscalls, traps) elif NETBSD: + # XXX + # Note about interrupts: the C extension returns 0. interrupts + # can be determined via /proc/stat; it has the same value as + # soft_interrupts thought so the kernel is faking it (?). + # + # Note about syscalls: the C extension always sets it to 0 (?). + # # Note: the C ext is returning two metrics we are not returning: # faults and forks. - # XXX - syscalls and intrs are always 0 (?). (ctx_switches, interrupts, soft_interrupts, syscalls, traps, faults, forks) = cext.cpu_stats() + with open('/proc/stat', 'rb') as f: + for line in f: + if line.startswith(b'intr'): + interrupts = int(line.split()[1]) return scpustats( ctx_switches, interrupts, soft_interrupts, syscalls, traps) |