summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorRoss Williams <ross@ross-williams.net>2019-09-03 18:26:02 +0000
committerRoss Williams <ross@ross-williams.net>2019-09-03 18:44:19 +0000
commit613556faebd16325da8c9057c81f39a2410d803f (patch)
tree306b082cf7a0e28878dec4f2097eed842963674b /linux
parente450b586368750e771746ef3e2f5a070962dfd28 (diff)
Support for ZFS Compressed ARC statistics
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcessList.c10
-rw-r--r--linux/Platform.c7
-rw-r--r--linux/Platform.h2
3 files changed, 19 insertions, 0 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 3e889104..4596c3bc 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -984,9 +984,14 @@ static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
char buffer[128];
while (fgets(buffer, 128, file)) {
#define tryRead(label, variable) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %*2u %32llu", variable)) { break; } } while(0)
+ #define tryReadFlag(label, variable, flag) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %*2u %32llu", variable)) { flag = 1; break; } else { flag = 0; } } while(0)
switch (buffer[0]) {
case 'c':
tryRead("c_max", &lpl->zfs.max);
+ tryReadFlag("compressed", &lpl->zfs.compressed, &lpl->zfs.isCompressed);
+ break;
+ case 'u':
+ tryRead("uncompressed", &lpl->zfs.uncompressed);
break;
case 's':
tryRead("size", &lpl->zfs.size);
@@ -1010,6 +1015,7 @@ static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
break;
}
#undef tryRead
+ #undef tryReadFlag
}
fclose(file);
@@ -1021,6 +1027,10 @@ static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
lpl->zfs.anon /= 1024;
lpl->zfs.header /= 1024;
lpl->zfs.other = (dbufSize + dnodeSize + bonusSize) / 1024;
+ if ( lpl->zfs.isCompressed ) {
+ lpl->zfs.compressed /= 1024;
+ lpl->zfs.uncompressed /= 1024;
+ }
}
static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
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 <math.h>
@@ -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);
diff --git a/linux/Platform.h b/linux/Platform.h
index e775181e..5d85eb36 100644
--- a/linux/Platform.h
+++ b/linux/Platform.h
@@ -45,6 +45,8 @@ void Platform_setSwapValues(Meter* this);
void Platform_setZfsArcValues(Meter* this);
+void Platform_setZfsCompressedArcValues(Meter* this);
+
char* Platform_getProcessEnv(pid_t pid);
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy