From fbda723ad0ad96d5f28753605adeffe63a618dcf Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Sun, 24 Jan 2016 18:59:48 +0000 Subject: add netbsd tests --- psutil/_psbsd.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'psutil/_psbsd.py') 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) -- cgit v1.2.1