summaryrefslogtreecommitdiffstats
path: root/TasksMeter.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-05-02 09:02:22 +1000
committerNathan Scott <nathans@redhat.com>2023-05-08 13:06:07 +1000
commit0bdade1b6cb40c5bd374a93ac0489058a7421bb5 (patch)
tree0e0225f7dbf6867402c5ed3481a705d01941f42e /TasksMeter.c
parente4ebe18b67c366d367231a1123b057c82018cf5b (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 'TasksMeter.c')
-rw-r--r--TasksMeter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/TasksMeter.c b/TasksMeter.c
index 64c9837c..b5563fca 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -24,19 +24,20 @@ static const int TasksMeter_attributes[] = {
};
static void TasksMeter_updateValues(Meter* this) {
- const ProcessList* pl = this->pl;
+ const Machine* host = this->host;
+ const ProcessList* pl = host->pl;
this->values[0] = pl->kernelThreads;
this->values[1] = pl->userlandThreads;
this->values[2] = pl->totalTasks - pl->kernelThreads - pl->userlandThreads;
- this->values[3] = MINIMUM(pl->runningTasks, pl->activeCPUs);
+ this->values[3] = MINIMUM(pl->runningTasks, host->activeCPUs);
this->total = pl->totalTasks;
- xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%u/%u", MINIMUM(pl->runningTasks, pl->activeCPUs), pl->totalTasks);
+ xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%u/%u", MINIMUM(pl->runningTasks, host->activeCPUs), pl->totalTasks);
}
static void TasksMeter_display(const Object* cast, RichString* out) {
const Meter* this = (const Meter*)cast;
- const Settings* settings = this->pl->settings;
+ const Settings* settings = this->host->settings;
char buffer[20];
int len;

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