diff options
author | Nathan Scott <nathans@redhat.com> | 2020-08-20 18:24:35 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2020-08-20 18:24:35 +1000 |
commit | 9a55efc8b52578a9465c5fd4d82c44ad48a16018 (patch) | |
tree | a3ffdebe913e85ffde0f183f1209b11082a8c056 /darwin | |
parent | 31391b206c536cdcd46c335b58ea6ecf6deeba1f (diff) | |
parent | a267003f2f38df5d52ae3f07658c1bbd20b5fb5e (diff) |
Merge branch 'hishamhm-pull-920'3.0.0rc1
Diffstat (limited to 'darwin')
-rw-r--r-- | darwin/DarwinProcessList.c | 12 | ||||
-rw-r--r-- | darwin/DarwinProcessList.h | 14 | ||||
-rw-r--r-- | darwin/Platform.c | 16 | ||||
-rw-r--r-- | darwin/Platform.h | 4 |
4 files changed, 45 insertions, 1 deletions
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c index 09884480..9b4ba119 100644 --- a/darwin/DarwinProcessList.c +++ b/darwin/DarwinProcessList.c @@ -9,6 +9,8 @@ in the source distribution for its full text. #include "DarwinProcess.h" #include "DarwinProcessList.h" #include "CRT.h" +#include "zfs/ZfsArcStats.h" +#include "zfs/openzfs_sysctl.h" #include <stdlib.h> #include <string.h> @@ -54,6 +56,7 @@ int CompareKernelVersion(short int major, short int minor, short int component) /*{ #include "ProcessList.h" +#include "zfs/ZfsArcStats.h" #include <mach/mach_host.h> #include <sys/sysctl.h> @@ -67,6 +70,8 @@ typedef struct DarwinProcessList_ { uint64_t kernel_threads; uint64_t user_threads; uint64_t global_diff; + + ZfsArcStats zfs; } DarwinProcessList; }*/ @@ -131,8 +136,8 @@ struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) { return processes; } - ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { + size_t len; DarwinProcessList* this = xCalloc(1, sizeof(DarwinProcessList)); ProcessList_init(&this->super, Class(Process), usersTable, pidWhiteList, userId); @@ -145,6 +150,10 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui /* Initialize the VM statistics */ ProcessList_getVMStats(&this->vm_stats); + /* Initialize the ZFS kstats, if zfs.kext loaded */ + openzfs_sysctl_init(&this->zfs); + openzfs_sysctl_updateArcStats(&this->zfs); + this->super.kernelThreads = 0; this->super.userlandThreads = 0; this->super.totalTasks = 0; @@ -173,6 +182,7 @@ void ProcessList_goThroughEntries(ProcessList* super) { dpl->prev_load = dpl->curr_load; ProcessList_allocateCPULoadInfo(&dpl->curr_load); ProcessList_getVMStats(&dpl->vm_stats); + openzfs_sysctl_updateArcStats(&dpl->zfs); /* Get the time difference */ dpl->global_diff = 0; diff --git a/darwin/DarwinProcessList.h b/darwin/DarwinProcessList.h index c216a804..73fbd34f 100644 --- a/darwin/DarwinProcessList.h +++ b/darwin/DarwinProcessList.h @@ -9,7 +9,19 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ +struct kern; + +void GetKernelVersion(struct kern *k); + +/* compare the given os version with the one installed returns: +0 if equals the installed version +positive value if less than the installed version +negative value if more than the installed version +*/ +int CompareKernelVersion(short int major, short int minor, short int component); + #include "ProcessList.h" +#include "zfs/ZfsArcStats.h" #include <mach/mach_host.h> #include <sys/sysctl.h> @@ -23,6 +35,8 @@ typedef struct DarwinProcessList_ { uint64_t kernel_threads; uint64_t user_threads; uint64_t global_diff; + + ZfsArcStats zfs; } DarwinProcessList; diff --git a/darwin/Platform.c b/darwin/Platform.c index a052ea8a..26e84112 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -15,6 +15,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 "DarwinProcessList.h" #include <stdlib.h> @@ -117,6 +119,8 @@ MeterClass* Platform_meterTypes[] = { &RightCPUsMeter_class, &LeftCPUs2Meter_class, &RightCPUs2Meter_class, + &ZfsArcMeter_class, + &ZfsCompressedArcMeter_class, &BlankMeter_class, NULL }; @@ -243,6 +247,18 @@ void Platform_setSwapValues(Meter* mtr) { mtr->values[0] = swapused.xsu_used / 1024; } +void Platform_setZfsArcValues(Meter* this) { + DarwinProcessList* dpl = (DarwinProcessList*) this->pl; + + ZfsArcMeter_readStats(this, &(dpl->zfs)); +} + +void Platform_setZfsCompressedArcValues(Meter* this) { + DarwinProcessList* dpl = (DarwinProcessList*) this->pl; + + ZfsCompressedArcMeter_readStats(this, &(dpl->zfs)); +} + char* Platform_getProcessEnv(pid_t pid) { char* env = NULL; diff --git a/darwin/Platform.h b/darwin/Platform.h index 1231217b..e17661d6 100644 --- a/darwin/Platform.h +++ b/darwin/Platform.h @@ -48,6 +48,10 @@ void Platform_setMemoryValues(Meter* mtr); void Platform_setSwapValues(Meter* mtr); +void Platform_setZfsArcValues(Meter* this); + +void Platform_setZfsCompressedArcValues(Meter* this); + char* Platform_getProcessEnv(pid_t pid); #endif |