From 070fe90461182743fabb029415fc1bc59be14f3f Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Sun, 7 Jul 2019 02:37:02 +0000 Subject: ZFS arcstats for Linux If no pools are imported (ARC size == 0) or the ZFS module is not in the kernel (/proc/spl/kstat/zfs/arcstats does not exist), then the Meter reports "Unavailable". --- linux/Platform.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index ab90ca74..4e73c61e 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -21,6 +21,7 @@ in the source distribution for its full text. #include "UptimeMeter.h" #include "ClockMeter.h" #include "HostnameMeter.h" +#include "zfs/ZfsArcMeter.h" #include "LinuxProcess.h" #include @@ -126,6 +127,7 @@ MeterClass* Platform_meterTypes[] = { &LeftCPUs2Meter_class, &RightCPUs2Meter_class, &BlankMeter_class, + &ZfsArcMeter_class, NULL }; @@ -213,6 +215,23 @@ void Platform_setSwapValues(Meter* this) { this->values[0] = pl->usedSwap; } +void Platform_setZfsArcValues(Meter* this) { + LinuxProcessList* lpl = (LinuxProcessList*) this->pl; + + this->total = lpl->zfsArcMax; + this->values[0] = lpl->zfsArcMFU; + this->values[1] = lpl->zfsArcMRU; + this->values[2] = lpl->zfsArcAnon; + this->values[3] = lpl->zfsArcHeader; + this->values[4] = lpl->zfsArcOther; + + // "Hide" the last value so it can + // only be accessed by index and is not + // displayed by the Bar or Graph style + Meter_setItems(this, 5); + this->values[5] = lpl->memZfsArc; +} + char* Platform_getProcessEnv(pid_t pid) { char procname[32+1]; xSnprintf(procname, 32, "/proc/%d/environ", pid); -- cgit v1.2.3 From a88d2e313df7f5f2b781d5b14ffe0e7710018c10 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Sun, 7 Jul 2019 23:27:00 +0000 Subject: Refactor common OpenZFS sysctl access Darwin and FreeBSD export zfs kstats through the same APIs, so moving functions into a common file. --- linux/Platform.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index 4e73c61e..e2a3c6d3 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -218,18 +218,18 @@ void Platform_setSwapValues(Meter* this) { void Platform_setZfsArcValues(Meter* this) { LinuxProcessList* lpl = (LinuxProcessList*) this->pl; - this->total = lpl->zfsArcMax; - this->values[0] = lpl->zfsArcMFU; - this->values[1] = lpl->zfsArcMRU; - this->values[2] = lpl->zfsArcAnon; - this->values[3] = lpl->zfsArcHeader; - this->values[4] = lpl->zfsArcOther; + this->total = lpl->zfs.max; + this->values[0] = lpl->zfs.MFU; + this->values[1] = lpl->zfs.MRU; + this->values[2] = lpl->zfs.anon; + this->values[3] = lpl->zfs.header; + this->values[4] = lpl->zfs.other; // "Hide" the last value so it can // only be accessed by index and is not // displayed by the Bar or Graph style Meter_setItems(this, 5); - this->values[5] = lpl->memZfsArc; + this->values[5] = lpl->zfs.size; } char* Platform_getProcessEnv(pid_t pid) { -- 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. --- linux/Platform.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index e2a3c6d3..69f66880 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -218,18 +218,7 @@ void Platform_setSwapValues(Meter* this) { void Platform_setZfsArcValues(Meter* this) { LinuxProcessList* lpl = (LinuxProcessList*) this->pl; - this->total = lpl->zfs.max; - this->values[0] = lpl->zfs.MFU; - this->values[1] = lpl->zfs.MRU; - this->values[2] = lpl->zfs.anon; - this->values[3] = lpl->zfs.header; - this->values[4] = lpl->zfs.other; - - // "Hide" the last value so it can - // only be accessed by index and is not - // displayed by the Bar or Graph style - Meter_setItems(this, 5); - this->values[5] = lpl->zfs.size; + ZfsArcMeter_readStats(this, &(lpl->zfs)); } char* Platform_getProcessEnv(pid_t pid) { -- cgit v1.2.3 From 613556faebd16325da8c9057c81f39a2410d803f Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Tue, 3 Sep 2019 18:26:02 +0000 Subject: Support for ZFS Compressed ARC statistics --- linux/Platform.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index 69f66880..f7088cf4 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -22,6 +22,7 @@ in the source distribution for its full text. #include "ClockMeter.h" #include "HostnameMeter.h" #include "zfs/ZfsArcMeter.h" +#include "zfs/ZfsCompressedArcMeter.h" #include "LinuxProcess.h" #include @@ -128,6 +129,7 @@ MeterClass* Platform_meterTypes[] = { &RightCPUs2Meter_class, &BlankMeter_class, &ZfsArcMeter_class, + &ZfsCompressedArcMeter_class, NULL }; @@ -221,6 +223,11 @@ void Platform_setZfsArcValues(Meter* this) { ZfsArcMeter_readStats(this, &(lpl->zfs)); } +void Platform_setZfsCompressedArcValues(Meter* this) { + LinuxProcessList* lpl = (LinuxProcessList*) this->pl; + + ZfsCompressedArcMeter_readStats(this, &(lpl->zfs)); +} char* Platform_getProcessEnv(pid_t pid) { char procname[32+1]; xSnprintf(procname, 32, "/proc/%d/environ", pid); -- cgit v1.2.3