v04i063: xtacho -- x cpu tachometer, Part01/01
Dan Heller
argv at island.uu.net
Thu Jul 20 09:30:14 AEST 1989
Submitted-by: uunet!kddlab!isl.yamaha.junet!shutoh (Kazuhiko Shutoh)
Posting-number: Volume 4, Issue 63
Archive-name: xtacho/part01
[ Cute program. Needs the library -lrpcsvc so it probably won't work
on anything other than suns. If you have it, it should work. No
Imakefile, but there's only one .c file --just compile and link in the
same command. --argv ]
#! /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 <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 1)."
# Contents: Makefile xtacho.c xtacho.h xtacho.icon xtacho.n
# Wrapped by shutoh at shako on Tue Jul 18 15:18:54 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(1502 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# SCCS ID @(#)Makefile 1.7 7/14/89
X#
X# Makefile - Makefile for xtacho
X#
X# Author: Kazuhiko Shutoh, 1989.
X#
X# Permission to use, copy, modify and distribute without charge this
X# software, documentation, images, etc. is granted, provided that this
X# comment and the author's name is retained. The author assumes no
X# responsibility for lost sleep as a consequence of use of this software.
X#
X# Send any comments, bug reports, etc. to: shutoh at isl.yamaha.JUNET or,
X# for oversea: shutoh%isl.yamaha.JUNET%kddlab at uunet.uu.net
X#
X#
XCC = /bin/cc
XCFLAGS = -f68881 -O
XDESTDIR = /usr/bin/X11
XMANDIR = /usr/man/mann
X#
X# Libraries for X11R2
X#
X#LIBS = -lXaw -lXt -lX11 -lm -lrpcsvc
X#
X# Libraries for X11R3
X#
XLIBS = -lXaw -lXmu -lXt -lX11 -lm -lrpcsvc
X
X##############################################################################
XPROGRAMS = ./xtacho
XSRCS = ./xtacho.c
XOBJS = ./xtacho.o
XLOCALHDRS = ./xtacho.h ./xtacho.icon
XEXTERNHDRS = /usr/include/stdio.h \
X /usr/include/math.h \
X /usr/include/rpcsvc/rstat.h \
X /usr/include/X11/Intrinsic.h \
X /usr/include/X11/StringDefs.h \
X /usr/include/X11/Shell.h \
X /usr/include/X11/Box.h \
X /usr/include/X11/Label.h \
X /usr/include/X11/Command.h \
X /usr/include/X11/Form.h
XMANS = ./xtacho.n
X
X$(PROGRAMS): $(OBJS)
X $(CC) $(CCFLAGS) $(OBJS) $(LIBS) -o $(PROGRAMS)
X
Xinstall: $(PROGRAMS)
X install -s $(PROGRAMS) $(DESTDIR)
X
Xinstall-man:
X install -c $(MANS) $(MANDIR)
X
Xclean:
X rm -f $(OBJS) $(PROGRAMS)
X
X
END_OF_FILE
if test 1502 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'xtacho.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xtacho.c'\"
else
echo shar: Extracting \"'xtacho.c'\" \(12475 characters\)
sed "s/^X//" >'xtacho.c' <<'END_OF_FILE'
Xstatic char sccsid[] = "@(#)xtacho.c 1.9 7/18/89";
X
X/*
X * xtacho - The cpu load tachometer for X11
X *
X * Author: Kazuhiko Shutoh, 1989.
X *
X * Permission to use, copy, modify and distribute without charge this software,
X * documentation, images, etc. is granted, provided that this comment and the
X * author's name is retained. The author assumes no responsibility for lost
X * sleep as a consequence of use of this software.
X *
X * Send any comments, bug reports, etc. to: shutoh at isl.yamaha.JUNET or,
X * for oversea: shutoh%isl.yamaha.JUNET%kddlab at uunet.uu.net
X *
X */
X
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X#include <X11/Shell.h>
X#include <X11/Box.h>
X#include <X11/Label.h>
X#include <X11/Command.h>
X#include <X11/Form.h>
X#include <stdio.h>
X#include <math.h>
X#include <rpcsvc/rstat.h>
X#include "xtacho.h"
X#include "xtacho.icon"
X
XXtCallbackProc redraw_callback();
XXtTimerCallbackProc PollingCpuStatus();
Xvoid SetupTacho();
Xvoid GetGraphicContexts();
Xvoid Usage();
Xvoid DrawTachometer();
Xvoid FastFillCircle();
Xvoid DrawGauge();
Xvoid DrawNumbers();
Xvoid DrawLabelString();
Xvoid DrawSingleNumber();
Xvoid DrawNeedle();
X
XWidget toplevel, base, info, meter;
XGC gcForeground, gcBackground, gcNeedle;
X
Xchar hostname[MAXCHARS];
Xunsigned char monitor_item;
Xlong update;
XCardinal current_status = 0;
XCardinal old_status = 0;
XCardinal old_status_time = 0;
X
Xmain(argc, argv)
X int argc;
X char **argv;
X{
X
X Arg args[10];
X Cardinal i;
X XtIntervalId intervalId;
X XtTranslations newTranslations;
X static XtActionsRec redrawActions[] = {
X {"expose", (XtCallbackProc) redraw_callback},
X {"resize", (XtCallbackProc) redraw_callback}};
X
X static char *overrideTranslations =
X "<Expose>: expose() \n\
X <ResReq>: expose()";
X
X struct statstime cpu_status;
X char label[MAXCHARS];
X
X
X toplevel = XtInitialize("xtacho", "XTacho", NULL, 0, &argc, argv);
X
X i = 0;
X XtSetArg(args[0], XtNiconPixmap,
X XCreateBitmapFromData(XtDisplay(toplevel),
X XtScreen(toplevel)->root, xtacho_bits,
X xtacho_width, xtacho_height));i++;
X XtSetValues(toplevel, args, i);
X
X SetupTacho(argc, argv);
X
X base = XtCreateManagedWidget("base", formWidgetClass, toplevel, NULL, 0);
X
X switch (monitor_item) {
X case USER_CPU:
X sprintf(label, "%s : User", hostname);
X break;
X
X case SYSTEM_CPU:
X sprintf(label, "%s : System", hostname);
X break;
X
X case IDLE_CPU:
X sprintf(label, "%s : Idle", hostname);
X break;
X
X default:
X break;
X }
X
X i = 0;
X XtSetArg(args[i], XtNlabel, label);i++;
X XtSetArg(args[i], XtNwidth, 100);i++;
X info = XtCreateManagedWidget("info", labelWidgetClass, base, args, i);
X
X i = 0;
X XtSetArg(args[i], XtNwidth, 100);i++;
X XtSetArg(args[i], XtNheight, 100);i++;
X XtSetArg(args[i], XtNborderWidth, 0);i++;
X XtSetArg(args[i], XtNfromVert, info);i++;
X meter = XtCreateManagedWidget("meter", boxWidgetClass, base, args, i);
X
X GetGraphicContexts(meter);
X
X XtAddActions(redrawActions, XtNumber(redrawActions));
X newTranslations = XtParseTranslationTable(overrideTranslations);
X XtOverrideTranslations(meter, newTranslations);
X
X rstat(hostname, &cpu_status);
X
X old_status_time = cpu_status.cp_time[monitor_item];
X
X
X /* Interval timer start */
X
X intervalId = XtAddTimeOut(update, PollingCpuStatus, NULL);
X
X XtRealizeWidget(toplevel);
X XtMainLoop();
X}
X
Xvoid
XSetupTacho(ac, av)
X int ac;
X char **av;
X{
X
X Cardinal count;
X
X /* Setup default */
X
X gethostname(hostname, 256);
X monitor_item = USER_CPU;
X update = 3000;
X
X if (ac > 2)
X for (count = 1; count < ac; count++) {
X if ((strcmp("-host", av[count]) == 0) && (count + 1 <= ac))
X strcpy(hostname, av[++count]);
X else if ((strcmp("-update", av[count]) == 0) && (count + 1 <= ac))
X update = atol(av[++count]) * (long) 1000;
X else if ((strcmp("-mon", av[count]) == 0) && (count + 1 <= ac)) {
X if (strcmp("sys", av[count + 1]) == 0)
X monitor_item = SYSTEM_CPU;
X else if (strcmp("user", av[count + 1]) == 0)
X monitor_item = USER_CPU;
X else if (strcmp("idle", av[count + 1]) == 0)
X monitor_item = IDLE_CPU;
X else
X Usage();
X count++;
X } else
X Usage();
X }
X}
X
Xvoid
XGetGraphicContexts(w)
X Widget w;
X{
X
X Arg args[2];
X XGCValues gcv;
X
X XtSetArg(args[0], XtNbackground, 0);
X XtSetArg(args[1], XtNborderColor, 0);
X XtGetValues(w, args, XtNumber(args));
X
X gcv.foreground = args[1].value;
X gcForeground = XtGetGC(w, GCForeground, &gcv);
X
X gcv.foreground = args[0].value;
X gcBackground = XtGetGC(w, GCForeground, &gcv);
X
X gcv.foreground = args[0].value;
X gcv.foreground = args[0].value;
X gcv.function = GXinvert;
X gcNeedle = XtGetGC(w, GCFunction, &gcv);
X}
X
Xvoid
XUsage()
X{
X
X fprintf(stderr, "xtacho <Toolkit Options> [-host hostname] [-mon sys|user|idle] [-update second]\n");
X
X exit(-1);
X
X}
X
XXtCallbackProc
Xredraw_callback(w, event, params, nparams)
X Widget w;
X XEvent *event;
X String *params;
X Cardinal *nparams;
X{
X
X DrawTachometer(w);
X}
X
Xvoid
XDrawTachometer(w)
X Widget w;
X{
X
X double tmp;
X Arg args[2];
X Cardinal d_rx;
X Cardinal d_ry;
X Cardinal d_width;
X Cardinal d_height;
X
X
X XtSetArg(args[0], XtNwidth, 0);
X XtSetArg(args[1], XtNheight, 0);
X XtGetValues(w, args, XtNumber(args));
X
X d_rx = args[0].value / 2 + 1;
X d_ry = args[1].value / 2 + 1;
X
X /* Draw meter shape */
X
X d_width = args[0].value;
X d_height = args[1].value;
X
X FastFillCircle(w, gcForeground, d_rx, d_ry, d_width, d_height);
X
X d_width = (double) (args[0].value) * 0.95;
X d_height = (double) (args[1].value) * 0.95;
X
X FastFillCircle(w, gcBackground, d_rx, d_ry, d_width, d_height);
X
X d_width = (double) (args[0].value) * 0.1;
X d_height = (double) (args[1].value) * 0.1;
X
X FastFillCircle(w, gcForeground, d_rx, d_ry, d_width, d_height);
X
X /* Draw gauge */
X
X DrawGauge(w, gcForeground, d_rx, d_ry);
X
X DrawNeedle(w, gcNeedle, current_status);
X
X}
X
Xvoid
XFastFillCircle(w, gc, dx, dy, wx, wy)
X Widget w;
X GC gc;
X Cardinal dx;
X Cardinal dy;
X Cardinal wx;
X Cardinal wy;
X{
X
X XPoint points[360];
X Cardinal angle;
X
X for (angle = 0; angle < 360; angle++) {
X points[angle].x = (short) (sin((double) angle * PI / 180.0) * ((double) wx / 2.0) + (double) dx);
X points[angle].y = (short) (cos((double) angle * PI / 180.0) * ((double) wy / 2.0) + (double) dy);
X }
X
X XFillPolygon(XtDisplay(w), XtWindow(w), gc, points, 360, Complex, CoordModeOrigin);
X
X}
X
Xvoid
XDrawGauge(w, gc, rx, ry)
X Widget w;
X GC gc;
X Cardinal rx;
X Cardinal ry;
X{
X
X XPoint points[4];
X double step;
X Cardinal in_gauge_x, in_gauge_y;
X Cardinal out_gauge_x, out_gauge_y;
X Cardinal number_x, number_y;
X
X for (step = 330.0; step >= 30.0; step -= 3) {
X in_gauge_x = sin(step * PI / 180.0) * rx * 0.8 + rx;
X in_gauge_y = cos(step * PI / 180.0) * ry * 0.8 + ry;
X out_gauge_x = sin(step * PI / 180.0) * rx * 0.85 + rx;
X out_gauge_y = cos(step * PI / 180.0) * ry * 0.85 + ry;
X
X if ((Cardinal) (step) % 30 == 0) {
X points[0].x = sin((step + 1.0) * PI / 180.0) * rx * 0.75 + rx;
X points[0].y = cos((step + 1.0) * PI / 180.0) * ry * 0.75 + ry;
X points[1].x = sin((step - 1.0) * PI / 180.0) * rx * 0.75 + rx;
X points[1].y = cos((step - 1.0) * PI / 180.0) * ry * 0.75 + ry;
X points[2].x = sin((step - 1.0) * PI / 180.0) * rx * 0.85 + rx;
X points[2].y = cos((step - 1.0) * PI / 180.0) * ry * 0.85 + ry;
X points[3].x = sin((step + 1.0) * PI / 180.0) * rx * 0.85 + rx;
X points[3].y = cos((step + 1.0) * PI / 180.0) * ry * 0.85 + ry;
X
X XFillPolygon(XtDisplay(w), XtWindow(w), gc, points, 4, Complex, CoordModeOrigin);
X
X number_x = sin((step + 1.0) * PI / 180.0) * rx * 0.65 + rx;
X number_y = cos((step + 1.0) * PI / 180.0) * ry * 0.65 + ry;
X
X DrawNumbers(w, gc, (unsigned char) ((330.0 - step) / 30.0), number_x, number_y, rx, ry);
X
X } else
X XDrawLine(XtDisplay(w), XtWindow(w), gc, in_gauge_x, in_gauge_y, out_gauge_x, out_gauge_y);
X
X }
X
X DrawLabelString(w, gc, rx, ry);
X
X}
X
Xvoid
XDrawNumbers(w, gc, which, x, y, width, height)
X Widget w;
X GC gc;
X unsigned char which;
X Cardinal x, y, width, height;
X{
X
X /* Draw Numbers */
X
X if (which == 10) {
X DrawSingleNumber(w, gc, 1, (Cardinal) ((double) x * 0.9), y, width, height);
X DrawSingleNumber(w, gc, 0, x, y, width, height);
X } else
X DrawSingleNumber(w, gc, which, x, y, width, height);
X
X}
X
X
Xvoid
XDrawLabelString(w, gc, width, height)
X Widget w;
X GC gc;
X Cardinal width;
X Cardinal height;
X{
X
X XPoint points[5];
X Cardinal ry;
X unsigned char char_count;
X unsigned char data_count;
X
X ry = (double) height *0.35 + height;
X
X for (char_count = 0; char_count < 7; char_count++) {
X for (data_count = 0; data_count < char_data[char_count].nofline
X ; data_count++) {
X points[data_count].x = (double) (char_data[char_count].point_list[data_count].x) * (double) width *0.01 + width;
X points[data_count].y = (double) (char_data[char_count].point_list[data_count].y) * (double) height *0.01 + ry;
X }
X XDrawLines(XtDisplay(w), XtWindow(w), gc, points, char_data[char_count].nofline, CoordModeOrigin);
X }
X}
X
Xvoid
XDrawSingleNumber(w, gc, which, x, y, width, height)
X Widget w;
X GC gc;
X Cardinal x, y, width, height;
X{
X
X XSegment segments[7];
X Cardinal nsegments;
X unsigned char count;
X
X for (count = 0, nsegments = 0; count < 7; count++) {
X if (num_segment[which].digit[count] == 1) {
X segments[nsegments].x1 = (short) (x + ((double) offset[count].x1 * ((double) width / 200.0)));
X segments[nsegments].y1 = (short) (y + ((double) offset[count].y1 * ((double) height / 200.0)));
X segments[nsegments].x2 = (short) (x + ((double) offset[count].x2 * ((double) width / 200.0)));
X segments[nsegments].y2 = (short) (y + ((double) offset[count].y2 * ((double) height / 200.0)));
X nsegments++;
X }
X }
X
X XDrawSegments(XtDisplay(w), XtWindow(w), gc, segments, nsegments);
X
X}
X
Xvoid
XDrawNeedle(w, gc, load)
X Widget w;
X GC gc;
X Cardinal load;
X{
X
X Arg args[2];
X XPoint points[6];
X Cardinal rx, ry;
X double cur_theta1, cur_theta2, cur_theta3, cur_theta4, cur_theta5;
X
X
X XtSetArg(args[0], XtNwidth, 0);
X XtSetArg(args[1], XtNheight, 0);
X XtGetValues(w, args, XtNumber(args));
X
X
X rx = args[0].value / 2 + 1;
X ry = args[1].value / 2 + 1;
X
X cur_theta1 = (double) (330 - (load * 3)) * PI / 180.0;
X cur_theta2 = (double) (330 - (load * 3) + 1) * PI / 180.0;
X cur_theta3 = (double) (330 - (load * 3) - 1) * PI / 180.0;
X cur_theta4 = (330.0 - ((double) load * 3.0) + 7.0) * PI / 180.0;
X cur_theta5 = (330.0 - ((double) load * 3.0) - 7.0) * PI / 180.0;
X
X points[0].x = sin(cur_theta1) * rx * 0.75 + rx;
X points[0].y = cos(cur_theta1) * ry * 0.75 + ry;
X points[1].x = sin(cur_theta2) * rx * 0.7 + rx;
X points[1].y = cos(cur_theta2) * ry * 0.7 + ry;
X points[2].x = sin(cur_theta4) * rx * 0.1 + rx;
X points[2].y = cos(cur_theta4) * ry * 0.1 + ry;
X points[3].x = sin(cur_theta5) * rx * 0.1 + rx;
X points[3].y = cos(cur_theta5) * ry * 0.1 + ry;
X points[4].x = sin(cur_theta3) * rx * 0.7 + rx;
X points[4].y = cos(cur_theta3) * ry * 0.7 + ry;
X points[5].x = points[0].x;
X points[5].y = points[0].y;
X
X XDrawLines(XtDisplay(w), XtWindow(w), gc, points, 6, CoordModeOrigin);
X
X}
X
XXtTimerCallbackProc
XPollingCpuStatus(client_data, id)
X caddr_t client_data;
X XtIntervalId id;
X{
X
X struct statstime system_status;
X Cardinal load_count, step;
X
X /* Get new CpuTime */
X
X rstat(hostname, &system_status);
X current_status = (double) (system_status.cp_time[monitor_item] - old_status_time) / ((double) update / 2000.0);
X old_status_time = system_status.cp_time[monitor_item];
X
X if (current_status > 100)
X current_status /= 2;
X
X if (current_status != old_status) {
X /* Move Needle */
X
X if (current_status < old_status)
X step = -1;
X else
X step = 1;
X
X for (load_count = old_status; load_count != current_status; load_count += step)
X DrawNeedle(meter, gcNeedle, load_count);
X
X for (load_count = old_status + step; load_count != current_status + step; load_count += step)
X DrawNeedle(meter, gcNeedle, load_count);
X
X }
X
X XtAddTimeOut(update, PollingCpuStatus, NULL);
X
X old_status = current_status;
X
X}
END_OF_FILE
if test 12475 -ne `wc -c <'xtacho.c'`; then
echo shar: \"'xtacho.c'\" unpacked with wrong size!
fi
# end of 'xtacho.c'
fi
if test -f 'xtacho.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xtacho.h'\"
else
echo shar: Extracting \"'xtacho.h'\" \(1723 characters\)
sed "s/^X//" >'xtacho.h' <<'END_OF_FILE'
X/* SCCS ID : @(#)xtacho.h 1.4 7/14/89
X*
X* xtacho.h - Header file for xtacho
X*
X* Author: Kazuhiko Shutoh, 1989.
X*
X* Permission to use, copy, modify and distribute without charge this
X* software, documentation, images, etc. is granted, provided that this
X* comment and the author's name is retained. The author assumes no
X* responsibility for lost sleep as a consequence of use of this software.
X*
X* Send any comments, bug reports, etc. to: shutoh at isl.yamaha.JUNET or,
X* for oversea: shutoh%isl.yamaha.JUNET%kddlab at uunet.uu.net
X*
X*/
X
X#define PI 3.1415927
X#define MAXCHARS 256
X
X#define USER_CPU 0
X#define SYSTEM_CPU 2
X#define IDLE_CPU 3
X
Xtypedef struct {
X unsigned char digit[7];
X } DigitRec;
X
Xtypedef struct {
X int nofline;
X XPoint point_list[5];
X } StringRec;
X
X/* Number's character database - like as "LED" */
X
XDigitRec num_segment[] = {
X {1,1,1,1,1,1,0},
X {0,1,1,0,0,0,0},
X {1,1,0,1,1,0,1},
X {1,1,1,1,0,0,1},
X {0,1,1,0,0,1,1},
X {1,0,1,1,0,1,1},
X {1,0,1,1,1,1,1},
X {1,1,1,0,0,0,0},
X {1,1,1,1,1,1,1},
X {1,1,1,1,0,1,1}};
X
XXSegment offset[] = {
X {-10,-10, 10,-10},
X { 10,-10, 10, 0},
X { 10, 0, 10, 10},
X { 10, 10,-10, 10},
X {-10, 10,-10, 0},
X {-10, 0,-10,-10},
X {-10, 0, 10, 0}};
X
X/* " X 10 %" character database */
X
XStringRec char_data[] = {
X { 2, /* "X" */
X {{-17, -5},
X {-7, 5}}},
X { 2,
X {{-7, -5},
X {-17, 5}}},
X { 2, /* "1" */
X {{-2, -5},
X {-2, 5}}},
X { 5, /* "0" */
X {{2, -5},
X {12, -5},
X {12, 5},
X {2, 5},
X {2, -5}}},
X { 5, /* "%" */
X {{17, -5},
X {20, -5},
X {20, -2},
X {17, -2},
X {17, -5}}},
X { 2,
X {{27, -5},
X {17, 5}}},
X {5,
X {{24, 2},
X {27, 2},
X {27, 5},
X {24, 5},
X {24, 2}}}};
X
X
END_OF_FILE
if test 1723 -ne `wc -c <'xtacho.h'`; then
echo shar: \"'xtacho.h'\" unpacked with wrong size!
fi
# end of 'xtacho.h'
fi
if test -f 'xtacho.icon' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xtacho.icon'\"
else
echo shar: Extracting \"'xtacho.icon'\" \(2270 characters\)
sed "s/^X//" >'xtacho.icon' <<'END_OF_FILE'
X#define xtacho_width 50
X#define xtacho_height 50
Xstatic char xtacho_bits[] = {
X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
X 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x84, 0x00, 0x00, 0x00,
X 0x00, 0x40, 0x0c, 0x43, 0x40, 0x00, 0x00, 0x00, 0x30, 0x82, 0x20, 0x20,
X 0x00, 0x00, 0x00, 0x08, 0x41, 0x18, 0x10, 0x00, 0x00, 0x00, 0xc4, 0x20,
X 0x04, 0x10, 0x00, 0x00, 0x00, 0x23, 0x10, 0x02, 0x08, 0x02, 0x00, 0xc0,
X 0xff, 0xff, 0x7f, 0x04, 0x01, 0x00, 0x40, 0x00, 0x00, 0x90, 0x83, 0x00,
X 0x00, 0x40, 0xff, 0xff, 0x17, 0x42, 0x00, 0x00, 0x20, 0x01, 0x00, 0x14,
X 0x23, 0x00, 0x00, 0x20, 0xf5, 0x19, 0x8a, 0x12, 0x02, 0x00, 0x20, 0x01,
X 0x00, 0x4a, 0x12, 0x01, 0x00, 0xa0, 0x9e, 0x45, 0x4a, 0x8a, 0x00, 0x00,
X 0xa0, 0x00, 0x00, 0x2a, 0x46, 0x00, 0x00, 0xa0, 0xf2, 0x13, 0x0a, 0x22,
X 0x00, 0x00, 0x90, 0x00, 0x00, 0x0a, 0x12, 0x00, 0x00, 0x90, 0xa6, 0x09,
X 0x05, 0x13, 0x00, 0x00, 0x90, 0x00, 0x00, 0x85, 0x0a, 0x00, 0x00, 0x50,
X 0x00, 0x00, 0x05, 0x06, 0x00, 0x00, 0x50, 0x00, 0x00, 0xc5, 0x12, 0x00,
X 0x00, 0x50, 0x00, 0x80, 0xe4, 0x0a, 0x00, 0x00, 0xe8, 0xff, 0xff, 0xe2,
X 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0xe2, 0x02, 0x00, 0x00, 0xf8, 0xff,
X 0xff, 0xe3, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00,
X 0xfb, 0xff, 0x8f, 0xf0, 0x00, 0x00, 0x80, 0x24, 0x49, 0x4a, 0x78, 0x00,
X 0x00, 0x40, 0x93, 0x24, 0x25, 0x14, 0x00, 0x00, 0xb0, 0xff, 0xff, 0x13,
X 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x48, 0x05, 0x00, 0x00, 0xf8, 0xff,
X 0xff, 0xe7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00,
X 0x08, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0xf4, 0x00,
X 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00,
X 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c,
X 0xe8, 0x0f, 0x00, 0x02, 0xc0, 0x00, 0x78, 0x04, 0x01, 0x00, 0x02, 0xc0,
X 0x00, 0xf0, 0x02, 0xe1, 0xf1, 0x1a, 0xc7, 0x00, 0x60, 0x01, 0x01, 0x0a,
X 0xa6, 0xc8, 0x00, 0xa0, 0x03, 0xe1, 0x0b, 0xa2, 0xc8, 0x00, 0xd0, 0x07,
X 0x21, 0x0a, 0xa2, 0x08, 0x00, 0x08, 0x0f, 0x21, 0x0a, 0xa2, 0xc8, 0x00,
X 0x04, 0x0e, 0xc1, 0xf3, 0x22, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X 0x00, 0x00};
END_OF_FILE
if test 2270 -ne `wc -c <'xtacho.icon'`; then
echo shar: \"'xtacho.icon'\" unpacked with wrong size!
fi
# end of 'xtacho.icon'
fi
if test -f 'xtacho.n' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xtacho.n'\"
else
echo shar: Extracting \"'xtacho.n'\" \(2275 characters\)
sed "s/^X//" >'xtacho.n' <<'END_OF_FILE'
X.TH XTACHO 1 "11 July 1989" "X Version 11"
X.SH NAME
Xxtacho - load average tachometer for X
X.SH SYNOPSIS
X.B xtacho
X[-\fItoolkitoption\fP ...] [-update \fIseconds\fP] [-host \fIhostname\fP] [-mon \fImonitor-item\fP]
X.SH DESCRIPTION
XThe
X.I xtacho
Xprogram displays a updating tachometer of the system/usr/idle cpu load average.
X.SH OPTIONS
X.PP
X.I Xtacho
Xaccepts all of the standard X Toolkit command line options along with the
Xfollowing additional options:
X.PP
X.TP 8
X.B \-update \fIseconds\fP
XThis option specifies the frequency in seconds at which
X.I xtacho
Xupdates its display. If the load average window is uncovered (by moving
Xwindows with a window manager or by the \fIxrefresh\fP program), the meter
Xwill be also be updated. The minimum amount of time allowed between updates
Xis 1 seconds (default is 3 seconds).
X.TP 8
X.B \-host \fIhost-name\fP
XThis option specifies the hostname which
X.I xtacho
Xmonitoring host.
X.TP 8
X.B \-mon \fImonitor-item\fP
XThis option specifies the monitor item. The item are choose one in 'user' 'sys' 'idle'. The item 'user' is (which is default) monitor user cpu load average,and 'sys' is system cpu load. 'idle' is cpu idling monitor in 0-100 percentage.
X.SH EXAMPLES
X.PP
XHere is a simple example using
X.I xtacho
X.PP
X.TP 8
Xdwarf% xtacho -update 1 -mon sys&
XMonitor system cpu load average of hostname "dwarf" by every seconds.
X.PP
X.TP 8
Xgoblin% xtacho -host elf -mon idle&
XMonitor idle cpu% of hostname "elf".
X.PP
X.TP 8
Xsprite% xtacho -display dwarf:0 -rv -host wizard&
XMonitor user cpu load average of hostname "wizard" using display "dwarf:0".
X.SH SEE ALSO
XX(1), xperfmon(1), rstatd(8C), rstat(3R), X Toolkit Athena widgets.
X.SH BUGS
XThis program requires the rpc service. The
X.I xtacho
Xread remote host's cpu statics through rstatd. if running xtacho on host that not required rpc services, the xtacho does not work.
X.SH COPYRIGHT NOTICE
XPermission to use, copy, modify and distribute without charge this
Xsoftware, documentation, images, etc. is granted, provided that this
Xcomment and the author's name is retained. The author assumes no
Xresponsibility for lost sleep as a consequence of use of this software.
X.SH AUTHOR
XKazuhiko Shutoh
X.br
Xshutoh at isl.yamaha.junet
X.br
Xfor oversea: shutoh%isl.yamaha.JUNET%kddlab at uunet.uu.net
END_OF_FILE
if test 2275 -ne `wc -c <'xtacho.n'`; then
echo shar: \"'xtacho.n'\" unpacked with wrong size!
fi
# end of 'xtacho.n'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have the archive.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Comp.sources.x
mailing list