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".
This commit is contained in:
Ross Williams
2019-07-07 02:37:02 +00:00
parent a93edde1a2
commit 070fe90461
6 changed files with 130 additions and 23 deletions

View File

@ -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 <math.h>
@ -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);