Add FreeBSD code to arc_summary and arcstat

Adding the FreeBSD code allows arc_summary and arcstat
to be used on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9641
This commit is contained in:
Ryan Moeller
2019-11-30 18:43:23 -05:00
committed by Brian Behlendorf
parent c54687cd23
commit 101f9b1771
3 changed files with 77 additions and 6 deletions
+23 -1
View File
@@ -119,7 +119,29 @@ out = None
kstat = None
if sys.platform.startswith('linux'):
if sys.platform.startswith('freebsd'):
# Requires py27-sysctl on FreeBSD
import sysctl
def kstat_update():
global kstat
k = sysctl.filter('kstat.zfs.misc.arcstats')
if not k:
sys.exit(1)
kstat = {}
for s in k:
if not s:
continue
name, value = s.name, s.value
# Trims 'kstat.zfs.misc.arcstats' from the name
kstat[name[24:]] = Decimal(value)
elif sys.platform.startswith('linux'):
def kstat_update():
global kstat