[2] | 1 | /* |
---|
| 2 | * $Source: /afs/dev.mit.edu/source/repository/athena/bin/mon/display.c,v $ |
---|
| 3 | * $Author: dgg $ |
---|
| 4 | * $Locker: $ |
---|
| 5 | * $Header: /afs/dev.mit.edu/source/repository/athena/bin/mon/display.c,v 1.1 1984-12-13 12:00:27 dgg Exp $ |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef lint |
---|
| 9 | static char *rcsid_display_c = "$Header: /afs/dev.mit.edu/source/repository/athena/bin/mon/display.c,v 1.1 1984-12-13 12:00:27 dgg Exp $"; |
---|
| 10 | #endif lint |
---|
| 11 | |
---|
| 12 | /* |
---|
| 13 | * D I S P L A Y . C |
---|
| 14 | * |
---|
| 15 | * This section handles the display initialization and updates for "mon" |
---|
| 16 | */ |
---|
| 17 | #include "mon.h" |
---|
| 18 | #include <curses.h> |
---|
| 19 | |
---|
| 20 | #define HOSTLEN 40 /* Length of hostname */ |
---|
| 21 | |
---|
| 22 | /* Screen Positions */ |
---|
| 23 | #define LEFT 0 |
---|
| 24 | #define PROCY 2 |
---|
| 25 | #define CPUY 5 |
---|
| 26 | #define TIMEY 8 |
---|
| 27 | #define PAGEY 11 |
---|
| 28 | #define CHARY 5 |
---|
| 29 | #define CHARX 37 |
---|
| 30 | #define NETIFY 17 |
---|
| 31 | #define DISKY 2 |
---|
| 32 | #define DISKX 55 |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | * DISPINIT - clears the screen, puts up the info labels, and |
---|
| 36 | * displays the initial information (device names). |
---|
| 37 | */ |
---|
| 38 | dispinit() |
---|
| 39 | { |
---|
| 40 | char hname[HOSTLEN]; |
---|
| 41 | register int i; |
---|
| 42 | |
---|
| 43 | clear(); /* clear screen */ |
---|
| 44 | gethostname(hname, HOSTLEN); /* host name in upper left */ |
---|
| 45 | printw(hname); |
---|
| 46 | |
---|
| 47 | /* Put up the labels */ |
---|
| 48 | mvprintw(PROCY,LEFT,"Procs: r d p s sl Mem: real ract virt vact free"); |
---|
| 49 | mvprintw(DISKY,DISKX,"Disks: Kbps tps msps"); |
---|
| 50 | mvprintw(CPUY,LEFT,"Cpu: ints scall csw"); |
---|
| 51 | if (dualcpu) |
---|
| 52 | mvprintw(CPUY,LEFT+25,"Cpu2: csw"); |
---|
| 53 | mvprintw(TIMEY,LEFT,"Time: user nice sys idle"); |
---|
| 54 | if (dualcpu) |
---|
| 55 | mvprintw(TIMEY,LEFT+26,"Time2: user nice sys idle"); |
---|
| 56 | mvprintw(PAGEY,LEFT,"Paging: re at pin pout oprs fr def sr"); |
---|
| 57 | mvprintw(PAGEY+3,LEFT," nxf xf nzf zf nrf rf prf swi swo"); |
---|
| 58 | mvprintw(CHARY,CHARX,"Char: in out"); |
---|
| 59 | mvprintw(NETIFY,LEFT,"Name Ipkts Ierrs Opkts Oerrs Collis Oqueue"); |
---|
| 60 | |
---|
| 61 | /* add the disk drive names to the screen */ |
---|
| 62 | for(i = 0; i < DK_NDRIVE; i++) { |
---|
| 63 | if (*dr_name[i]) |
---|
| 64 | mvprintw(DISKY+1+i,DISKX,dr_name[i]); |
---|
| 65 | else |
---|
| 66 | break; |
---|
| 67 | } |
---|
| 68 | mvprintw(DISKY+1+i,DISKX,"--------------------"); |
---|
| 69 | mvprintw(DISKY+2+i,DISKX,"Total:"); |
---|
| 70 | |
---|
| 71 | /* put up the network interface names */ |
---|
| 72 | for (i = 0; i < numif; i++) |
---|
| 73 | mvprintw(NETIFY+1+i,LEFT,nifinfo[i].name); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | /* |
---|
| 77 | * DISPUPDATE - updates the dynamic data on the screen. |
---|
| 78 | */ |
---|
| 79 | dispupdate() |
---|
| 80 | { |
---|
| 81 | int i; |
---|
| 82 | |
---|
| 83 | for (i = 0; i < numif; i++) |
---|
| 84 | mvprintw(NETIFY+1+i,LEFT+7,"%5d %5d %5d %5d %5d %5d", |
---|
| 85 | nifdat[i].ipackets, nifdat[i].ierrors, |
---|
| 86 | nifdat[i].opackets, nifdat[i].oerrors, |
---|
| 87 | nifdat[i].collisions, nifinfo[i].outqlen); |
---|
| 88 | } |
---|