htop is more flexible than top from procps. But recently I found a tiny inconvinience when htop display processes which use more than 10GB memory. Those processes use 6 characters in VIRT field, while normally it is 5 or less.
$ diff -urN Process.c.orig Process.c
--- Process.c.orig 2008-09-23 10:43:34.000000000 +0700
+++ Process.c 2009-02-07 23:21:57.000000000 +0700
@@ -205,8 +205,8 @@
static void Process_printLargeNumber(Process* this, RichString *str, unsigned long number) {
char buffer[11];
int len;
- if(number >= (1000 * ONE_M)) {
- len = snprintf(buffer, 10, "%4.2fG ", (float)number / ONE_M);
+ if(number >= (10 * ONE_M)) {
+ len = snprintf(buffer, 10, "%3.1fG ", (float)number / ONE_M);
RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
} else if(number >= (100000)) {
len = snprintf(buffer, 10, "%4ldM ", number / ONE_K);
After small modification above, now htop behaves 'properly'.
No comments:
Post a Comment