diff --git a/Action.c b/Action.c index 2fd0be764..698b15257 100644 --- a/Action.c +++ b/Action.c @@ -733,9 +733,9 @@ static Htop_Reaction actionHelp(State* st) { mvaddstr(line++, 0, "Memory bar: "); addattrstr(CRT_colors[BAR_BORDER], "["); addbartext(CRT_colors[MEMORY_USED], "", "used"); - addbartext(CRT_colors[MEMORY_BUFFERS_TEXT], "/", "buffers"); addbartext(CRT_colors[MEMORY_SHARED], "/", "shared"); addbartext(CRT_colors[MEMORY_COMPRESSED], "/", "compressed"); + addbartext(CRT_colors[MEMORY_BUFFERS_TEXT], "/", "buffers"); addbartext(CRT_colors[MEMORY_CACHE], "/", "cache"); addbartext(CRT_colors[BAR_SHADOW], " ", "used"); addbartext(CRT_colors[BAR_SHADOW], "/", "total"); diff --git a/MemoryMeter.c b/MemoryMeter.c index c7d99f885..3ddb04383 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -19,9 +19,9 @@ in the source distribution for its full text. static const int MemoryMeter_attributes[] = { MEMORY_USED, - MEMORY_BUFFERS, MEMORY_SHARED, MEMORY_COMPRESSED, + MEMORY_BUFFERS, MEMORY_CACHE }; @@ -66,10 +66,6 @@ static void MemoryMeter_display(const Object* cast, RichString* out) { RichString_appendAscii(out, CRT_colors[METER_TEXT], " used:"); RichString_appendAscii(out, CRT_colors[MEMORY_USED], buffer); - Meter_humanUnit(buffer, this->values[MEMORY_METER_BUFFERS], sizeof(buffer)); - RichString_appendAscii(out, CRT_colors[METER_TEXT], " buffers:"); - RichString_appendAscii(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer); - /* shared memory is not supported on all platforms */ if (isNonnegative(this->values[MEMORY_METER_SHARED])) { Meter_humanUnit(buffer, this->values[MEMORY_METER_SHARED], sizeof(buffer)); @@ -84,6 +80,10 @@ static void MemoryMeter_display(const Object* cast, RichString* out) { RichString_appendAscii(out, CRT_colors[MEMORY_COMPRESSED], buffer); } + Meter_humanUnit(buffer, this->values[MEMORY_METER_BUFFERS], sizeof(buffer)); + RichString_appendAscii(out, CRT_colors[METER_TEXT], " buffers:"); + RichString_appendAscii(out, CRT_colors[MEMORY_BUFFERS_TEXT], buffer); + Meter_humanUnit(buffer, this->values[MEMORY_METER_CACHE], sizeof(buffer)); RichString_appendAscii(out, CRT_colors[METER_TEXT], " cache:"); RichString_appendAscii(out, CRT_colors[MEMORY_CACHE], buffer); diff --git a/MemoryMeter.h b/MemoryMeter.h index b6568afca..e39b3bd38 100644 --- a/MemoryMeter.h +++ b/MemoryMeter.h @@ -11,9 +11,9 @@ in the source distribution for its full text. typedef enum { MEMORY_METER_USED = 0, - MEMORY_METER_BUFFERS = 1, - MEMORY_METER_SHARED = 2, - MEMORY_METER_COMPRESSED = 3, + MEMORY_METER_SHARED = 1, + MEMORY_METER_COMPRESSED = 2, + MEMORY_METER_BUFFERS = 3, MEMORY_METER_CACHE = 4, MEMORY_METER_AVAILABLE = 5, MEMORY_METER_ITEMCOUNT = 6, // number of entries in this enum diff --git a/darwin/Platform.c b/darwin/Platform.c index 6a9c21847..f72f8aece 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -292,9 +292,9 @@ void Platform_setMemoryValues(Meter* mtr) { mtr->total = dhost->host_info.max_mem / 1024; mtr->values[MEMORY_METER_USED] = (double)(vm->active_count + vm->wire_count) * page_K; - mtr->values[MEMORY_METER_BUFFERS] = (double)vm->purgeable_count * page_K; // mtr->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" // mtr->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + mtr->values[MEMORY_METER_BUFFERS] = (double)vm->purgeable_count * page_K; mtr->values[MEMORY_METER_CACHE] = (double)vm->inactive_count * page_K; // mtr->values[MEMORY_METER_AVAILABLE] = "available memory" } diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index d94d7a18e..ff2300aaa 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -214,9 +214,9 @@ void Platform_setMemoryValues(Meter* this) { this->total = host->totalMem; this->values[MEMORY_METER_USED] = host->usedMem; - this->values[MEMORY_METER_BUFFERS] = host->buffersMem; // this->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" - // mtr->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + // this->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_CACHE] = host->cachedMem; // this->values[MEMORY_METER_AVAILABLE] = "available memory" } diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 9b8981adf..9be7195e5 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -229,9 +229,9 @@ void Platform_setMemoryValues(Meter* this) { this->total = host->totalMem; this->values[MEMORY_METER_USED] = host->usedMem; - this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_SHARED] = host->sharedMem; // this->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_CACHE] = host->cachedMem; // this->values[MEMORY_METER_AVAILABLE] = "available memory" diff --git a/linux/Platform.c b/linux/Platform.c index 65f7558e0..fbbedc6ef 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -360,9 +360,9 @@ void Platform_setMemoryValues(Meter* this) { this->total = host->totalMem; this->values[MEMORY_METER_USED] = host->usedMem; - this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_SHARED] = host->sharedMem; this->values[MEMORY_METER_COMPRESSED] = 0; /* compressed */ + this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_CACHE] = host->cachedMem; this->values[MEMORY_METER_AVAILABLE] = host->availableMem; diff --git a/netbsd/Platform.c b/netbsd/Platform.c index 8231cdfd2..5b09ed163 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -272,9 +272,9 @@ void Platform_setMemoryValues(Meter* this) { const Machine* host = this->host; this->total = host->totalMem; this->values[MEMORY_METER_USED] = host->usedMem; - this->values[MEMORY_METER_BUFFERS] = host->buffersMem; // this->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" // this->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_CACHE] = host->cachedMem; // this->values[MEMORY_METER_AVAILABLE] = "available memory" } diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 267da7034..b41900b03 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -229,9 +229,9 @@ void Platform_setMemoryValues(Meter* this) { usedMem -= buffersMem + cachedMem; this->total = host->totalMem; this->values[MEMORY_METER_USED] = usedMem; - this->values[MEMORY_METER_BUFFERS] = buffersMem; // this->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" // this->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + this->values[MEMORY_METER_BUFFERS] = buffersMem; this->values[MEMORY_METER_CACHE] = cachedMem; // this->values[MEMORY_METER_AVAILABLE] = "available memory" } diff --git a/solaris/Platform.c b/solaris/Platform.c index 5117a4487..c4b121c79 100644 --- a/solaris/Platform.c +++ b/solaris/Platform.c @@ -240,9 +240,9 @@ void Platform_setMemoryValues(Meter* this) { const Machine* host = this->host; this->total = host->totalMem; this->values[MEMORY_METER_USED] = host->usedMem; - this->values[MEMORY_METER_BUFFERS] = host->buffersMem; // this->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" // this->values[MEMORY_METER_COMPRESSED] = "compressed memory, like zswap on linux" + this->values[MEMORY_METER_BUFFERS] = host->buffersMem; this->values[MEMORY_METER_CACHE] = host->cachedMem; // this->values[MEMORY_METER_AVAILABLE] = "available memory" }