diff options
author | Nathan Scott <nathans@redhat.com> | 2023-05-02 09:02:22 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2023-05-08 13:06:07 +1000 |
commit | 0bdade1b6cb40c5bd374a93ac0489058a7421bb5 (patch) | |
tree | 0e0225f7dbf6867402c5ed3481a705d01941f42e /dragonflybsd/Platform.c | |
parent | e4ebe18b67c366d367231a1123b057c82018cf5b (diff) |
Introduce Machine class for host-specific info (split from ProcessList)
First stage in sanitizing the process list structure so that htop
can support other types of lists too (cgroups, filesystems, ...),
in the not-too-distant future.
This introduces struct Machine for system-wide information while
keeping process-list information in ProcessList (now much less).
Next step is to propogate this separation into each platform, to
match these core changes.
Diffstat (limited to 'dragonflybsd/Platform.c')
-rw-r--r-- | dragonflybsd/Platform.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 99527642..1c0ef0a4 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -172,8 +172,9 @@ int Platform_getMaxPid(void) { } double Platform_setCPUValues(Meter* this, unsigned int cpu) { - const DragonFlyBSDProcessList* fpl = (const DragonFlyBSDProcessList*) this->pl; - unsigned int cpus = this->pl->activeCPUs; + const Machine* host = this->host; + const DragonFlyBSDProcessList* fpl = (const DragonFlyBSDProcessList*) host->pl; + unsigned int cpus = this->host->activeCPUs; const CPUData* cpuData; if (cpus == 1) { @@ -188,7 +189,7 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) { v[CPU_METER_NICE] = cpuData->nicePercent; v[CPU_METER_NORMAL] = cpuData->userPercent; - if (this->pl->settings->detailedCPUTime) { + if (host->settings->detailedCPUTime) { v[CPU_METER_KERNEL] = cpuData->systemPercent; v[CPU_METER_IRQ] = cpuData->irqPercent; this->curItems = 4; @@ -209,7 +210,7 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) { void Platform_setMemoryValues(Meter* this) { // TODO - const ProcessList* pl = this->pl; + const ProcessList* pl = this->host->pl; this->total = pl->totalMem; this->values[MEMORY_METER_USED] = pl->usedMem; @@ -221,7 +222,7 @@ void Platform_setMemoryValues(Meter* this) { } void Platform_setSwapValues(Meter* this) { - const ProcessList* pl = this->pl; + const ProcessList* pl = this->host->pl; this->total = pl->totalSwap; this->values[SWAP_METER_USED] = pl->usedSwap; // mtr->values[SWAP_METER_CACHE] = "pages that are both in swap and RAM, like SwapCached on linux" |