diff options
author | Ryan Moeller <[email protected]> | 2019-11-30 18:43:23 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-11-30 15:43:23 -0800 |
commit | 101f9b1771a638947697e46f3acc16addefdf9f5 (patch) | |
tree | 17c388ba3b0aadbce771d1bda529e7cf7eea2abe /cmd/arcstat | |
parent | c54687cd2360d01c8237058f16293572b2a2eedb (diff) |
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 <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #9641
Diffstat (limited to 'cmd/arcstat')
-rwxr-xr-x | cmd/arcstat/arcstat | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/arcstat/arcstat b/cmd/arcstat/arcstat index 7562038d1..143f47574 100755 --- a/cmd/arcstat/arcstat +++ b/cmd/arcstat/arcstat @@ -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 |