Merge branch 'hishamhm-pull-920'

This commit is contained in:
Nathan Scott
2020-08-20 18:24:35 +10:00
27 changed files with 727 additions and 26 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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