From a93edde1a21e533472b5d443002032260b5bd066 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Sat, 6 Jul 2019 04:27:49 +0000 Subject: Support ZFS ARC stats on FreeBSD New meter displays same ARC stats as FreeBSD top(1). Can be extended to other platforms that support ZFS. Pulling kstat.zfs.misc.arcstats.c_max as the meter total, so the meter has a meaningful value to work up to. The Text meter displays, first, the maximum ARC size (Meter.total), then second, the total ARC used, using the difference between Meter.maxItems and Meter.curItems to "hide" the used value from the Bar and Graph drawing functions by using an index in Meter.values[] that is beyond curItems - 1, but less than maxItems - 1. --- zfs/ZfsArcMeter.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 zfs/ZfsArcMeter.h (limited to 'zfs/ZfsArcMeter.h') diff --git a/zfs/ZfsArcMeter.h b/zfs/ZfsArcMeter.h new file mode 100644 index 00000000..b89be223 --- /dev/null +++ b/zfs/ZfsArcMeter.h @@ -0,0 +1,18 @@ +/* Do not edit this file. It was automatically generated. */ + +#ifndef HEADER_ZfsArcMeter +#define HEADER_ZfsArcMeter +/* +htop - ZfsArcMeter.h +(C) 2004-2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + +#include "Meter.h" + +extern int ZfsArcMeter_attributes[]; + +extern MeterClass ZfsArcMeter_class; + +#endif -- cgit v1.2.3 From e450b586368750e771746ef3e2f5a070962dfd28 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Tue, 3 Sep 2019 18:21:33 +0000 Subject: Refactor openzfs_sysctl_init() and ZfsArcMeter... openzfs_sysctl_init() now returns void instead of int. The ZfsArcStats->enabled flag is set inside the init function now, instead of having to be set from its return value. Preparation for more flag setting in Compressed ARC commit. ZfsArcMeter_readStats() added and all Meter->values[] setting moved to it, eliminating duplicated code in {darwin,freebsd,linux,solaris}/Platform.c. --- zfs/ZfsArcMeter.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zfs/ZfsArcMeter.h') diff --git a/zfs/ZfsArcMeter.h b/zfs/ZfsArcMeter.h index b89be223..c52083df 100644 --- a/zfs/ZfsArcMeter.h +++ b/zfs/ZfsArcMeter.h @@ -9,10 +9,14 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ +#include "ZfsArcStats.h" + #include "Meter.h" extern int ZfsArcMeter_attributes[]; +void ZfsArcMeter_readStats(Meter* this, ZfsArcStats* stats); + extern MeterClass ZfsArcMeter_class; #endif -- cgit v1.2.3