Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!hara.DEC.COM!spa From: spa@hara.DEC.COM (Salvador Pinto Abreu) Newsgroups: comp.windows.x Subject: xrload.shar (part 1 of 5) Message-ID: <8708131128.AA04373@decwrl.dec.com> Date: Thu, 13-Aug-87 06:26:00 EDT Article-I.D.: decwrl.8708131128.AA04373 Posted: Thu Aug 13 06:26:00 1987 Date-Received: Sat, 15-Aug-87 08:32:08 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 335 This is xrload, an X to{ol,y} to display the load average of the various machines on a LAN. To check it out, unshar and type "make" followed by "xrload -X". Note: I had to split this up because of mailer problems. ---------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh MANIFEST <<'END_OF_MANIFEST' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 This shipping list X Makefile 1 X README 1 X back.bitmap 1 X down.bitmap 1 X draw-hand.c 1 X dump-stats.c 1 X event-loop.c 2 X get-stats.c 3 X globals.c 2 X hostname.c 2 X init.c 4 X recalc-windows.c 1 X show-stats.c 2 X update-sys.c 2 X xrload.1x 3 X xrload.c 1 END_OF_MANIFEST if test 624 -ne `wc -c Makefile <<'END_OF_Makefile' XPROGRAM = xrload X XOBJECTS = draw-hand.o dump-stats.o event-loop.o get-stats.o hostname.o \ X init.o recalc-windows.o show-stats.o update-sys.o globals.o \ X xrload.o X XSHARFILES = \ X README Makefile \ X xrload.1x \ X back.bitmap down.bitmap \ X draw-hand.c dump-stats.c event-loop.c get-stats.c hostname.c \ X init.c recalc-windows.c show-stats.c update-sys.c globals.c \ X xrload.c X XMAN = /usr/man/man1 XBIN = /usr/local/bin X XCFLAGS = -O XSIZE = 8k X Xall: $(PROGRAM) X Xshar: MANIFEST X makekit -s$(SIZE) -nxrload.shar. -h2 -iMANIFEST X XMANIFEST: $(SHARFILES) X makekit -m -s$(SIZE) -x $(SHARFILES) X Xinstall: all X install xrload $(BIN) X Xman: xrload.1x X cp xrload.1x $(MAN)/xrload.1 X chmod a=r $(MAN)/xrload.1 X X$(PROGRAM): $(OBJECTS) X cc $(CFLAGS) -o xrload $(OBJECTS) -lX -lm X Xxrload.h: back.bitmap down.bitmap X X$(OBJECTS): xrload.h END_OF_Makefile if test 834 -ne `wc -c README <<'END_OF_README' XThis is xrload(1), a tool that serves a function similar to that of Xxload(1) but monitors (part of) a TCP/IP network using a single Xwindow. This avoids having a bunch of xload windows, each with a local Xand a remote associated process, and all the resource waste this would Ximply. X XTo try it, just type: X % make X % xrload -X X XNote: I had to split this up because I'm having problems with the mailer. X--- XUUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA XARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 X XSnail: Salvador Pinto Abreu X Dept. of Computer Science, Universidade Nova de Lisboa X 2825 Monte Caparica, Portugal END_OF_README if test 664 -ne `wc -c back.bitmap <<'END_OF_back.bitmap' X#define back_width 32 X#define back_height 32 X#define back_x_hot 16 X#define back_y_hot 15 Xstatic short back_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x027f, 0xfc80, 0x01bf, 0xfb00, X 0x005f, 0xf400, 0x004f, 0xe400, X 0x002f, 0xe800, 0x0017, 0xd000, X 0x0017, 0xd000, 0x0017, 0xd000, X 0x000b, 0xa000, 0x000b, 0xa000, X 0x800b, 0xa003, 0x800b, 0xa003, X 0x800b, 0xa003, 0x000b, 0xa000, X 0x000b, 0xa000, 0x0017, 0xd000, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_back.bitmap if test 679 -ne `wc -c down.bitmap <<'END_OF_down.bitmap' X#define down_width 32 X#define down_height 32 X#define down_x_hot 16 X#define down_y_hot 15 Xstatic short down_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x827f, 0xfc83, 0x81bf, 0xfb03, X 0x805f, 0xf403, 0x804f, 0xe403, X 0xf82f, 0xe83f, 0xf817, 0xd03f, X 0x8017, 0xd003, 0x8017, 0xd003, X 0x870b, 0xe0e2, 0x890b, 0xa123, X 0x890b, 0xa122, 0x870b, 0xa0e2, X 0x890b, 0xa022, 0xa90b, 0xa02a, X 0x890b, 0xa022, 0xc017, 0xd007, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_down.bitmap if test 679 -ne `wc -c draw-hand.c <<'END_OF_draw-hand.c' X/**************************************************************************/ X/* */ X/* Draw a dial hand */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xdraw_hand (w, value, scale, l0, l1, thick) X Window w; X float value, scale, l0, l1; X int thick; X{ X float theta = M_PI_4 * (5.0 - 6.0*value/scale); X int x0 = (int) (rr*l0*cos(theta)); X int x1 = (int) (rr*l1*cos(theta)); X int y0 = (int) (rr*l0*sin(-theta)); X int y1 = (int) (rr*l1*sin(-theta)); X X x0 += (ww-back.width)/2+back.x_hot; X x1 += (ww-back.width)/2+back.x_hot; X y0 += back.y_hot; X y1 += back.y_hot; X X XLine (w, x0, y0, x1, y1, thick, thick, blackPixel, GXcopy, AllPlanes); X} END_OF_draw-hand.c if test 788 -ne `wc -c dump-stats.c <<'END_OF_dump-stats.c' X/**************************************************************************/ X/* */ X/* Dump system stats (debugging) */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xvoid dump_stats (stats, nsys) X sys_stat *stats; X int nsys; X{ X register int i; X X for (i=0; stats[i].sys_name[0]; i++) { X if (stats[i].state == UP) { X printf ("%s %s %d %f %f %f\n", X stats[i].sys_name, stats[i].how_long, X stats[i].users, X stats[i].load_average[0], X stats[i].load_average[1], X stats[i].load_average[2]); X } X else { X printf ("%s %s\n", X stats[i].sys_name, stats[i].how_long); X } X } X putchar ('\n'); X} END_OF_dump-stats.c if test 741 -ne `wc -c xrload.c <<'END_OF_xrload.c' X/**************************************************************************/ X/* */ X/* Main Program */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xmain (argc, argv) X int argc; X char *argv[]; X{ X extern void initialize (); X extern void doit (); X X initialize (argc, argv); X doit (); X} X Xusage () X{ X fprintf (stderr, X"usage: xrload [-cols ] [-delay ] [-same] [-rv] [-all] [-X]\n"); X fprintf (stderr, X" [-fn ] [-bw ] [-spacing ]\n"); X fprintf (stderr, X" [=] [:]\n"); X exit (1); X} END_OF_xrload.c if test 721 -ne `wc -c