From 16d8cc7c38664e7470f767705fdb04428170c915 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Tue, 9 Jun 2015 00:08:06 +0100 Subject: [PATCH 1/2] Changed MemoryMeter and SwapMeter to use short memory sizes The MemoryMeter and SwapMeter now use the short GNU Coreutils style format to represent memory sizes. --- MemoryMeter.c | 2 +- SwapMeter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MemoryMeter.c b/MemoryMeter.c index 27ed0dc7..f1c1e357 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -26,7 +26,7 @@ int MemoryMeter_attributes[] = { static void MemoryMeter_setValues(Meter* this, char* buffer, int size) { Platform_setMemoryValues(this); - snprintf(buffer, size, "%ld/%ldMB", (long int) this->values[0] / 1024, (long int) this->total / 1024); + snprintf(buffer, size, "%ld/%ldM", (long int) this->values[0] / 1024, (long int) this->total / 1024); } static void MemoryMeter_display(Object* cast, RichString* out) { diff --git a/SwapMeter.c b/SwapMeter.c index b8bb1814..a19c0300 100644 --- a/SwapMeter.c +++ b/SwapMeter.c @@ -35,7 +35,7 @@ static void SwapMeter_humanNumber(char* buffer, const long int* value) { static void SwapMeter_setValues(Meter* this, char* buffer, int len) { Platform_setSwapValues(this); - snprintf(buffer, len, "%ld/%ldMB", (long int) this->values[0] / MEGABYTE, (long int) this->total / MEGABYTE); + snprintf(buffer, len, "%ld/%ldM", (long int) this->values[0] / MEGABYTE, (long int) this->total / MEGABYTE); } static void SwapMeter_display(Object* cast, RichString* out) { From 03826fbc54b47fbba4ee20e423ec20bb9d2b68e5 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Tue, 9 Jun 2015 00:11:43 +0100 Subject: [PATCH 2/2] Added information about memory sizes to man page The man page now contains the section "MEMORY SIZES" which talks about the convention used for representing memory sizes and why it was chosen. --- htop.1.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htop.1.in b/htop.1.in index 4908c806..ce11a5e0 100644 --- a/htop.1.in +++ b/htop.1.in @@ -353,6 +353,15 @@ You may override the location of the configuration file using the $HTOPRC environment variable (so you can have multiple configurations for different machines that share the same home directory, for example). +.SH "MEMORY SIZES" +.LP +Memory sizes in htop are displayed as they are in tools from the GNU Coreutils +(when ran with the --human-readable option). This means that sizes are printed +in powers of 1024. (e.g., 1023M = 1072693248 Bytes) +.LP +The decision to use this convention was made in order to conserve screen space +and make memory size representations consistent throughout htop. + .SH "SEE ALSO" proc(5), top(1), free(1), ps(1), uptime(1)