diff options
Diffstat (limited to '')
-rw-r--r-- | lcd4linux.c | 55 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 25 |
2 files changed, 69 insertions, 11 deletions
diff --git a/lcd4linux.c b/lcd4linux.c index 383dc45..9a264dc 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.3 2000/03/13 15:58:24 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.4 2000/03/17 09:21:42 reinelt Exp $ * * LCD4Linux * @@ -20,6 +20,10 @@ * * * $Log: lcd4linux.c,v $ + * Revision 1.4 2000/03/17 09:21:42 reinelt + * + * various memory statistics added + * * Revision 1.3 2000/03/13 15:58:24 reinelt * * release 0.9 @@ -51,6 +55,7 @@ double overload; int tick, tack, tau; int rows, cols, xres, yres, supported_bars; +struct { int total, used, free, shared, buffer, cache, apps; } ram; struct { double load1, load2, load3, overload; } load; struct { double user, nice, system, idle; } busy; struct { int read, write, total, max, peak; } disk; @@ -65,8 +70,12 @@ static void usage(void) static void collect_data (void) { - Busy (&busy.user, &busy.nice, &busy.system, &busy.idle); + Ram (&ram.total, &ram.free, &ram.shared, &ram.buffer, &ram.cache); + ram.used=ram.total-ram.free; + ram.apps=ram.used-ram.buffer-ram.cache; + Load (&load.load1, &load.load2, &load.load3); + Busy (&busy.user, &busy.nice, &busy.system, &busy.idle); Disk (&disk.read, &disk.write); disk.total=disk.read+disk.write; @@ -88,6 +97,21 @@ static double query (int token) { switch (token) { + case T_MEM_TOTAL: + return ram.total; + case T_MEM_USED: + return ram.used; + case T_MEM_FREE: + return ram.free; + case T_MEM_SHARED: + return ram.shared; + case T_MEM_BUFFER: + return ram.buffer; + case T_MEM_CACHE: + return ram.cache; + case T_MEM_APP: + return ram.apps; + case T_LOAD_1: return load.load1; case T_LOAD_2: @@ -151,6 +175,16 @@ static double query_bar (int token) double value=query(token); switch (token) { + + case T_MEM_TOTAL: + case T_MEM_USED: + case T_MEM_FREE: + case T_MEM_SHARED: + case T_MEM_BUFFER: + case T_MEM_CACHE: + case T_MEM_APP: + return value/ram.total; + case T_LOAD_1: case T_LOAD_2: case T_LOAD_3: @@ -207,6 +241,15 @@ void print_token (int token, char **p) case T_OVERLOAD: *(*p)++=load.load1>load.overload?'!':' '; break; + case T_MEM_TOTAL: + case T_MEM_USED: + case T_MEM_FREE: + case T_MEM_SHARED: + case T_MEM_BUFFER: + case T_MEM_CACHE: + case T_MEM_APP: + *p+=sprintf (*p, "%6.0f", query(token)); + break; case T_CPU_USER: case T_CPU_NICE: case T_CPU_SYSTEM: @@ -247,9 +290,13 @@ char *process_row (int r, char *s) val2=val1; lcd_bar (type, r, p-buffer+1, len*xres, val1*len*xres, val2*len*xres); - for (i=0; i<len && p-buffer<cols; i++) + if (type & BAR_H) { + for (i=0; i<len && p-buffer<cols; i++) + *p++='\t'; + } else { *p++='\t'; - + } + } else { *p++=*s; } diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 4970c9b..799dc35 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -3,23 +3,34 @@ Port /dev/ttyS2 Speed 19200 Contrast 160 -#Row1 "*** %o %r ***" -#Row2 "%p CPU %m MB RAM" -#Row3 "Busy %cu%% $r10cs" +#Row1 "*** %o %v ***" +#Row2 "%p CPU %r MB RAM" +#Row3 "Busy %cu%% $r10cs+cb" #Row4 "Load %l1%L$r10l1" -Row1 "Busy %cb%% $r10cs+cb" -Row2 "Disk %dm $R10dr+dw" +Row1 "CPU %cu%% $r10cs+cb" +Row2 "%mf %ms %ma" +#Row2 "Disk %dm $R10dr+dw" Row3 "Net %nm $R10nr+nw" Row4 "ISDN %im $r10ii+io" +#Row1 "CPU $l6cs+cb$R6dr+dw I/O" +#Row2 "I/O $R16dr+dw" +#Row3 "LAN $R16nr+nw" +#Row4 "WAN $r16ii+io" + +#Row1 "" +#Row2 "" +#Row3 "$u3cs $u3cb " +#Row4 "CPU I/O LAN WAN" + Tick 100 Tack 400 Tau 500 Overload 2.0 -Fifo /var/run/lcd4linux - Sensor1 /proc/sys/dev/sensors/w83781d-isa-0290/temp2 Sensor1_min 30 Sensor1_max 50 + +Fifo /var/run/lcd4linux |