diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2000-03-18 08:07:04 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2000-03-18 08:07:04 +0000 |
commit | 0ec6be5c5334768655395a3f6a3c6ed38c380e8d (patch) | |
tree | bd22e3f198447c32b0c100b33bcd140ff73eec09 /lcd4linux.c | |
parent | db5e3666b5a2e9d3e35ada41ebf0a1a2e0897e53 (diff) | |
download | lcd4linux-0ec6be5c5334768655395a3f6a3c6ed38c380e8d.tar.gz |
[lcd4linux @ 2000-03-18 08:07:04 by reinelt]
vertical bars implemented
bar compaction improved
memory information implemented
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@12 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r-- | lcd4linux.c | 53 | ||||
-rw-r--r-- | lcd4linux.conf.sample | 18 |
2 files changed, 42 insertions, 29 deletions
diff --git a/lcd4linux.c b/lcd4linux.c index 9a264dc..9797d9e 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.4 2000/03/17 09:21:42 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.5 2000/03/18 08:07:04 reinelt Exp $ * * LCD4Linux * @@ -20,6 +20,12 @@ * * * $Log: lcd4linux.c,v $ + * Revision 1.5 2000/03/18 08:07:04 reinelt + * + * vertical bars implemented + * bar compaction improved + * memory information implemented + * * Revision 1.4 2000/03/17 09:21:42 reinelt * * various memory statistics added @@ -34,7 +40,6 @@ * * first unstable but running release * - * */ #include <stdlib.h> @@ -250,14 +255,9 @@ void print_token (int token, char **p) case T_MEM_APP: *p+=sprintf (*p, "%6.0f", query(token)); break; - case T_CPU_USER: - case T_CPU_NICE: - case T_CPU_SYSTEM: - case T_CPU_BUSY: - case T_CPU_IDLE: - *p+=sprintf (*p, "%3.0f", 100.0*query(token)); - break; - default: + case T_LOAD_1: + case T_LOAD_2: + case T_LOAD_3: val=query(token); if (val<10.0) { *p+=sprintf (*p, "%4.2f", val); @@ -266,6 +266,25 @@ void print_token (int token, char **p) } else { *p+=sprintf (*p, "%4.0f", val); } + break; + case T_CPU_USER: + case T_CPU_NICE: + case T_CPU_SYSTEM: + case T_CPU_BUSY: + case T_CPU_IDLE: + *p+=sprintf (*p, "%3.0f", 100.0*query(token)); + break; + case T_ISDN_IN: + case T_ISDN_OUT: + case T_ISDN_MAX: + case T_ISDN_TOTAL: + if (isdn.usage) + *p+=sprintf (*p, "%4.0f", query(token)); + else + *p+=sprintf (*p, "----"); + break; + default: + *p+=sprintf (*p, "%4.0f", query(token)); } } @@ -283,13 +302,14 @@ char *process_row (int r, char *s) int type=*++s; int len=*++s; double val1=query_bar(*(unsigned char*)++s); - double val2; + double val2=val1; if (type & (BAR_H2 | BAR_V2)) val2=query_bar(*(unsigned char*)++s); + if (type & BAR_H) + lcd_bar (type, r, p-buffer+1, len*xres, val1*len*xres, val2*len*xres); else - val2=val1; - lcd_bar (type, r, p-buffer+1, len*xres, val1*len*xres, val2*len*xres); - + lcd_bar (type, r, p-buffer+1, len*yres, val1*len*yres, val2*len*yres); + if (type & BAR_H) { for (i=0; i<len && p-buffer<cols; i++) *p++='\t'; @@ -313,7 +333,7 @@ void main (int argc, char *argv[]) char *display; char *row[ROWS]; int i, smooth; - + if (argc>2) { usage(); exit (2); @@ -360,7 +380,6 @@ void main (int argc, char *argv[]) } lcd_clear(); - lcd_put (1, 1, "** LCD4Linux V" VERSION " **"); lcd_put (2, 1, " (c) 2000 M.Reinelt"); lcd_flush(); @@ -379,6 +398,6 @@ void main (int argc, char *argv[]) lcd_flush(); smooth+=tick; if (smooth>tack) smooth=0; - usleep(1000*tick); + usleep(tick*1000); } } diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 799dc35..69e6a53 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -8,21 +8,15 @@ Contrast 160 #Row3 "Busy %cu%% $r10cs+cb" #Row4 "Load %l1%L$r10l1" -Row1 "CPU %cu%% $r10cs+cb" -Row2 "%mf %ms %ma" -#Row2 "Disk %dm $R10dr+dw" +Row1 "Load %l1%L$r10cs+cb" +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" +#Row1 "$u3l1$u3cb$u3cs $u3mu$u3ma$u3ms $u3dr$u3dw $u3nr$u3nw $u3ii$u3io" +#Row2 " " +#Row3 " " +#Row4 "CPU MEM IO IP" Tick 100 Tack 400 |