aboutsummaryrefslogtreecommitdiffstats
path: root/linux/HugePageMeter.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/HugePageMeter.c')
-rw-r--r--linux/HugePageMeter.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/linux/HugePageMeter.c b/linux/HugePageMeter.c
index 1efde2f..058ab4b 100644
--- a/linux/HugePageMeter.c
+++ b/linux/HugePageMeter.c
@@ -5,6 +5,8 @@ Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
+#include "config.h" // IWYU pragma: keep
+
#include "linux/HugePageMeter.h"
#include <assert.h>
@@ -12,11 +14,11 @@ in the source distribution for its full text.
#include <stddef.h>
#include "CRT.h"
+#include "Machine.h"
#include "Macros.h"
#include "Object.h"
-#include "ProcessList.h"
#include "RichString.h"
-#include "linux/LinuxProcessList.h"
+#include "linux/LinuxMachine.h"
static const char* HugePageMeter_active_labels[4] = { NULL, NULL, NULL, NULL };
@@ -43,8 +45,8 @@ static void HugePageMeter_updateValues(Meter* this) {
memory_t usedTotal = 0;
unsigned nextUsed = 0;
- const LinuxProcessList* lpl = (const LinuxProcessList*) this->pl;
- this->total = lpl->totalHugePageMem;
+ const LinuxMachine* host = (const LinuxMachine*) this->host;
+ this->total = host->totalHugePageMem;
this->values[0] = 0;
HugePageMeter_active_labels[0] = " used:";
for (unsigned i = 1; i < ARRAYSIZE(HugePageMeter_active_labels); i++) {
@@ -52,7 +54,7 @@ static void HugePageMeter_updateValues(Meter* this) {
HugePageMeter_active_labels[i] = NULL;
}
for (unsigned i = 0; i < HTOP_HUGEPAGE_COUNT; i++) {
- memory_t value = lpl->usedHugePageMem[i];
+ memory_t value = host->usedHugePageMem[i];
if (value != MEMORY_MAX) {
this->values[nextUsed] = value;
usedTotal += value;
@@ -80,7 +82,7 @@ static void HugePageMeter_display(const Object* cast, RichString* out) {
RichString_appendAscii(out, CRT_colors[METER_VALUE], buffer);
for (unsigned i = 0; i < ARRAYSIZE(HugePageMeter_active_labels); i++) {
- if (isnan(this->values[i])) {
+ if (!HugePageMeter_active_labels[i]) {
break;
}
RichString_appendAscii(out, CRT_colors[METER_TEXT], HugePageMeter_active_labels[i]);

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