diff options
author | Ross Williams <ross@ross-williams.net> | 2019-09-03 18:21:33 +0000 |
---|---|---|
committer | Ross Williams <ross@ross-williams.net> | 2019-09-03 18:21:33 +0000 |
commit | e450b586368750e771746ef3e2f5a070962dfd28 (patch) | |
tree | 5501777912872ee233b6c9b60a26dd4906a6b4a7 /darwin | |
parent | ff6914e4ad4b78749bcee5471a33ef206b0a7d03 (diff) |
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.
Diffstat (limited to 'darwin')
-rw-r--r-- | darwin/DarwinProcessList.c | 2 | ||||
-rw-r--r-- | darwin/Platform.c | 13 |
2 files changed, 2 insertions, 13 deletions
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c index 122e0188..9b4ba119 100644 --- a/darwin/DarwinProcessList.c +++ b/darwin/DarwinProcessList.c @@ -151,7 +151,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui ProcessList_getVMStats(&this->vm_stats); /* Initialize the ZFS kstats, if zfs.kext loaded */ - this->zfs.enabled = openzfs_sysctl_init(); + openzfs_sysctl_init(&this->zfs); openzfs_sysctl_updateArcStats(&this->zfs); this->super.kernelThreads = 0; diff --git a/darwin/Platform.c b/darwin/Platform.c index 8fbb9c93..f9f09b5a 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -246,18 +246,7 @@ void Platform_setSwapValues(Meter* mtr) { void Platform_setZfsArcValues(Meter* this) { DarwinProcessList* dpl = (DarwinProcessList*) this->pl; - this->total = dpl->zfs.max; - this->values[0] = dpl->zfs.MFU; - this->values[1] = dpl->zfs.MRU; - this->values[2] = dpl->zfs.anon; - this->values[3] = dpl->zfs.header; - this->values[4] = dpl->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] = dpl->zfs.size; + ZfsArcMeter_readStats(this, &(dpl->zfs)); } char* Platform_getProcessEnv(pid_t pid) { |