summaryrefslogtreecommitdiffstats
path: root/solaris
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-08-20 18:24:35 +1000
committerNathan Scott <nathans@redhat.com>2020-08-20 18:24:35 +1000
commit9a55efc8b52578a9465c5fd4d82c44ad48a16018 (patch)
treea3ffdebe913e85ffde0f183f1209b11082a8c056 /solaris
parent31391b206c536cdcd46c335b58ea6ecf6deeba1f (diff)
parenta267003f2f38df5d52ae3f07658c1bbd20b5fb5e (diff)
Merge branch 'hishamhm-pull-920'3.0.0rc1
Diffstat (limited to 'solaris')
-rw-r--r--solaris/Platform.c16
-rw-r--r--solaris/Platform.h4
-rw-r--r--solaris/SolarisProcessList.c47
-rw-r--r--solaris/SolarisProcessList.h3
4 files changed, 70 insertions, 0 deletions
diff --git a/solaris/Platform.c b/solaris/Platform.c
index 1322598e..092f4507 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -17,6 +17,8 @@ in the source distribution for its full text.
#include "ClockMeter.h"
#include "HostnameMeter.h"
#include "UptimeMeter.h"
+#include "zfs/ZfsArcMeter.h"
+#include "zfs/ZfsCompressedArcMeter.h"
#include "SolarisProcess.h"
#include "SolarisProcessList.h"
@@ -122,6 +124,8 @@ MeterClass* Platform_meterTypes[] = {
&RightCPUsMeter_class,
&LeftCPUs2Meter_class,
&RightCPUs2Meter_class,
+ &ZfsArcMeter_class,
+ &ZfsCompressedArcMeter_class,
&BlankMeter_class,
NULL
};
@@ -223,6 +227,18 @@ void Platform_setSwapValues(Meter* this) {
this->values[0] = pl->usedSwap;
}
+void Platform_setZfsArcValues(Meter* this) {
+ SolarisProcessList* spl = (SolarisProcessList*) this->pl;
+
+ ZfsArcMeter_readStats(this, &(spl->zfs));
+}
+
+void Platform_setZfsCompressedArcValues(Meter* this) {
+ SolarisProcessList* spl = (SolarisProcessList*) this->pl;
+
+ ZfsCompressedArcMeter_readStats(this, &(spl->zfs));
+}
+
static int Platform_buildenv(void *accum, struct ps_prochandle *Phandle, uintptr_t addr, const char *str) {
envAccum *accump = accum;
(void) Phandle;
diff --git a/solaris/Platform.h b/solaris/Platform.h
index ffec60c9..dd1962dd 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -60,6 +60,10 @@ void Platform_setMemoryValues(Meter* this);
void Platform_setSwapValues(Meter* this);
+void Platform_setZfsArcValues(Meter* this);
+
+void Platform_setZfsCompressedArcValues(Meter* this);
+
char* Platform_getProcessEnv(pid_t pid);
#endif
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index 15ae44bc..8faa49f3 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -29,6 +29,8 @@ in the source distribution for its full text.
#define UZONE "unknown "
/*{
+#include "zfs/ZfsArcStats.h"
+
#include <kstat.h>
#include <sys/param.h>
#include <sys/uio.h>
@@ -57,6 +59,7 @@ typedef struct SolarisProcessList_ {
ProcessList super;
kstat_ctl_t* kd;
CPUData* cpus;
+ ZfsArcStats zfs;
} SolarisProcessList;
}*/
@@ -232,6 +235,49 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
pl->usedSwap = pl->totalSwap - (totalfree * PAGE_SIZE_KB);
}
+static inline void SolarisProcessList_scanZfsArcstats(ProcessList* pl) {
+ SolarisProcessList* spl = (SolarisProcessList*) pl;
+ kstat_t *arcstats = NULL;
+ int ksrphyserr = -1;
+ kstat_named_t *cur_kstat = NULL;
+
+ if (spl->kd != NULL) { arcstats = kstat_lookup(spl->kd,"zfs",0,"arcstats"); }
+ if (arcstats != NULL) { ksrphyserr = kstat_read(spl->kd,arcstats,NULL); }
+ if (ksrphyserr != -1) {
+ cur_kstat = kstat_data_lookup( arcstats, "size" );
+ spl->zfs.size = cur_kstat->value.ui64 / 1024;
+ spl->zfs.enabled = spl->zfs.size > 0 ? 1 : 0;
+
+ cur_kstat = kstat_data_lookup( arcstats, "c_max" );
+ spl->zfs.max = cur_kstat->value.ui64 / 1024;
+
+ cur_kstat = kstat_data_lookup( arcstats, "mfu_size" );
+ spl->zfs.MFU = cur_kstat->value.ui64 / 1024;
+
+ cur_kstat = kstat_data_lookup( arcstats, "mru_size" );
+ spl->zfs.MRU = cur_kstat->value.ui64 / 1024;
+
+ cur_kstat = kstat_data_lookup( arcstats, "anon_size" );
+ spl->zfs.anon = cur_kstat->value.ui64 / 1024;
+
+ cur_kstat = kstat_data_lookup( arcstats, "hdr_size" );
+ spl->zfs.header = cur_kstat->value.ui64 / 1024;
+
+ cur_kstat = kstat_data_lookup( arcstats, "other_size" );
+ spl->zfs.other = cur_kstat->value.ui64 / 1024;
+
+ if ((cur_kstat = kstat_data_lookup( arcstats, "compressed_size" )) != NULL) {
+ spl->zfs.compressed = cur_kstat->value.ui64 / 1024;
+ spl->zfs.isCompressed = 1;
+
+ cur_kstat = kstat_data_lookup( arcstats, "uncompressed_size" );
+ spl->zfs.uncompressed = cur_kstat->value.ui64 / 1024;
+ } else {
+ spl->zfs.isCompressed = 0;
+ }
+ }
+}
+
void ProcessList_delete(ProcessList* pl) {
SolarisProcessList* spl = (SolarisProcessList*) pl;
ProcessList_done(pl);
@@ -369,6 +415,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
void ProcessList_goThroughEntries(ProcessList* this) {
SolarisProcessList_scanCPUTime(this);
SolarisProcessList_scanMemoryInfo(this);
+ SolarisProcessList_scanZfsArcstats(this);
this->kernelThreads = 1;
proc_walk(&SolarisProcessList_walkproc, this, PR_WALK_LWP);
}
diff --git a/solaris/SolarisProcessList.h b/solaris/SolarisProcessList.h
index 8388fabe..06c1330e 100644
--- a/solaris/SolarisProcessList.h
+++ b/solaris/SolarisProcessList.h
@@ -15,6 +15,8 @@ in the source distribution for its full text.
#define GZONE "global "
#define UZONE "unknown "
+#include "zfs/ZfsArcStats.h"
+
#include <kstat.h>
#include <sys/param.h>
#include <sys/uio.h>
@@ -43,6 +45,7 @@ typedef struct SolarisProcessList_ {
ProcessList super;
kstat_ctl_t* kd;
CPUData* cpus;
+ ZfsArcStats zfs;
} SolarisProcessList;

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