Major upgrade from Lars. The geometry bug has been fixed, and the

swap display improved.

Submitted by:	Lars Köller (Lars_Koeller@odie.physik2.uni-rostock.de)
This commit is contained in:
Joerg Wunsch 1995-12-15 22:25:50 +00:00
parent b373c4c98d
commit a730d05ad2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=2559
10 changed files with 2738 additions and 1064 deletions

View file

@ -1,17 +1,17 @@
# New ports collection makefile for: xpermon++ V1.1 # New ports collection makefile for: xperfmon++ V1.3
# Version required: 1.1 # Version required: 1.1
# Date created: 8 March 95 # Date created: 15 December 95
# Whom: Lars Koeller <lars.koeller@odie.physik2.uni-rostock.de> # Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
# #
# $Id: Makefile,v 1.5 1995/05/19 09:40:06 asami Exp $ # $Id: Makefile,v 1.6 1995/12/15 11:16:54 Lars Koeller Exp $
# #
PREFIX= /usr/X11R6
DISTNAME= xperfmon++ DISTNAME= xperfmon++
PKGNAME= xperfmon-1.1 PKGNAME= xperfmon-1.3
USE_IMAKE= yes USE_IMAKE= yes
CATEGORIES+= sysutils CATEGORIES+= sysutils
# In Germany try this # In Germany try this
# MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/ #MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/ MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
DISTFILES= xperfmon++v1.1.tar.Z DISTFILES= xperfmon++v1.1.tar.Z

View file

@ -1,432 +1,554 @@
diff -u ../xperfmon++.orig/Imakefile ./Imakefile diff -c -N ../xperfmon++/bsd_system.c ./bsd_system.c
--- ../xperfmon++.orig/Imakefile Wed Jul 27 22:29:29 1994 *** ../xperfmon++/bsd_system.c Thu Jan 1 01:00:00 1970
+++ ./Imakefile Sun Nov 12 00:07:24 1995 --- ./bsd_system.c Fri Dec 15 11:00:03 1995
@@ -17,15 +17,21 @@ ***************
SYS_MODULE= sgi_system *** 0 ****
#endif --- 1,548 ----
+ /*
-EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) + * Perfmon Performance Monitor
+#if defined (i386BsdArchitecture) + *
+BSDFLAGS= -lkvm + * Copyright 1985, Massachusetts Institute of Technology
+SYS_MODULE= bsd_system + * Copyright 1989, PCS Computer Systeme GmbH, West Germany
+CC= gcc + * Copyright 1994, Sterling Software @ NASA-Ames Research Center
+#endif + * Copyright 1995, Regents of the University of California,
+ + * Lars Köller <Lars_Koeller@odie.physik2.uni-rostock.de
+EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(BSDFLAGS) + *
+ * Permission to use, copy, modify, distribute, and sell this software and its
INSTPGMFLAGS = $(INSTKMEMFLAGS) + * documentation for any purpose is hereby granted without fee, provided that
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) + * the above copyright notice appear in all copies and that both that
INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11 + * copyright notice and this permission notice appear in supporting
-# INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11 -I/usr/include/bsd + * documentation, and that the name of PCS and Sterling Software not be used in advertising or
- CDEBUGFLAGS = -O + * publicity pertaining to distribution of the software without specific,
- SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c nfs.c + * written prior permission. PCS and Sterling Software makes no representations about the
- OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o nfs.o + * suitability of this software for any purpose. It is provided "as is"
+# SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c nfs.c + * without express or implied warranty.
+# OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o nfs.o + *
+ SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c + * PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & STERLING SOFTWARE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
ComplexProgramTarget(xperfmon++) + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
diff -u ../xperfmon++.orig/README ./README + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- ../xperfmon++.orig/README Wed Jul 27 22:29:30 1994 + *
+++ ./README Sun Nov 12 00:07:24 1995 + * Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
@@ -18,3 +18,20 @@ + * Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
Research Center, rsmith@proteus.arc.nasa.gov. Imake will build for correct + * tom@meepmeep.pcs.com
O/S if x11r5 is fully installed in all the right places. + * 1994 Revision
+ * Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
+ + * Moffett Field, California, rsmith@proteus.arc.nasa.gov
+3-15-95 Completely new port of systemdependent file (bsd_system.c) for FreeBSD-2.X + * 1995 FreeBSD 2.x Version
+ by Lars Köller @University of Rostock, Germany. + * Author: Lars Koeller, Univerity of Rostock, Germany
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + * Lars_Koeller@odie.physik2.uni-rostock.de
+ + */
+8-16-95 Quick and dirty workaround of -geometry option bug. +
+ But there are still some side effects when changing the geometry. + /* This file contains only system functions - that is the functions that
+ Fix memory leak in bsd_system.c + * get the information the performance monitor is monitoring. No calls
+ by Lars Köller @University of Rostock, Germany. + * to any X routines should be made here. The reason for doing this is
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + * so that as the X toolkit becomes available and the X window system
+ + * improves no changes will have to be made to this file, and as this
+30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system + * program is made available for a new type of machine, only this file
+ tries to minimize the free unused amount of memory. + * will need to be changed.
+ Include basic support for FreeBSD > 2.1. + */
+ Number of interrupts now independent from + #include <X11/IntrinsicP.h>
+ by Lars Köller @University of Rostock, Germany. +
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + #include "system.h"
diff -u ../xperfmon++.orig/TimeChart.h ./TimeChart.h +
--- ../xperfmon++.orig/TimeChart.h Wed Jul 27 22:29:31 1994 + #include <stdio.h>
+++ ./TimeChart.h Sun Nov 12 00:07:24 1995 + #include <stdlib.h>
@@ -88,12 +88,12 @@ + #include <strings.h>
#define XtCFillRect "FillRect" + #include <unistd.h>
+ #include <paths.h>
#define XtNgetValue "getValue" + #include <kvm.h>
-#define XtNhighlight "highlight" + #include <nlist.h>
+/* #define XtNhighlight "highlight" */ + #include <limits.h>
#define XtNjumpScroll "jumpScroll" + #include <errno.h>
#define XtNminScale "minScale" + #include <err.h>
#define XtNscale "scale" +
#define XtNfillRect "fillRect" + #include <sys/file.h>
-#define XtNupdate "update" + #include <sys/param.h>
+/* #define XtNupdate "update" */ + #include <sys/socket.h>
#define XtNvmunix "vmunix" + #include <sys/sysctl.h>
+ #include <sys/dkstat.h>
typedef struct _TimeChartRec *TimeChartWidget; + #include <sys/buf.h>
diff -u ../xperfmon++.orig/XPerfmon++.ad ./XPerfmon++.ad + #include <sys/vmmeter.h>
--- ../xperfmon++.orig/XPerfmon++.ad Wed Jul 27 22:29:32 1994 + #include <vm/vm.h>
+++ ./XPerfmon++.ad Sun Nov 12 00:07:23 1995 + #include <net/if.h>
@@ -4,24 +4,37 @@ + #include <netinet/in.h>
! commented out, the "NFS Server" graph background will be the application + #include <sys/stat.h>
! default color, unless some other resource file has specified it. + #include <sys/conf.h>
! *PerfChart.highAlarm: 99998 + #include <sys/rlist.h>
+*perfChartUser.highAlarm: 95 + #include <sys/mount.h>
+*perfChartUser.highWarn: 75 + #include <nfs/nfsv2.h>
+ + #include <nfs/nfs.h>
+*perfChartSystem.highAlarm: 40 +
+*perfChartSystem.highWarn: 25 +
+ + #if __FreeBSD__ > 1
*perfChartIdle.lowWarn: 10 + #include <osreldate.h>
*perfChartIdle.lowAlarm: 5 + /*
-*perfChartUser.highAlarm: 90 + * XXX temporary hack: FreeBSD-2.2-current has been floating around
-*perfChartUser.highWarn: 75 + * with 199508 for some time; FreeBSD-2.1 will be 199511 however (so
-*perfChartSystem.highAlarm: 90 + * 2.2-current has been bumped to 199512 recently). Recognize the old
-*perfChartSystem.highWarn: 75 + * 2.2-current as NFSv3 for a grace period.
-*perfChartFree.lowWarn: 2000 + * FreeBSD 2.0.5 was 199504, btw. Both, 2.0.5 and 2.1 don't have
-*perfChartFree.lowAlarm: 1000 + * NFSv3.
-*perfChartDisk.highWarn: 25 + */
-*perfChartDisk.highAlarm: 50 + # if __FreeBSD_version > 199511 || __FreeBSD_version == 199508
-*perfChartIntrpts.highWarn: 500 + # define HAS_NFS_V3
-*perfChartIntrpts.highAlarm: 750 + # endif /* FreeBSD_version */
-*perfChartInput.highWarn: 300 + #endif /* FreeBSD */
-*perfChartInput.highAlarm: 500 +
-*perfChartOutput.highWarn: 300 + #include "is.h"
-*perfChartOutput.highAlarm: 500 +
+ + #ifndef TRUE
+*perfChartSwap.highWarn: 50 + #define TRUE 1
+*perfChartSwap.highAlarm: 100 + #define FALSE 0
+ + #endif
+*perfChartDisk.highWarn: 50 +
+*perfChartDisk.highAlarm: 100 + #define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
+ +
+*perfChartIntrpts.highWarn: 400 + /*
+*perfChartIntrpts.highAlarm: 600 + Function Prototypes
+ + */
+*perfChartInput.highWarn: 500 + static int get_namelist(const char *kernel_name, const char *memory_name);
+*perfChartInput.highAlarm: 1000 + static void kread(int nlx, void *addr, size_t size);
+ + static void collect_stats(void);
+*perfChartOutput.highWarn: 500 + static int total_disk_transfers(void);
+*perfChartOutput.highAlarm: 1000 + static int get_swapspace(void);
+ +
*perfChartCollision.highWarn: 20 + /*
*perfChartCollision.highAlarm: 50 + Variables & Structs
-*perfChartNFSClient.highWarn: 200 + */
-*perfChartNFSClient.highAlarm: 400 + static unsigned long *intrcnt;
+ + static int nintr, hz;
+*perfChartNFSClient.highWarn: 100 + static kvm_t *kd;
+*perfChartNFSClient.highAlarm: 200 + static char errbuf[_POSIX2_LINE_MAX];
+ + static char dr_name[DK_NDRIVE][DK_NAMELEN];
+*perfChartNFSServer.highWarn: 100 + static double etime;
+*perfChartNFSServer.highAlarm: 200 +
*font: 6x13 + int current_values[NUM_GRAPHS];
+ + stat_type stats;
Only in .: bsd_system.c +
diff -u ../xperfmon++.orig/misc.c ./misc.c + extern Widget perfmon[NUM_GRAPHS];
--- ../xperfmon++.orig/misc.c Wed Jul 27 22:29:33 1994 +
+++ ./misc.c Sun Nov 12 00:07:24 1995 + static struct packet {
@@ -58,7 +58,7 @@ + int input, output, collisions;
int i, keycode, length = 0; + } packets, old_packets;
/* PerfmonWidget pw = (PerfmonWidget) w;*/ +
+ static struct nfsstats nfsstats;
- length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL); + static struct _nfsStats {
+ length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL); + int nfsServer, nfsClient;
switch (keycode) { + } nfsStats, old_nfsStats;
case 'Q': +
case 'q': + struct nlist nl[] = {
diff -u ../xperfmon++.orig/system.h ./system.h + #define X_CPTIME 0
--- ../xperfmon++.orig/system.h Wed Jul 27 22:29:34 1994 + { "_cp_time" },
+++ ./system.h Sun Nov 12 00:07:24 1995 + #define X_SUM 1
@@ -149,7 +149,11 @@ + { "_cnt" },
"User", + #define X_BOOTTIME 2
"System", + { "_boottime" },
"Idle", + #define X_DKXFER 3
+#ifdef __FreeBSD__ + { "_dk_xfer" },
+ "Swap", + #define X_HZ 4
+#else + { "_hz" },
"Free", + #define N_IFNET 5
+#endif + { "_ifnet" },
"Disk", + #define X_INTRCNT 6
"Interrupts", + { "_intrcnt" },
"Input", + #define X_EINTRCNT 7
@@ -162,7 +166,11 @@ + { "_eintrcnt" },
"User", + #define VM_NSWAP 8
"System", + { "_nswap" }, /* size of largest swap device */
"Idle", + #define VM_NSWDEV 9
+#ifdef __FreeBSD__ + { "_nswdev" }, /* number of swap devices */
+ "Swap", + #define VM_DMMAX 10
+#else + { "_dmmax" }, /* maximum size of a swap block */
"Free", + #define VM_SWAPLIST 11
+#endif + { "_swaplist" },/* list of free swap areas */
"Disk", + #define VM_SWDEVT 12
"Intrpts", + { "_swdevt" }, /* list of swap devices and sizes */
"Input", + { "" },
@@ -175,7 +183,11 @@ + };
"CPU", +
"CPU", + struct {
"CPU", + long time[CPUSTATES];
+#ifdef __FreeBSD__ + long xfer[DK_NDRIVE];
+ "Usage (MB)", + struct vmmeter Sum;
+#else + struct vmmeter Rate;
"Memory", + int interrupts;
+#endif + } s, s1;
"Transfers", +
"", + int off;
"Packets", +
diff -u ../xperfmon++.orig/xperfmon++.man ./xperfmon++.man + #define rate s.Rate
--- ../xperfmon++.orig/xperfmon++.man Wed Jul 27 22:29:39 1994 + #define sum s.Sum
+++ ./xperfmon++.man Sun Nov 12 00:14:56 1995 +
@@ -94,8 +94,8 @@ + /*
.B \-idlecpu | \+idlecpu + This routine does all necessary setting up of structures
Graph \fIIdle\fP CPU Percentage. + that will handle system calls.
.TP 26 + */
-.B \-freemem | \+freemem + void sys_setup()
-Graph \fIFree Memory\fP. + {
+.B \-{freemem/usedswap} | \+{freemem/usedswap} + get_namelist(getbootfile(), _PATH_KMEM);
+Graph \fIFree Memory/Used Swap (Operating system dependent, swap only for FreeBSD)\fP. + collect_stats();
.TP 26 + /* hack to enforce a resize of the 'Free Swap' graph
.B \-diskxfr | \+diskxfr + without this the left border always displays the first drawn line
Graph \fIDisk Transfers\fP per interval period. + cause this field isn't resized very often due to slow change of
@@ -176,8 +176,8 @@ + the free swapspace! */
.B idle + off = 100 - get_swapspace();
Set \fIlimit\fP value for Idle CPU Percentage. + etime = 1.0;
.TP 12 + }
-.B mem +
-Set \fIlimit\fP value for Free Memory. +
+.B mem/swap + /*
+Set \fIlimit\fP value for Free Memory/Used Swap (OS dependent, swap only for FreeBSD). + Update the data structures
.TP 12 + */
.B disk + void update_stats()
Set \fIlimit\fP value for Disk Transfers. + {
@@ -314,7 +314,7 @@ + int state;
Set System CPU Percentage resource. + double pct, tot;;
.TP 16 +
.B Free + collect_stats();
-Set Free Memory resource. +
+Set Free Memory/Swap resource. + tot = 0;
.TP 16 + for (state = 0; state < CPUSTATES; ++state)
.B Disk + tot += s.time[state];
Set Disk Transfer count resource. + if (tot)
diff -u ../xperfmon++.orig/xperfmon.c ./xperfmon.c + pct = 100 / tot;
--- ../xperfmon++.orig/xperfmon.c Wed Jul 27 22:29:39 1994 + else
+++ ./xperfmon.c Sun Nov 12 00:13:55 1995 + pct = 0;
@@ -58,6 +58,10 @@ + current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
* + current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
*/ + current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
+
+#ifdef __FreeBSD__ + if (perfmon[FREE_MEM]) {
+#include <osreldate.h> + current_values[FREE_MEM] = get_swapspace() + off;
+#endif + off = 0;
+ + }
#include <stdio.h> + if (perfmon[DISK_TRANSFERS])
#include <X11/IntrinsicP.h> + current_values[DISK_TRANSFERS] = total_disk_transfers();
#include <X11/StringDefs.h> + if (perfmon[INTERRUPTS])
@@ -94,6 +98,11 @@ + current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
{ NULL, NULL }, + if (perfmon[INPUT_PACKETS])
}; + current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
+ if (perfmon[OUTPUT_PACKETS])
+/* LK!!! */ + current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
+#define MIN_WIDTH 240 + if (perfmon[COLLISION_PACKETS])
+#define MIN_HEIGHT 430 + current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
+ + if (perfmon[NFS_CLIENT_CALLS])
+ + current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
#define XtNinterval "interval" + if (perfmon[NFS_SERVER_CALLS])
#define XtNcount "count" + current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
#define XtCCount "Count" + }
@@ -171,11 +180,17 @@ +
static XrmOptionDescRec optionDescList[] = { +
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL}, + /*
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" }, + Collect the overall disk transfer rates
- + */
+#if __FreeBSD_version >= 199504 + int
+ { "-lowswapAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL }, + total_disk_transfers()
+ { "-lowswapWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL }, + {
+ { "-highswapAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL }, + register int i, total_xfers = 0;
+ { "-highswapWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL }, +
+#else + for(i=0; i < DK_NDRIVE; i++)
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL }, + total_xfers += s.xfer[i];
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL }, + return(total_xfers/etime);
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL }, + }
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL }, +
+#endif +
+ /*
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL }, + Collect all the data
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL }, + */
@@ -237,8 +252,13 @@ + void
{ "+systemcpu", XtNsystemcpuAdd, XrmoptionNoArg, "TRUE" }, + collect_stats()
{ "-idlecpu", XtNidlecpuSub, XrmoptionNoArg, "True" }, + {
{ "+idlecpu", XtNidlecpuAdd, XrmoptionNoArg, "TRUE" }, + off_t ifnetaddr;
+#if __FreeBSD_version >= 199504 + register int i, tmp;
+ { "-usedswap", XtNfreememSub, XrmoptionNoArg, "True" }, + int mib[3], size;
+ { "+usedswap", XtNfreememAdd, XrmoptionNoArg, "TRUE" }, +
+#else + kread(X_CPTIME, s.time, sizeof(s.time));
{ "-freemem", XtNfreememSub, XrmoptionNoArg, "True" }, + kread(X_DKXFER, s.xfer, sizeof(s.xfer));
{ "+freemem", XtNfreememAdd, XrmoptionNoArg, "TRUE" }, + kread(X_SUM, &sum, sizeof(sum) );
+#endif +
{ "-diskxfr", XtNdiskxfrSub, XrmoptionNoArg, "True" }, + nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
{ "+diskxfr", XtNdiskxfrAdd, XrmoptionNoArg, "TRUE" }, + if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
{ "-interrupts", XtNinterruptsSub , XrmoptionNoArg, "True" }, + err(1, "xperfmon++ malloc in collect_stats");
@@ -344,7 +364,11 @@ + nintr /= sizeof(long);
fprintf(stderr, " [{-+}usercpu] ({remove|add} usercpu to list of graphs\n"); + kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
fprintf(stderr, " [{-+}systemcpu] ({remove|add} systemcpu to list of graphs\n"); + s1.interrupts = s.interrupts;
fprintf(stderr, " [{-+}idlecpu] ({remove|add} idlecpu to list of graphs\n"); + s.interrupts = 0;
+#if __FreeBSD_version >= 199504 + for (i = 0; i < nintr; i++)
+ fprintf(stderr, " [{-+}usedswap] ({remove|add} usedswap to list of graphs\n"); + s.interrupts += *(intrcnt + i);
+#else +
fprintf(stderr, " [{-+}freemem] ({remove|add} freemem to list of graphs\n"); + free(intrcnt);
+#endif + etime = 0;
fprintf(stderr, " [{-+}diskxfr] ({remove|add} disk transfers to list of graphs\n"); + for (i=0; i < DK_NDRIVE; i++) {
fprintf(stderr, " [{-+}interrupts] ({remove|add} interrupts to list of graphs\n"); + tmp = s.xfer[i];
fprintf(stderr, " [{-+}inputpkts] ({remove|add} input packets to list of graphs\n"); + s.xfer[i] -= s1.xfer[i];
@@ -361,10 +385,18 @@ + s1.xfer[i] = tmp;
fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n"); + }
fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n"); + for (i=0; i < CPUSTATES; i++) {
fprintf(stderr, " Where \"*\" is one of the following:\n"); + tmp = s.time[i];
+#if __FreeBSD_version >= 199504 + s.time[i] -= s1.time[i];
+ fprintf(stderr, " [swap | user | sys | idle | disk | intrpts |\n"); + s1.time[i] = tmp;
+#else + etime += s.time[i];
fprintf(stderr, " [mem | user | sys | idle | disk | intrpts |\n"); + }
+#endif + if(etime == 0.)
fprintf(stderr, " input | output | collision | nfsclient | nfsserver]\n"); + etime = 1.;
fprintf(stderr, " For Example:\n"); + etime /= hz;
+#if __FreeBSD_version >= 199504 +
+ fprintf(stderr, " [-lowswapAlarm {value}] ( Set low Free Swap Alarm Value)\n"); + /*
+#else + Collect the Network-Traffic
fprintf(stderr, " [-lowmemAlarm {value}] ( Set low Free Memory Alarm Value)\n"); + */
+#endif +
fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n"); + if (nl[N_IFNET].n_value != 0) {
exit(1); + struct ifnet ifnet;
} + kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
@@ -386,6 +418,7 @@ + old_packets = packets;
time(&timeStamp); + packets.input = packets.output = packets.collisions = 0;
return; + while (ifnetaddr) {
} + kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
+ + packets.input += ifnet.if_ipackets;
/*ARGSUSED*/ + packets.output += ifnet.if_opackets;
void handleResize( w, unused, event, contin2disp ) + packets.collisions += ifnet.if_collisions;
Widget w; + ifnetaddr = (u_long) ifnet.if_next;
@@ -419,9 +452,15 @@ + }
break; + }
+
} + /*
- if ( neww < 250 + 10 ) { + Collect the NFS and RPC Calls
- neww = 250 + 10; + */
- w->core.width = 250 + 10; +
+ if ( neww < MIN_WIDTH + 10 ) { + size = sizeof(nfsstats);
+ neww = MIN_WIDTH + 10; + mib[0] = CTL_FS;
+ w->core.width = MIN_WIDTH + 10; + mib[1] = MOUNT_NFS;
+ XtResizeWindow(w); + mib[2] = NFS_NFSSTATS;
+ } +
+/* LK!!! */ + if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
+ if ( newh < MIN_HEIGHT + 10 ) { + return;
+ newh = MIN_HEIGHT + 10; + else {
+ w->core.height = MIN_HEIGHT + 10; + old_nfsStats = nfsStats;
XtResizeWindow(w); +
} + nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
if ( appData.debug ) + nfsstats.rpccnt[NFSPROC_SETATTR] +
@@ -436,6 +475,7 @@ + nfsstats.rpccnt[NFSPROC_LOOKUP] +
Dimension boxH = labelBox->core.height; + nfsstats.rpccnt[NFSPROC_READLINK] +
Dimension timeH = timechart->core.height; + nfsstats.rpccnt[NFSPROC_READ] +
Dimension newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn; + nfsstats.rpccnt[NFSPROC_WRITE] +
+ + nfsstats.rpccnt[NFSPROC_CREATE] +
if ( oldWidth == neww && oldHeight == newh ) return; + nfsstats.rpccnt[NFSPROC_REMOVE] +
+ nfsstats.rpccnt[NFSPROC_RENAME] +
if ( appData.debug ) + nfsstats.rpccnt[NFSPROC_LINK] +
@@ -464,6 +504,9 @@ + nfsstats.rpccnt[NFSPROC_SYMLINK] +
int argc; + nfsstats.rpccnt[NFSPROC_MKDIR] +
char **argv; + nfsstats.rpccnt[NFSPROC_RMDIR] +
{ + nfsstats.rpccnt[NFSPROC_READDIR] +
+/* LK!!! */ + #ifndef HAS_NFS_V3
+ Dimension neww, newh, timeH, newWidgetH, hOverHead, boxH; + nfsstats.rpccnt[NFSPROC_STATFS] +
+ + nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
Arg arg; + #else /* HAS_NFS_V3 */
Pixmap icon_pixmap = None; + nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
Widget loadParent, pappaBox; + nfsstats.rpccnt[NFSPROC_FSSTAT] +
@@ -540,7 +583,6 @@ + nfsstats.rpccnt[NFSPROC_FSINFO] +
xperfmon_width, xperfmon_height)); + nfsstats.rpccnt[NFSPROC_PATHCONF] +
XtSetValues(appData.toplevel, &arg, 1); + nfsstats.rpccnt[NFSPROC_COMMIT] +
} + #endif /* HAS_NFS_V3 */
- + nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
/* create windows */ + nfsstats.rpccnt[NQNFSPROC_VACATED] +
+ nfsstats.rpccnt[NQNFSPROC_EVICTED];
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel, +
@@ -553,8 +595,24 @@ + nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
c = (char *) ((long) &hostname[0] + (int) strlen(hostname)); + nfsstats.srvrpccnt[NFSPROC_SETATTR] +
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0); + nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
+ nfsstats.srvrpccnt[NFSPROC_READLINK] +
+/* LK!!! quick and dirty hack */ + nfsstats.srvrpccnt[NFSPROC_READ] +
+ XtRealizeWidget(appData.toplevel); + nfsstats.srvrpccnt[NFSPROC_WRITE] +
+ + nfsstats.srvrpccnt[NFSPROC_CREATE] +
+ neww = appData.toplevel->core.width; + nfsstats.srvrpccnt[NFSPROC_REMOVE] +
+ newh = appData.toplevel->core.height; + nfsstats.srvrpccnt[NFSPROC_RENAME] +
+ if ( neww < MIN_WIDTH + 10) { + nfsstats.srvrpccnt[NFSPROC_LINK] +
+ neww = MIN_WIDTH + 10; + nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
+ appData.toplevel->core.width = MIN_WIDTH + 10; + nfsstats.srvrpccnt[NFSPROC_MKDIR] +
+ XtResizeWindow(appData.toplevel); + nfsstats.srvrpccnt[NFSPROC_RMDIR] +
+ } + nfsstats.srvrpccnt[NFSPROC_READDIR] +
+ if ( newh < MIN_HEIGHT + 10) { + #ifndef HAS_NFS_V3
+ newh = MIN_HEIGHT + 10; + nfsstats.srvrpccnt[NFSPROC_STATFS] +
+ appData.toplevel->core.height = MIN_HEIGHT + 10; + nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
+ XtResizeWindow(appData.toplevel); + #else /* HAS_NFS_V3 */
+ } + nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
+ neww -= 10; + nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox, + nfsstats.srvrpccnt[NFSPROC_FSINFO] +
- XtNwidth, 250, + nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
+ XtNwidth, neww, + nfsstats.srvrpccnt[NFSPROC_COMMIT] +
/* XtNheight, 16,*/ + #endif /* HAS_NFS_V3 */
XtNjustify, XtJustifyLeft, + nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
XtNinternalHeight, 0, + nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
@@ -562,6 +620,13 @@ + nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
XtNlabel, hostname, + }
XtNborderWidth, 0, + }
NULL); +
+ +
+/* same as in handleResize */ + /*
+ hOverHead = 5 * appData.numGraphsOn; + Reads the nlist from the kernel
+ boxH = labelBox->core.height; + */
+ timeH = 18; + int
+ newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn; + get_namelist(kernel_name, memory_name)
+ + const char *kernel_name, *memory_name;
/* build the graph widgets */ + {
+ time_t now;
for ( i=0; i<NUM_GRAPHS; i++ ) { + time_t boottime;
@@ -570,8 +635,8 @@ + register int i, c;
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox, + int nintv;
XtNtopLabel, topNames[i], +
XtNbotLabel, botNames[i], + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
- XtNwidth, 250, + if (kd == 0) {
- XtNheight, 36, + (void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
+ XtNwidth, neww, + exit(1);
+ XtNheight, newWidgetH, + }
XtNupdate, appData.interval*appData.ms_per_sec, +
XtNfillRect, (int)appData.fill, + if ((c = kvm_nlist(kd, nl)) != 0) {
XtNjumpScroll, 1, + if (c > 0) {
@@ -580,7 +645,7 @@ + (void)fprintf(stderr,"xperfmon++: undefined symbols:");
} + for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox, + if (nl[c].n_type == 0)
XtNfromVert, perfmon[1], + fprintf(stderr, " %s", nl[c].n_name);
- XtNwidth, 250, + (void)fputc('\n', stderr);
+ XtNwidth, neww, + } else
XtNheight, 18, + (void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
XtNupdate, appData.interval*appData.ms_per_sec, + }
XtNjumpScroll, 1, +
@@ -590,7 +655,7 @@ + kread(X_BOOTTIME, &boottime, sizeof(boottime));
+ kread(X_HZ, &hz, sizeof(hz));
for ( i=0; i<NUM_GRAPHS; i++ ) + for (i = 0; i < DK_NDRIVE; i++) {
if ( appData.graphOn[i] ) + strcpy(dr_name[i], "xx");
- XtAddCallback(perfmon[i], XtNgetValue, update_stat, i); + }
+ XtAddCallback(perfmon[i], XtNgetValue, update_stat, (XtPointer)i); + time(&now);
+ nintv = now - boottime;
appData.interval_id = XtAppAddTimeOut(appData.app_context, + if (nintv <= 0 || nintv > 60*60*24*365*10) {
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel); + fprintf(stderr,
@@ -598,3 +663,4 @@ + "Time makes no sense... namelist must be wrong.\n");
XtRealizeWidget(appData.toplevel); + exit(1);
XtAppMainLoop(appData.app_context); + }
} + return(nintv);
+ + }
+
+
+ /*
+ Kread reads something from the kernel, given its nlist index.
+ */
+ static void
+ kread(nlx, addr, size)
+ int nlx;
+ void *addr;
+ size_t size;
+ {
+ char *sym;
+
+ if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
+ sym = nl[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ (void)fprintf(stderr,
+ "xpermon++: symbol %s not defined\n", sym);
+ exit(1);
+ }
+ if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
+ sym = nl[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ (void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
+ exit(1);
+ }
+ }
+
+ /*
+ * get_swapspace is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+ int
+ get_swapspace()
+ {
+ char *header;
+ int hlen, nswap, nswdev, dmmax;
+ int i, div, avail, nfree, npfree, used;
+ struct swdevt *sw;
+ long blocksize, *perdev;
+ struct rlist head;
+ struct rlist *swaplist;
+ u_long ptr;
+ kread(VM_NSWAP, &nswap, sizeof(nswap));
+ kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
+ kread(VM_DMMAX, &dmmax, sizeof(dmmax));
+ kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
+ if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
+ (perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
+ err(1, "xperfmon++ malloc in get_swapspace");
+ kread(VM_SWDEVT, &ptr, sizeof(ptr));
+ kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
+ /* Count up swap space. */
+ nfree = 0;
+ memset(perdev, 0, nswdev * sizeof(*perdev));
+ while (swaplist) {
+ int top, bottom, next_block;
+ kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
+ top = head.rl_end;
+ bottom = head.rl_start;
+
+ nfree += top - bottom + 1;
+
+ /*
+ * Swap space is split up among the configured disks.
+ *
+ * For interleaved swap devices, the first dmmax blocks
+ * of swap space some from the first disk, the next dmmax
+ * blocks from the next, and so on up to nswap blocks.
+ *
+ * The list of free space joins adjacent free blocks,
+ * ignoring device boundries. If we want to keep track
+ * of this information per device, we'll just have to
+ * extract it ourselves.
+ */
+ while (top / dmmax != bottom / dmmax) {
+ next_block = ((bottom + dmmax) / dmmax);
+ perdev[(bottom / dmmax) % nswdev] +=
+ next_block * dmmax - bottom;
+ bottom = next_block * dmmax;
+ }
+ perdev[(bottom / dmmax) % nswdev] +=
+ top - bottom + 1;
+
+ swaplist = head.rl_next;
+ }
+
+ header = getbsize(&hlen, &blocksize);
+ div = blocksize / 512;
+ avail = npfree = 0;
+ for (i = 0; i < nswdev; i++) {
+ int xsize, xfree;
+
+ /*
+ * Don't report statistics for partitions which have not
+ * yet been activated via swapon(8).
+ */
+ if (!(sw[i].sw_flags & SW_FREED))
+ continue;
+
+ /* The first dmmax is never allocated to avoid trashing of
+ * disklabels
+ */
+ xsize = sw[i].sw_nblks - dmmax;
+ xfree = perdev[i];
+ used = xsize - xfree;
+ npfree++;
+ avail += xsize;
+ }
+
+ /*
+ * If only one partition has been set up via swapon(8), we don't
+ * need to bother with totals.
+ */
+ used = avail - nfree;
+
+ free(perdev);
+ free(sw);
+ return((100*nfree)/avail); /* return free swap in percent */
+ }

View file

@ -1,90 +1,793 @@
diff -u ../xperfmon++.orig/StripCharP.h ./StripCharP.h diff -c -N ../xperfmon++/StripCharP.h ./StripCharP.h
--- ../xperfmon++.orig/StripCharP.h Wed Jul 27 22:29:30 1994 *** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
+++ ./StripCharP.h Sun Nov 12 00:07:24 1995 --- ./StripCharP.h Fri Dec 15 11:00:03 1995
@@ -62,10 +62,12 @@ ***************
#define HIGHLIGHT 1 << 1 *** 62,71 ****
#define ALL_GCS (FOREGROUND | HIGHLIGHT) #define HIGHLIGHT 1 << 1
#define ALL_GCS (FOREGROUND | HIGHLIGHT)
+#define NUM_VALUES 2048
+ /* New fields for the PerfChart widget instance record */
/* New fields for the PerfChart widget instance record */
typedef struct {
typedef struct { ! double valuedata[2048]; /* record of data points */
- double valuedata[2048]; /* record of data points */ Pixel fgpixel; /* color index for graph */
+ double valuedata[NUM_VALUES]; /* record of data points */ Pixel hipixel; /* color index for lines */
Pixel fgpixel; /* color index for graph */ Pixel warnColor;
Pixel hipixel; /* color index for lines */ --- 62,73 ----
Pixel warnColor; #define HIGHLIGHT 1 << 1
diff -u ../xperfmon++.orig/StripChart.c ./StripChart.c #define ALL_GCS (FOREGROUND | HIGHLIGHT)
--- ../xperfmon++.orig/StripChart.c Wed Jul 27 22:29:30 1994
+++ ./StripChart.c Sun Nov 12 00:07:24 1995 + #define NUM_VALUES 2048
@@ -215,8 +215,23 @@ +
static void Initialize (greq, gnew) /* New fields for the PerfChart widget instance record */
Widget greq, gnew;
{ typedef struct {
+ int i; ! double valuedata[NUM_VALUES]; /* record of data points */
+ Pixel fgpixel; /* color index for graph */
PerfChartWidget w = (PerfChartWidget)gnew; Pixel hipixel; /* color index for lines */
Pixel warnColor;
+ /* diff -c -N ../xperfmon++/StripChart.c ./StripChart.c
+ * XXX The missing initializations have been made obvious by FreeBSD 2.2's *** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
+ * new (`phk') malloc that doesn't initialize the malloc'ed areas to 0. --- ./StripChart.c Fri Dec 15 11:00:03 1995
+ * Perhaps more bogons will lurk around, but the floating arithmetic ones ***************
+ * have been the most annoying ones since they most likely cause a trap *** 53,58 ****
+ * at startup time. --- 53,64 ----
+ * #include <X11/StringDefs.h>
+ * Strange that people in the 90's still rely on malloc() #include <X11/Xaw/XawInit.h>
+ * returning an initialized region. #include "StripCharP.h"
+ */ + #ifdef __FreeBSD__
+ for ( i = 0; i < NUM_VALUES; i++ ) + #include <osreldate.h>
+ w->strip_chart.valuedata[i] = 0.0; + # if __FreeBSD_version >= 199504
+ + # include "system.h"
/* if we are working with a mono screen then turn off all warnings and alarms */ + # endif
+ #endif
if ( mono_screen ) { #include <X11/Xfuncs.h>
@@ -343,19 +358,19 @@
#define MS_PER_SEC 100
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */ ***************
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) { *** 108,114 ****
- XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL ); };
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor; #undef offset
} ! #define LABEL_ROOM 100
} static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */ static Boolean SetValues();
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) { static int repaint_window();
- XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL ); --- 114,124 ----
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL ); };
w->strip_chart.currentBG = w->strip_chart.warnColor;
} #undef offset
} ! #if __FreeBSD_version >= 199504
else { ! # define LABEL_ROOM 80
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */ ! #else
- XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL ); ! # define LABEL_ROOM 100
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL ); ! #endif
w->strip_chart.currentBG = w->strip_chart.okColor; static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
} static Boolean SetValues();
} static int repaint_window();
@@ -373,19 +388,19 @@ ***************
*** 215,222 ****
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */ --- 225,247 ----
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) { static void Initialize (greq, gnew)
- XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL ); Widget greq, gnew;
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL ); {
w->strip_chart.currentBG = w->strip_chart.alarmColor; + int i;
} +
} PerfChartWidget w = (PerfChartWidget)gnew;
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) { + /*
- XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL ); + * XXX The missing initializations have been made obvious by FreeBSD 2.2's
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL ); + * new (`phk') malloc that doesn't initialize the malloc'ed areas to 0.
w->strip_chart.currentBG = w->strip_chart.warnColor; + * Perhaps more bogons will lurk around, but the floating arithmetic ones
} + * have been the most annoying ones since they most likely cause a trap
} + * at startup time.
else { + *
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */ + * Strange that people in the 90's still rely on malloc()
- XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL ); + * returning an initialized region.
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL ); + */
w->strip_chart.currentBG = w->strip_chart.okColor; + for ( i = 0; i < NUM_VALUES; i++ )
} + w->strip_chart.valuedata[i] = 0.0;
} +
/* if we are working with a mono screen then turn off all warnings and alarms */
if ( mono_screen ) {
***************
*** 323,330 ****
w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
}
}
! if (value < w->strip_chart.min_value)
! w->strip_chart.min_value = value;
w->strip_chart.valuedata[w->strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) {
--- 348,355 ----
w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
}
}
! if (value < w->strip_chart.min_value)
! w->strip_chart.min_value = value;
w->strip_chart.valuedata[w->strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) {
***************
*** 343,361 ****
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
--- 368,386 ----
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
***************
*** 373,391 ****
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
--- 398,416 ----
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
***************
*** 448,455 ****
/* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */
! if (w->strip_chart.interval != 0 || scale <= (int)w->strip_chart.max_value)
! scale = ((int) (w->strip_chart.max_value)) + 1;
if (scale < w->strip_chart.min_scale)
scale = w->strip_chart.min_scale;
--- 473,487 ----
/* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */
!
! if (w->strip_chart.interval != 0 || scale <= (int)w->strip_chart.max_value) {
! #if __FreeBSD_version >= 199504
! if (strcmp(w->strip_chart.botLabel, botNames[FREE_MEM]) != 0 || w->strip_chart.max_value == 100)
! scale = ((int) (w->strip_chart.max_value)) + 1;
! #else
! scale = ((int) (w->strip_chart.max_value)) + 1;
! #endif
! }
if (scale < w->strip_chart.min_scale)
scale = w->strip_chart.min_scale;
***************
*** 479,490 ****
/* draw titles */
if ( w->strip_chart.topLabel ) {
! y = w->core.height/2;
x = 4;
XDS(w->strip_chart.topLabel);
}
if ( w->strip_chart.botLabel ) {
! y = (w->core.height/2) + w->strip_chart.font_height;
x = 4;
XDS(w->strip_chart.botLabel);
}
--- 511,522 ----
/* draw titles */
if ( w->strip_chart.topLabel ) {
! y = w->core.height/2 - 2;
x = 4;
XDS(w->strip_chart.topLabel);
}
if ( w->strip_chart.botLabel ) {
! y = (w->core.height/2 - 2) + w->strip_chart.font_height;
x = 4;
XDS(w->strip_chart.botLabel);
}
diff -c -N ../xperfmon++/TimeChart.h ./TimeChart.h
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
--- ./TimeChart.h Fri Dec 15 11:00:03 1995
***************
*** 88,99 ****
#define XtCFillRect "FillRect"
#define XtNgetValue "getValue"
! #define XtNhighlight "highlight"
#define XtNjumpScroll "jumpScroll"
#define XtNminScale "minScale"
#define XtNscale "scale"
#define XtNfillRect "fillRect"
! #define XtNupdate "update"
#define XtNvmunix "vmunix"
typedef struct _TimeChartRec *TimeChartWidget;
--- 88,99 ----
#define XtCFillRect "FillRect"
#define XtNgetValue "getValue"
! /* #define XtNhighlight "highlight" */
#define XtNjumpScroll "jumpScroll"
#define XtNminScale "minScale"
#define XtNscale "scale"
#define XtNfillRect "fillRect"
! /* #define XtNupdate "update" */
#define XtNvmunix "vmunix"
typedef struct _TimeChartRec *TimeChartWidget;
diff -c -N ../xperfmon++/misc.c ./misc.c
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
--- ./misc.c Fri Dec 15 11:00:04 1995
***************
*** 58,64 ****
int i, keycode, length = 0;
/* PerfmonWidget pw = (PerfmonWidget) w;*/
! length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL);
switch (keycode) {
case 'Q':
case 'q':
--- 58,64 ----
int i, keycode, length = 0;
/* PerfmonWidget pw = (PerfmonWidget) w;*/
! length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL);
switch (keycode) {
case 'Q':
case 'q':
diff -c -N ../xperfmon++/system.h ./system.h
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
--- ./system.h Fri Dec 15 11:00:03 1995
***************
*** 151,168 ****
--- 151,182 ----
"Idle",
"Free",
"Disk",
+ #ifdef __FreeBSD__
+ "Inter-",
+ #else
"Interrupts",
+ #endif
"Input",
"Output",
+ #ifdef __FreeBSD__
+ "Collis",
+ "NFS Clt",
+ "NFS Srv",
+ #else
"Collision",
"NFS Client",
"NFS Server",
+ #endif
};
static char *widgetLabels[] = {
"User",
"System",
"Idle",
+ #ifdef __FreeBSD__
+ "Swap",
+ #else
"Free",
+ #endif
"Disk",
"Intrpts",
"Input",
***************
*** 171,177 ****
--- 185,205 ----
"NFSClient",
"NFSServer",
};
+
static char *botNames[] = {
+ #ifdef __FreeBSD__
+ "CPU (%)",
+ "CPU (%)",
+ "CPU (%)",
+ "Swap (%)",
+ "Trsf/s",
+ "rupts/s",
+ "Pkts/s",
+ "Pkts/s",
+ "Pkts/s",
+ "Calls/s",
+ "Calls/s",
+ #else
"CPU",
"CPU",
"CPU",
***************
*** 183,186 ****
--- 211,215 ----
"Packets",
"Calls",
"Calls",
+ #endif
};
diff -c -N ../xperfmon++/xperfmon.c ./xperfmon.c
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
--- ./xperfmon.c Fri Dec 15 11:00:04 1995
***************
*** 58,63 ****
--- 58,67 ----
*
*/
+ #ifdef __FreeBSD__
+ #include <osreldate.h>
+ #endif
+
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
***************
*** 94,99 ****
--- 98,108 ----
{ NULL, NULL },
};
+ /* LK!!! */
+ int MIN_HEIGHT=420;
+ #define MIN_WIDTH 185
+ #define GRAPH_MIN_HEIGHT 28
+
#define XtNinterval "interval"
#define XtNcount "count"
#define XtCCount "Count"
***************
*** 101,110 ****
#define XtCFill "Fill"
#define XtNfast "fast"
#define XtCFast "Fast"
- #define XtNstufAdd "stufAdd"
- #define XtCStufAdd "StufAdd"
- #define XtNstufSub "stufSub"
- #define XtCStufSub "StufSub"
#define XtNdebug "debug"
#define XtCDebug "Debug"
#define XtNusercpuAdd "usercpuAdd"
--- 110,115 ----
***************
*** 171,181 ****
static XrmOptionDescRec optionDescList[] = {
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL},
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
!
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL },
--- 176,192 ----
static XrmOptionDescRec optionDescList[] = {
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL},
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
! #if __FreeBSD_version >= 199504
! { "-lowswapAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
! { "-lowswapWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
! { "-highswapAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
! { "-highswapWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
! #else
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
+ #endif
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL },
***************
*** 237,244 ****
--- 248,260 ----
{ "+systemcpu", XtNsystemcpuAdd, XrmoptionNoArg, "TRUE" },
{ "-idlecpu", XtNidlecpuSub, XrmoptionNoArg, "True" },
{ "+idlecpu", XtNidlecpuAdd, XrmoptionNoArg, "TRUE" },
+ #if __FreeBSD_version >= 199504
+ { "-freeswap", XtNfreememSub, XrmoptionNoArg, "True" },
+ { "+freeswap", XtNfreememAdd, XrmoptionNoArg, "TRUE" },
+ #else
{ "-freemem", XtNfreememSub, XrmoptionNoArg, "True" },
{ "+freemem", XtNfreememAdd, XrmoptionNoArg, "TRUE" },
+ #endif
{ "-diskxfr", XtNdiskxfrSub, XrmoptionNoArg, "True" },
{ "+diskxfr", XtNdiskxfrAdd, XrmoptionNoArg, "TRUE" },
{ "-interrupts", XtNinterruptsSub , XrmoptionNoArg, "True" },
***************
*** 253,269 ****
{ "+nfsclient", XtNnfsclientAdd, XrmoptionNoArg, "TRUE" },
{ "-nfsserver", XtNnfsserverSub, XrmoptionNoArg, "True" },
{ "+nfsserver", XtNnfsserverAdd, XrmoptionNoArg, "TRUE" },
- { "-stuf", XtNstufAdd, XrmoptionNoArg, (XtPointer)"True" },
- { "+stuf", XtNstufSub, XrmoptionNoArg, (XtPointer)"True" },
};
/* Application Resource List - no particular widget */
static XtResource resources[] = {
- { XtNstufAdd, XtCStufAdd, XtRBool, sizeof(Bool),
- XtOffsetOf(AppData, addG[1]), XtRImmediate, (XtPointer) NULL },
- { XtNstufSub, XtCStufSub, XtRBool, sizeof(Bool),
- XtOffsetOf(AppData, subG[0]), XtRImmediate, (XtPointer) NULL },
{ XtNinterval, XtCInterval, XtRInt, sizeof(int),
XtOffsetOf(AppData, interval), XtRImmediate, (caddr_t) DEF_INTERVAL },
{ XtNcount, XtCCount, XtRInt, sizeof(int),
--- 269,279 ----
***************
*** 324,329 ****
--- 334,342 ----
void
usage()
{
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, "\nxperfmon++ V1.3 for FreeBSD-2.X\n");
+ #endif
fprintf(stderr, "\nusage: xperfmon++ option option option .....\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " [-display [{host}]:[{vs}]]\n");
***************
*** 344,350 ****
--- 357,367 ----
fprintf(stderr, " [{-+}usercpu] ({remove|add} usercpu to list of graphs\n");
fprintf(stderr, " [{-+}systemcpu] ({remove|add} systemcpu to list of graphs\n");
fprintf(stderr, " [{-+}idlecpu] ({remove|add} idlecpu to list of graphs\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [{-+}freeswap] ({remove|add} freeswap to list of graphs\n");
+ #else
fprintf(stderr, " [{-+}freemem] ({remove|add} freemem to list of graphs\n");
+ #endif
fprintf(stderr, " [{-+}diskxfr] ({remove|add} disk transfers to list of graphs\n");
fprintf(stderr, " [{-+}interrupts] ({remove|add} interrupts to list of graphs\n");
fprintf(stderr, " [{-+}inputpkts] ({remove|add} input packets to list of graphs\n");
***************
*** 361,370 ****
--- 378,395 ----
fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n");
fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n");
fprintf(stderr, " Where \"*\" is one of the following:\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [swap | user | sys | idle | disk | intrpts |\n");
+ #else
fprintf(stderr, " [mem | user | sys | idle | disk | intrpts |\n");
+ #endif
fprintf(stderr, " input | output | collision | nfsclient | nfsserver]\n");
fprintf(stderr, " For Example:\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [-lowswapAlarm {value}] ( Set low Free Swap Alarm Value)\n");
+ #else
fprintf(stderr, " [-lowmemAlarm {value}] ( Set low Free Memory Alarm Value)\n");
+ #endif
fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n");
exit(1);
}
***************
*** 386,391 ****
--- 411,417 ----
time(&timeStamp);
return;
}
+
/*ARGSUSED*/
void handleResize( w, unused, event, contin2disp )
Widget w;
***************
*** 394,399 ****
--- 420,426 ----
Boolean *contin2disp;
{
Dimension neww, newh;
+ Dimension hOverHead, boxH, timeH, newWidgetH;
int i;
char eventString[60];
switch (event->type) {
***************
*** 417,429 ****
newh=event->xconfigure.height;
strcpy(eventString,"configure");
break;
}
! if ( neww < 250 + 10 ) {
! neww = 250 + 10;
! w->core.width = 250 + 10;
! XtResizeWindow(w);
}
if ( appData.debug )
printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n",
(int)event->type, eventString,
--- 444,474 ----
newh=event->xconfigure.height;
strcpy(eventString,"configure");
break;
+ }
+ if ( neww < MIN_WIDTH ) {
+ neww = MIN_WIDTH;
+ w->core.width = MIN_WIDTH;
+ } else {
+ w->core.width = neww;
}
!
! if ( newh < MIN_HEIGHT ) {
! newh = MIN_HEIGHT;
! w->core.height = MIN_HEIGHT;
! }
!
! /* Now the graphs fit perfect into the window! */
! hOverHead = (5.6 * appData.numGraphsOn) - (6 / appData.numGraphsOn);
! boxH = labelBox->core.height;
! timeH = timechart->core.height;
! newWidgetH = (newh - (boxH+7) - (timeH+10) - hOverHead) / appData.numGraphsOn;
! w->core.height = newWidgetH * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10);
! if(w->core.height != newh) {
! newh = w->core.height;
}
+ XtResizeWindow(w);
+
if ( appData.debug )
printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n",
(int)event->type, eventString,
***************
*** 431,448 ****
neww, newh);
if ( event->type == ConfigureNotify ) {
! /* Dimension h = perfmon[0]->core.height;*/
! Dimension hOverHead = 5 * appData.numGraphsOn;
! Dimension boxH = labelBox->core.height;
! Dimension timeH = timechart->core.height;
! Dimension newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn;
if ( oldWidth == neww && oldHeight == newh ) return;
if ( appData.debug )
printf("BoxH=%hu, timeH=%hu, numGraphOn=%hu, newWidgetH=%hu\n",
boxH, timeH, appData.numGraphsOn, newWidgetH);
! neww -= 10; /* allow for spacing and borders */
for ( i=0; i<NUM_GRAPHS; i++ ) {
if ( appData.graphOn[i] ) {
--- 476,489 ----
neww, newh);
if ( event->type == ConfigureNotify ) {
!
if ( oldWidth == neww && oldHeight == newh ) return;
if ( appData.debug )
printf("BoxH=%hu, timeH=%hu, numGraphOn=%hu, newWidgetH=%hu\n",
boxH, timeH, appData.numGraphsOn, newWidgetH);
! neww -= 10; /* allow for spacing and borders */
for ( i=0; i<NUM_GRAPHS; i++ ) {
if ( appData.graphOn[i] ) {
***************
*** 464,472 ****
int argc;
char **argv;
{
Arg arg;
Pixmap icon_pixmap = None;
! Widget loadParent, pappaBox;
char *progname = argv[0];
Bool foundAnAdd = FALSE;
--- 505,517 ----
int argc;
char **argv;
{
+ /* LK!!! */
+ Dimension timeH, newWidgetW, newWidgetH, hOverHead, boxH;
+ unsigned int w, h;
+
Arg arg;
Pixmap icon_pixmap = None;
! Widget pappaBox;
char *progname = argv[0];
Bool foundAnAdd = FALSE;
***************
*** 540,561 ****
xperfmon_width, xperfmon_height));
XtSetValues(appData.toplevel, &arg, 1);
}
-
/* create windows */
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel,
XtNborderWidth, 0,
NULL);
-
XtOverrideTranslations(pappaBox, XtParseTranslationTable(defaultTranslations));
(void)gethostname(hostname, sizeof(hostname));
c = (char *) ((long) &hostname[0] + (int) strlen(hostname));
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0);
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox,
! XtNwidth, 250,
! /* XtNheight, 16,*/
XtNjustify, XtJustifyLeft,
XtNinternalHeight, 0,
XtNtop, XtChainTop,
--- 585,636 ----
xperfmon_width, xperfmon_height));
XtSetValues(appData.toplevel, &arg, 1);
}
/* create windows */
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel,
XtNborderWidth, 0,
NULL);
XtOverrideTranslations(pappaBox, XtParseTranslationTable(defaultTranslations));
(void)gethostname(hostname, sizeof(hostname));
c = (char *) ((long) &hostname[0] + (int) strlen(hostname));
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0);
+ { /* LK!!! handle -geometry option correct, also small changes in handleResize */
+ Window rwin;
+ int x,y,px,py;
+ unsigned int pw,ph,bw,d;
+
+ XtRealizeWidget(appData.toplevel);
+
+ XGetGeometry(XtDisplay(appData.toplevel),XtWindow(appData.toplevel),
+ &rwin,&x,&y,&w,&h,&bw,&d);
+
+ if ( w > MIN_WIDTH) {
+ newWidgetW = w - 10;
+ appData.toplevel->core.width = w;
+ } else {
+ appData.toplevel->core.width = MIN_WIDTH;
+ newWidgetW = MIN_WIDTH - 10;
+ }
+
+ hOverHead = (5.6 * appData.numGraphsOn) - (6 / appData.numGraphsOn);
+ boxH = 22;
+ timeH = 12;
+ if (h > GRAPH_MIN_HEIGHT * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10))
+ newWidgetH = (h - hOverHead - (boxH+7) - (timeH+10)) / appData.numGraphsOn;
+ else
+ newWidgetH = GRAPH_MIN_HEIGHT;
+
+ MIN_HEIGHT = newWidgetH * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10);
+ appData.toplevel->core.height = MIN_HEIGHT;
+
+ XtResizeWindow(appData.toplevel);
+ }
+
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox,
! XtNwidth, newWidgetW,
! XtNheight, boxH,
XtNjustify, XtJustifyLeft,
XtNinternalHeight, 0,
XtNtop, XtChainTop,
***************
*** 570,577 ****
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
XtNtopLabel, topNames[i],
XtNbotLabel, botNames[i],
! XtNwidth, 250,
! XtNheight, 36,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNfillRect, (int)appData.fill,
XtNjumpScroll, 1,
--- 645,652 ----
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
XtNtopLabel, topNames[i],
XtNbotLabel, botNames[i],
! XtNwidth, newWidgetW,
! XtNheight, newWidgetH,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNfillRect, (int)appData.fill,
XtNjumpScroll, 1,
***************
*** 580,600 ****
}
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
XtNfromVert, perfmon[1],
! XtNwidth, 250,
! XtNheight, 18,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNjumpScroll, 1,
NULL);
sys_setup();
XtAddCallback(timechart, XtNgetValue, update_time_stat, NULL);
for ( i=0; i<NUM_GRAPHS; i++ )
if ( appData.graphOn[i] )
! XtAddCallback(perfmon[i], XtNgetValue, update_stat, i);
appData.interval_id = XtAppAddTimeOut(appData.app_context,
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
- XtRealizeWidget(appData.toplevel);
XtAppMainLoop(appData.app_context);
}
--- 655,676 ----
}
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
XtNfromVert, perfmon[1],
! XtNwidth, newWidgetW,
! XtNheight, timeH,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNjumpScroll, 1,
NULL);
+
sys_setup();
XtAddCallback(timechart, XtNgetValue, update_time_stat, NULL);
for ( i=0; i<NUM_GRAPHS; i++ )
if ( appData.graphOn[i] )
! XtAddCallback(perfmon[i], XtNgetValue, update_stat, (XtPointer)i);
appData.interval_id = XtAppAddTimeOut(appData.app_context,
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
XtAppMainLoop(appData.app_context);
}
+

View file

@ -1 +1,4 @@
xperfmon++, version 1.1 (with shared libs for X11 and FreeBSD 2.X) xperfmon++, version 1.3 (compiled with shared libs for X11 and FreeBSD 2.X).
A graphical X11 system performance monitor dispaying user/system/idle CPU time,
free swap, disk io, network traffic and nfs calls.

View file

@ -1,8 +1,17 @@
This package contains the binary release of xperfmon++ V1.1 a X based This package contains the binary release of xperfmon++ V1.3 a X based
system performance meter for several systems, ported to FreeBSD 2.X. system performance meter for several systems, ported to FreeBSD 2.X.
The program monitors user-, system-, idle-cputime, free mem, disk io, The program monitors user-, system-, idle-cputime, free swap, disk io,
number of interrupts, network-input, -output, -collision packets and number of interrupts, network-input, -output, -collision packets and
NFS client and server activity. NFS client and server activity.
Please send BUGS and annotations to: lars.koeller@odie.physik2.uni-rostock.de Please send BUGS and annotations to: lars.koeller@odie.physik2.uni-rostock.de
Major changes in xperfmon++ V1.3 due to xperfmon++ V1.1:
- Clean fix of the -geometry option bug, now there is only
a MIN_WIDTH of 185 pixels. The MIN_HEIGTH is calculated
dynamically out of the number of active graphs.
- Display 'Free Swap' in percent without resizing of the graph
- Close some memory leaks
- Display unit of graph in label field.

View file

@ -1,17 +1,17 @@
# New ports collection makefile for: xpermon++ V1.1 # New ports collection makefile for: xperfmon++ V1.3
# Version required: 1.1 # Version required: 1.1
# Date created: 8 March 95 # Date created: 15 December 95
# Whom: Lars Koeller <lars.koeller@odie.physik2.uni-rostock.de> # Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
# #
# $Id: Makefile,v 1.5 1995/05/19 09:40:06 asami Exp $ # $Id: Makefile,v 1.6 1995/12/15 11:16:54 Lars Koeller Exp $
# #
PREFIX= /usr/X11R6
DISTNAME= xperfmon++ DISTNAME= xperfmon++
PKGNAME= xperfmon-1.1 PKGNAME= xperfmon-1.3
USE_IMAKE= yes USE_IMAKE= yes
CATEGORIES+= sysutils CATEGORIES+= sysutils
# In Germany try this # In Germany try this
# MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/ #MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/ MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
DISTFILES= xperfmon++v1.1.tar.Z DISTFILES= xperfmon++v1.1.tar.Z

View file

@ -1,432 +1,554 @@
diff -u ../xperfmon++.orig/Imakefile ./Imakefile diff -c -N ../xperfmon++/bsd_system.c ./bsd_system.c
--- ../xperfmon++.orig/Imakefile Wed Jul 27 22:29:29 1994 *** ../xperfmon++/bsd_system.c Thu Jan 1 01:00:00 1970
+++ ./Imakefile Sun Nov 12 00:07:24 1995 --- ./bsd_system.c Fri Dec 15 11:00:03 1995
@@ -17,15 +17,21 @@ ***************
SYS_MODULE= sgi_system *** 0 ****
#endif --- 1,548 ----
+ /*
-EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) + * Perfmon Performance Monitor
+#if defined (i386BsdArchitecture) + *
+BSDFLAGS= -lkvm + * Copyright 1985, Massachusetts Institute of Technology
+SYS_MODULE= bsd_system + * Copyright 1989, PCS Computer Systeme GmbH, West Germany
+CC= gcc + * Copyright 1994, Sterling Software @ NASA-Ames Research Center
+#endif + * Copyright 1995, Regents of the University of California,
+ + * Lars Köller <Lars_Koeller@odie.physik2.uni-rostock.de
+EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(BSDFLAGS) + *
+ * Permission to use, copy, modify, distribute, and sell this software and its
INSTPGMFLAGS = $(INSTKMEMFLAGS) + * documentation for any purpose is hereby granted without fee, provided that
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) + * the above copyright notice appear in all copies and that both that
INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11 + * copyright notice and this permission notice appear in supporting
-# INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11 -I/usr/include/bsd + * documentation, and that the name of PCS and Sterling Software not be used in advertising or
- CDEBUGFLAGS = -O + * publicity pertaining to distribution of the software without specific,
- SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c nfs.c + * written prior permission. PCS and Sterling Software makes no representations about the
- OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o nfs.o + * suitability of this software for any purpose. It is provided "as is"
+# SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c nfs.c + * without express or implied warranty.
+# OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o nfs.o + *
+ SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c + * PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & STERLING SOFTWARE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
ComplexProgramTarget(xperfmon++) + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
diff -u ../xperfmon++.orig/README ./README + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- ../xperfmon++.orig/README Wed Jul 27 22:29:30 1994 + *
+++ ./README Sun Nov 12 00:07:24 1995 + * Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
@@ -18,3 +18,20 @@ + * Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
Research Center, rsmith@proteus.arc.nasa.gov. Imake will build for correct + * tom@meepmeep.pcs.com
O/S if x11r5 is fully installed in all the right places. + * 1994 Revision
+ * Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
+ + * Moffett Field, California, rsmith@proteus.arc.nasa.gov
+3-15-95 Completely new port of systemdependent file (bsd_system.c) for FreeBSD-2.X + * 1995 FreeBSD 2.x Version
+ by Lars Köller @University of Rostock, Germany. + * Author: Lars Koeller, Univerity of Rostock, Germany
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + * Lars_Koeller@odie.physik2.uni-rostock.de
+ + */
+8-16-95 Quick and dirty workaround of -geometry option bug. +
+ But there are still some side effects when changing the geometry. + /* This file contains only system functions - that is the functions that
+ Fix memory leak in bsd_system.c + * get the information the performance monitor is monitoring. No calls
+ by Lars Köller @University of Rostock, Germany. + * to any X routines should be made here. The reason for doing this is
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + * so that as the X toolkit becomes available and the X window system
+ + * improves no changes will have to be made to this file, and as this
+30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system + * program is made available for a new type of machine, only this file
+ tries to minimize the free unused amount of memory. + * will need to be changed.
+ Include basic support for FreeBSD > 2.1. + */
+ Number of interrupts now independent from + #include <X11/IntrinsicP.h>
+ by Lars Köller @University of Rostock, Germany. +
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de> + #include "system.h"
diff -u ../xperfmon++.orig/TimeChart.h ./TimeChart.h +
--- ../xperfmon++.orig/TimeChart.h Wed Jul 27 22:29:31 1994 + #include <stdio.h>
+++ ./TimeChart.h Sun Nov 12 00:07:24 1995 + #include <stdlib.h>
@@ -88,12 +88,12 @@ + #include <strings.h>
#define XtCFillRect "FillRect" + #include <unistd.h>
+ #include <paths.h>
#define XtNgetValue "getValue" + #include <kvm.h>
-#define XtNhighlight "highlight" + #include <nlist.h>
+/* #define XtNhighlight "highlight" */ + #include <limits.h>
#define XtNjumpScroll "jumpScroll" + #include <errno.h>
#define XtNminScale "minScale" + #include <err.h>
#define XtNscale "scale" +
#define XtNfillRect "fillRect" + #include <sys/file.h>
-#define XtNupdate "update" + #include <sys/param.h>
+/* #define XtNupdate "update" */ + #include <sys/socket.h>
#define XtNvmunix "vmunix" + #include <sys/sysctl.h>
+ #include <sys/dkstat.h>
typedef struct _TimeChartRec *TimeChartWidget; + #include <sys/buf.h>
diff -u ../xperfmon++.orig/XPerfmon++.ad ./XPerfmon++.ad + #include <sys/vmmeter.h>
--- ../xperfmon++.orig/XPerfmon++.ad Wed Jul 27 22:29:32 1994 + #include <vm/vm.h>
+++ ./XPerfmon++.ad Sun Nov 12 00:07:23 1995 + #include <net/if.h>
@@ -4,24 +4,37 @@ + #include <netinet/in.h>
! commented out, the "NFS Server" graph background will be the application + #include <sys/stat.h>
! default color, unless some other resource file has specified it. + #include <sys/conf.h>
! *PerfChart.highAlarm: 99998 + #include <sys/rlist.h>
+*perfChartUser.highAlarm: 95 + #include <sys/mount.h>
+*perfChartUser.highWarn: 75 + #include <nfs/nfsv2.h>
+ + #include <nfs/nfs.h>
+*perfChartSystem.highAlarm: 40 +
+*perfChartSystem.highWarn: 25 +
+ + #if __FreeBSD__ > 1
*perfChartIdle.lowWarn: 10 + #include <osreldate.h>
*perfChartIdle.lowAlarm: 5 + /*
-*perfChartUser.highAlarm: 90 + * XXX temporary hack: FreeBSD-2.2-current has been floating around
-*perfChartUser.highWarn: 75 + * with 199508 for some time; FreeBSD-2.1 will be 199511 however (so
-*perfChartSystem.highAlarm: 90 + * 2.2-current has been bumped to 199512 recently). Recognize the old
-*perfChartSystem.highWarn: 75 + * 2.2-current as NFSv3 for a grace period.
-*perfChartFree.lowWarn: 2000 + * FreeBSD 2.0.5 was 199504, btw. Both, 2.0.5 and 2.1 don't have
-*perfChartFree.lowAlarm: 1000 + * NFSv3.
-*perfChartDisk.highWarn: 25 + */
-*perfChartDisk.highAlarm: 50 + # if __FreeBSD_version > 199511 || __FreeBSD_version == 199508
-*perfChartIntrpts.highWarn: 500 + # define HAS_NFS_V3
-*perfChartIntrpts.highAlarm: 750 + # endif /* FreeBSD_version */
-*perfChartInput.highWarn: 300 + #endif /* FreeBSD */
-*perfChartInput.highAlarm: 500 +
-*perfChartOutput.highWarn: 300 + #include "is.h"
-*perfChartOutput.highAlarm: 500 +
+ + #ifndef TRUE
+*perfChartSwap.highWarn: 50 + #define TRUE 1
+*perfChartSwap.highAlarm: 100 + #define FALSE 0
+ + #endif
+*perfChartDisk.highWarn: 50 +
+*perfChartDisk.highAlarm: 100 + #define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
+ +
+*perfChartIntrpts.highWarn: 400 + /*
+*perfChartIntrpts.highAlarm: 600 + Function Prototypes
+ + */
+*perfChartInput.highWarn: 500 + static int get_namelist(const char *kernel_name, const char *memory_name);
+*perfChartInput.highAlarm: 1000 + static void kread(int nlx, void *addr, size_t size);
+ + static void collect_stats(void);
+*perfChartOutput.highWarn: 500 + static int total_disk_transfers(void);
+*perfChartOutput.highAlarm: 1000 + static int get_swapspace(void);
+ +
*perfChartCollision.highWarn: 20 + /*
*perfChartCollision.highAlarm: 50 + Variables & Structs
-*perfChartNFSClient.highWarn: 200 + */
-*perfChartNFSClient.highAlarm: 400 + static unsigned long *intrcnt;
+ + static int nintr, hz;
+*perfChartNFSClient.highWarn: 100 + static kvm_t *kd;
+*perfChartNFSClient.highAlarm: 200 + static char errbuf[_POSIX2_LINE_MAX];
+ + static char dr_name[DK_NDRIVE][DK_NAMELEN];
+*perfChartNFSServer.highWarn: 100 + static double etime;
+*perfChartNFSServer.highAlarm: 200 +
*font: 6x13 + int current_values[NUM_GRAPHS];
+ + stat_type stats;
Only in .: bsd_system.c +
diff -u ../xperfmon++.orig/misc.c ./misc.c + extern Widget perfmon[NUM_GRAPHS];
--- ../xperfmon++.orig/misc.c Wed Jul 27 22:29:33 1994 +
+++ ./misc.c Sun Nov 12 00:07:24 1995 + static struct packet {
@@ -58,7 +58,7 @@ + int input, output, collisions;
int i, keycode, length = 0; + } packets, old_packets;
/* PerfmonWidget pw = (PerfmonWidget) w;*/ +
+ static struct nfsstats nfsstats;
- length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL); + static struct _nfsStats {
+ length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL); + int nfsServer, nfsClient;
switch (keycode) { + } nfsStats, old_nfsStats;
case 'Q': +
case 'q': + struct nlist nl[] = {
diff -u ../xperfmon++.orig/system.h ./system.h + #define X_CPTIME 0
--- ../xperfmon++.orig/system.h Wed Jul 27 22:29:34 1994 + { "_cp_time" },
+++ ./system.h Sun Nov 12 00:07:24 1995 + #define X_SUM 1
@@ -149,7 +149,11 @@ + { "_cnt" },
"User", + #define X_BOOTTIME 2
"System", + { "_boottime" },
"Idle", + #define X_DKXFER 3
+#ifdef __FreeBSD__ + { "_dk_xfer" },
+ "Swap", + #define X_HZ 4
+#else + { "_hz" },
"Free", + #define N_IFNET 5
+#endif + { "_ifnet" },
"Disk", + #define X_INTRCNT 6
"Interrupts", + { "_intrcnt" },
"Input", + #define X_EINTRCNT 7
@@ -162,7 +166,11 @@ + { "_eintrcnt" },
"User", + #define VM_NSWAP 8
"System", + { "_nswap" }, /* size of largest swap device */
"Idle", + #define VM_NSWDEV 9
+#ifdef __FreeBSD__ + { "_nswdev" }, /* number of swap devices */
+ "Swap", + #define VM_DMMAX 10
+#else + { "_dmmax" }, /* maximum size of a swap block */
"Free", + #define VM_SWAPLIST 11
+#endif + { "_swaplist" },/* list of free swap areas */
"Disk", + #define VM_SWDEVT 12
"Intrpts", + { "_swdevt" }, /* list of swap devices and sizes */
"Input", + { "" },
@@ -175,7 +183,11 @@ + };
"CPU", +
"CPU", + struct {
"CPU", + long time[CPUSTATES];
+#ifdef __FreeBSD__ + long xfer[DK_NDRIVE];
+ "Usage (MB)", + struct vmmeter Sum;
+#else + struct vmmeter Rate;
"Memory", + int interrupts;
+#endif + } s, s1;
"Transfers", +
"", + int off;
"Packets", +
diff -u ../xperfmon++.orig/xperfmon++.man ./xperfmon++.man + #define rate s.Rate
--- ../xperfmon++.orig/xperfmon++.man Wed Jul 27 22:29:39 1994 + #define sum s.Sum
+++ ./xperfmon++.man Sun Nov 12 00:14:56 1995 +
@@ -94,8 +94,8 @@ + /*
.B \-idlecpu | \+idlecpu + This routine does all necessary setting up of structures
Graph \fIIdle\fP CPU Percentage. + that will handle system calls.
.TP 26 + */
-.B \-freemem | \+freemem + void sys_setup()
-Graph \fIFree Memory\fP. + {
+.B \-{freemem/usedswap} | \+{freemem/usedswap} + get_namelist(getbootfile(), _PATH_KMEM);
+Graph \fIFree Memory/Used Swap (Operating system dependent, swap only for FreeBSD)\fP. + collect_stats();
.TP 26 + /* hack to enforce a resize of the 'Free Swap' graph
.B \-diskxfr | \+diskxfr + without this the left border always displays the first drawn line
Graph \fIDisk Transfers\fP per interval period. + cause this field isn't resized very often due to slow change of
@@ -176,8 +176,8 @@ + the free swapspace! */
.B idle + off = 100 - get_swapspace();
Set \fIlimit\fP value for Idle CPU Percentage. + etime = 1.0;
.TP 12 + }
-.B mem +
-Set \fIlimit\fP value for Free Memory. +
+.B mem/swap + /*
+Set \fIlimit\fP value for Free Memory/Used Swap (OS dependent, swap only for FreeBSD). + Update the data structures
.TP 12 + */
.B disk + void update_stats()
Set \fIlimit\fP value for Disk Transfers. + {
@@ -314,7 +314,7 @@ + int state;
Set System CPU Percentage resource. + double pct, tot;;
.TP 16 +
.B Free + collect_stats();
-Set Free Memory resource. +
+Set Free Memory/Swap resource. + tot = 0;
.TP 16 + for (state = 0; state < CPUSTATES; ++state)
.B Disk + tot += s.time[state];
Set Disk Transfer count resource. + if (tot)
diff -u ../xperfmon++.orig/xperfmon.c ./xperfmon.c + pct = 100 / tot;
--- ../xperfmon++.orig/xperfmon.c Wed Jul 27 22:29:39 1994 + else
+++ ./xperfmon.c Sun Nov 12 00:13:55 1995 + pct = 0;
@@ -58,6 +58,10 @@ + current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
* + current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
*/ + current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
+
+#ifdef __FreeBSD__ + if (perfmon[FREE_MEM]) {
+#include <osreldate.h> + current_values[FREE_MEM] = get_swapspace() + off;
+#endif + off = 0;
+ + }
#include <stdio.h> + if (perfmon[DISK_TRANSFERS])
#include <X11/IntrinsicP.h> + current_values[DISK_TRANSFERS] = total_disk_transfers();
#include <X11/StringDefs.h> + if (perfmon[INTERRUPTS])
@@ -94,6 +98,11 @@ + current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
{ NULL, NULL }, + if (perfmon[INPUT_PACKETS])
}; + current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
+ if (perfmon[OUTPUT_PACKETS])
+/* LK!!! */ + current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
+#define MIN_WIDTH 240 + if (perfmon[COLLISION_PACKETS])
+#define MIN_HEIGHT 430 + current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
+ + if (perfmon[NFS_CLIENT_CALLS])
+ + current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
#define XtNinterval "interval" + if (perfmon[NFS_SERVER_CALLS])
#define XtNcount "count" + current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
#define XtCCount "Count" + }
@@ -171,11 +180,17 @@ +
static XrmOptionDescRec optionDescList[] = { +
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL}, + /*
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" }, + Collect the overall disk transfer rates
- + */
+#if __FreeBSD_version >= 199504 + int
+ { "-lowswapAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL }, + total_disk_transfers()
+ { "-lowswapWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL }, + {
+ { "-highswapAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL }, + register int i, total_xfers = 0;
+ { "-highswapWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL }, +
+#else + for(i=0; i < DK_NDRIVE; i++)
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL }, + total_xfers += s.xfer[i];
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL }, + return(total_xfers/etime);
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL }, + }
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL }, +
+#endif +
+ /*
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL }, + Collect all the data
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL }, + */
@@ -237,8 +252,13 @@ + void
{ "+systemcpu", XtNsystemcpuAdd, XrmoptionNoArg, "TRUE" }, + collect_stats()
{ "-idlecpu", XtNidlecpuSub, XrmoptionNoArg, "True" }, + {
{ "+idlecpu", XtNidlecpuAdd, XrmoptionNoArg, "TRUE" }, + off_t ifnetaddr;
+#if __FreeBSD_version >= 199504 + register int i, tmp;
+ { "-usedswap", XtNfreememSub, XrmoptionNoArg, "True" }, + int mib[3], size;
+ { "+usedswap", XtNfreememAdd, XrmoptionNoArg, "TRUE" }, +
+#else + kread(X_CPTIME, s.time, sizeof(s.time));
{ "-freemem", XtNfreememSub, XrmoptionNoArg, "True" }, + kread(X_DKXFER, s.xfer, sizeof(s.xfer));
{ "+freemem", XtNfreememAdd, XrmoptionNoArg, "TRUE" }, + kread(X_SUM, &sum, sizeof(sum) );
+#endif +
{ "-diskxfr", XtNdiskxfrSub, XrmoptionNoArg, "True" }, + nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
{ "+diskxfr", XtNdiskxfrAdd, XrmoptionNoArg, "TRUE" }, + if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
{ "-interrupts", XtNinterruptsSub , XrmoptionNoArg, "True" }, + err(1, "xperfmon++ malloc in collect_stats");
@@ -344,7 +364,11 @@ + nintr /= sizeof(long);
fprintf(stderr, " [{-+}usercpu] ({remove|add} usercpu to list of graphs\n"); + kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
fprintf(stderr, " [{-+}systemcpu] ({remove|add} systemcpu to list of graphs\n"); + s1.interrupts = s.interrupts;
fprintf(stderr, " [{-+}idlecpu] ({remove|add} idlecpu to list of graphs\n"); + s.interrupts = 0;
+#if __FreeBSD_version >= 199504 + for (i = 0; i < nintr; i++)
+ fprintf(stderr, " [{-+}usedswap] ({remove|add} usedswap to list of graphs\n"); + s.interrupts += *(intrcnt + i);
+#else +
fprintf(stderr, " [{-+}freemem] ({remove|add} freemem to list of graphs\n"); + free(intrcnt);
+#endif + etime = 0;
fprintf(stderr, " [{-+}diskxfr] ({remove|add} disk transfers to list of graphs\n"); + for (i=0; i < DK_NDRIVE; i++) {
fprintf(stderr, " [{-+}interrupts] ({remove|add} interrupts to list of graphs\n"); + tmp = s.xfer[i];
fprintf(stderr, " [{-+}inputpkts] ({remove|add} input packets to list of graphs\n"); + s.xfer[i] -= s1.xfer[i];
@@ -361,10 +385,18 @@ + s1.xfer[i] = tmp;
fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n"); + }
fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n"); + for (i=0; i < CPUSTATES; i++) {
fprintf(stderr, " Where \"*\" is one of the following:\n"); + tmp = s.time[i];
+#if __FreeBSD_version >= 199504 + s.time[i] -= s1.time[i];
+ fprintf(stderr, " [swap | user | sys | idle | disk | intrpts |\n"); + s1.time[i] = tmp;
+#else + etime += s.time[i];
fprintf(stderr, " [mem | user | sys | idle | disk | intrpts |\n"); + }
+#endif + if(etime == 0.)
fprintf(stderr, " input | output | collision | nfsclient | nfsserver]\n"); + etime = 1.;
fprintf(stderr, " For Example:\n"); + etime /= hz;
+#if __FreeBSD_version >= 199504 +
+ fprintf(stderr, " [-lowswapAlarm {value}] ( Set low Free Swap Alarm Value)\n"); + /*
+#else + Collect the Network-Traffic
fprintf(stderr, " [-lowmemAlarm {value}] ( Set low Free Memory Alarm Value)\n"); + */
+#endif +
fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n"); + if (nl[N_IFNET].n_value != 0) {
exit(1); + struct ifnet ifnet;
} + kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
@@ -386,6 +418,7 @@ + old_packets = packets;
time(&timeStamp); + packets.input = packets.output = packets.collisions = 0;
return; + while (ifnetaddr) {
} + kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
+ + packets.input += ifnet.if_ipackets;
/*ARGSUSED*/ + packets.output += ifnet.if_opackets;
void handleResize( w, unused, event, contin2disp ) + packets.collisions += ifnet.if_collisions;
Widget w; + ifnetaddr = (u_long) ifnet.if_next;
@@ -419,9 +452,15 @@ + }
break; + }
+
} + /*
- if ( neww < 250 + 10 ) { + Collect the NFS and RPC Calls
- neww = 250 + 10; + */
- w->core.width = 250 + 10; +
+ if ( neww < MIN_WIDTH + 10 ) { + size = sizeof(nfsstats);
+ neww = MIN_WIDTH + 10; + mib[0] = CTL_FS;
+ w->core.width = MIN_WIDTH + 10; + mib[1] = MOUNT_NFS;
+ XtResizeWindow(w); + mib[2] = NFS_NFSSTATS;
+ } +
+/* LK!!! */ + if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
+ if ( newh < MIN_HEIGHT + 10 ) { + return;
+ newh = MIN_HEIGHT + 10; + else {
+ w->core.height = MIN_HEIGHT + 10; + old_nfsStats = nfsStats;
XtResizeWindow(w); +
} + nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
if ( appData.debug ) + nfsstats.rpccnt[NFSPROC_SETATTR] +
@@ -436,6 +475,7 @@ + nfsstats.rpccnt[NFSPROC_LOOKUP] +
Dimension boxH = labelBox->core.height; + nfsstats.rpccnt[NFSPROC_READLINK] +
Dimension timeH = timechart->core.height; + nfsstats.rpccnt[NFSPROC_READ] +
Dimension newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn; + nfsstats.rpccnt[NFSPROC_WRITE] +
+ + nfsstats.rpccnt[NFSPROC_CREATE] +
if ( oldWidth == neww && oldHeight == newh ) return; + nfsstats.rpccnt[NFSPROC_REMOVE] +
+ nfsstats.rpccnt[NFSPROC_RENAME] +
if ( appData.debug ) + nfsstats.rpccnt[NFSPROC_LINK] +
@@ -464,6 +504,9 @@ + nfsstats.rpccnt[NFSPROC_SYMLINK] +
int argc; + nfsstats.rpccnt[NFSPROC_MKDIR] +
char **argv; + nfsstats.rpccnt[NFSPROC_RMDIR] +
{ + nfsstats.rpccnt[NFSPROC_READDIR] +
+/* LK!!! */ + #ifndef HAS_NFS_V3
+ Dimension neww, newh, timeH, newWidgetH, hOverHead, boxH; + nfsstats.rpccnt[NFSPROC_STATFS] +
+ + nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
Arg arg; + #else /* HAS_NFS_V3 */
Pixmap icon_pixmap = None; + nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
Widget loadParent, pappaBox; + nfsstats.rpccnt[NFSPROC_FSSTAT] +
@@ -540,7 +583,6 @@ + nfsstats.rpccnt[NFSPROC_FSINFO] +
xperfmon_width, xperfmon_height)); + nfsstats.rpccnt[NFSPROC_PATHCONF] +
XtSetValues(appData.toplevel, &arg, 1); + nfsstats.rpccnt[NFSPROC_COMMIT] +
} + #endif /* HAS_NFS_V3 */
- + nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
/* create windows */ + nfsstats.rpccnt[NQNFSPROC_VACATED] +
+ nfsstats.rpccnt[NQNFSPROC_EVICTED];
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel, +
@@ -553,8 +595,24 @@ + nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
c = (char *) ((long) &hostname[0] + (int) strlen(hostname)); + nfsstats.srvrpccnt[NFSPROC_SETATTR] +
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0); + nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
+ nfsstats.srvrpccnt[NFSPROC_READLINK] +
+/* LK!!! quick and dirty hack */ + nfsstats.srvrpccnt[NFSPROC_READ] +
+ XtRealizeWidget(appData.toplevel); + nfsstats.srvrpccnt[NFSPROC_WRITE] +
+ + nfsstats.srvrpccnt[NFSPROC_CREATE] +
+ neww = appData.toplevel->core.width; + nfsstats.srvrpccnt[NFSPROC_REMOVE] +
+ newh = appData.toplevel->core.height; + nfsstats.srvrpccnt[NFSPROC_RENAME] +
+ if ( neww < MIN_WIDTH + 10) { + nfsstats.srvrpccnt[NFSPROC_LINK] +
+ neww = MIN_WIDTH + 10; + nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
+ appData.toplevel->core.width = MIN_WIDTH + 10; + nfsstats.srvrpccnt[NFSPROC_MKDIR] +
+ XtResizeWindow(appData.toplevel); + nfsstats.srvrpccnt[NFSPROC_RMDIR] +
+ } + nfsstats.srvrpccnt[NFSPROC_READDIR] +
+ if ( newh < MIN_HEIGHT + 10) { + #ifndef HAS_NFS_V3
+ newh = MIN_HEIGHT + 10; + nfsstats.srvrpccnt[NFSPROC_STATFS] +
+ appData.toplevel->core.height = MIN_HEIGHT + 10; + nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
+ XtResizeWindow(appData.toplevel); + #else /* HAS_NFS_V3 */
+ } + nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
+ neww -= 10; + nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox, + nfsstats.srvrpccnt[NFSPROC_FSINFO] +
- XtNwidth, 250, + nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
+ XtNwidth, neww, + nfsstats.srvrpccnt[NFSPROC_COMMIT] +
/* XtNheight, 16,*/ + #endif /* HAS_NFS_V3 */
XtNjustify, XtJustifyLeft, + nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
XtNinternalHeight, 0, + nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
@@ -562,6 +620,13 @@ + nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
XtNlabel, hostname, + }
XtNborderWidth, 0, + }
NULL); +
+ +
+/* same as in handleResize */ + /*
+ hOverHead = 5 * appData.numGraphsOn; + Reads the nlist from the kernel
+ boxH = labelBox->core.height; + */
+ timeH = 18; + int
+ newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn; + get_namelist(kernel_name, memory_name)
+ + const char *kernel_name, *memory_name;
/* build the graph widgets */ + {
+ time_t now;
for ( i=0; i<NUM_GRAPHS; i++ ) { + time_t boottime;
@@ -570,8 +635,8 @@ + register int i, c;
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox, + int nintv;
XtNtopLabel, topNames[i], +
XtNbotLabel, botNames[i], + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
- XtNwidth, 250, + if (kd == 0) {
- XtNheight, 36, + (void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
+ XtNwidth, neww, + exit(1);
+ XtNheight, newWidgetH, + }
XtNupdate, appData.interval*appData.ms_per_sec, +
XtNfillRect, (int)appData.fill, + if ((c = kvm_nlist(kd, nl)) != 0) {
XtNjumpScroll, 1, + if (c > 0) {
@@ -580,7 +645,7 @@ + (void)fprintf(stderr,"xperfmon++: undefined symbols:");
} + for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox, + if (nl[c].n_type == 0)
XtNfromVert, perfmon[1], + fprintf(stderr, " %s", nl[c].n_name);
- XtNwidth, 250, + (void)fputc('\n', stderr);
+ XtNwidth, neww, + } else
XtNheight, 18, + (void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
XtNupdate, appData.interval*appData.ms_per_sec, + }
XtNjumpScroll, 1, +
@@ -590,7 +655,7 @@ + kread(X_BOOTTIME, &boottime, sizeof(boottime));
+ kread(X_HZ, &hz, sizeof(hz));
for ( i=0; i<NUM_GRAPHS; i++ ) + for (i = 0; i < DK_NDRIVE; i++) {
if ( appData.graphOn[i] ) + strcpy(dr_name[i], "xx");
- XtAddCallback(perfmon[i], XtNgetValue, update_stat, i); + }
+ XtAddCallback(perfmon[i], XtNgetValue, update_stat, (XtPointer)i); + time(&now);
+ nintv = now - boottime;
appData.interval_id = XtAppAddTimeOut(appData.app_context, + if (nintv <= 0 || nintv > 60*60*24*365*10) {
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel); + fprintf(stderr,
@@ -598,3 +663,4 @@ + "Time makes no sense... namelist must be wrong.\n");
XtRealizeWidget(appData.toplevel); + exit(1);
XtAppMainLoop(appData.app_context); + }
} + return(nintv);
+ + }
+
+
+ /*
+ Kread reads something from the kernel, given its nlist index.
+ */
+ static void
+ kread(nlx, addr, size)
+ int nlx;
+ void *addr;
+ size_t size;
+ {
+ char *sym;
+
+ if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
+ sym = nl[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ (void)fprintf(stderr,
+ "xpermon++: symbol %s not defined\n", sym);
+ exit(1);
+ }
+ if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
+ sym = nl[nlx].n_name;
+ if (*sym == '_')
+ ++sym;
+ (void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
+ exit(1);
+ }
+ }
+
+ /*
+ * get_swapspace is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+ int
+ get_swapspace()
+ {
+ char *header;
+ int hlen, nswap, nswdev, dmmax;
+ int i, div, avail, nfree, npfree, used;
+ struct swdevt *sw;
+ long blocksize, *perdev;
+ struct rlist head;
+ struct rlist *swaplist;
+ u_long ptr;
+ kread(VM_NSWAP, &nswap, sizeof(nswap));
+ kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
+ kread(VM_DMMAX, &dmmax, sizeof(dmmax));
+ kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
+ if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
+ (perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
+ err(1, "xperfmon++ malloc in get_swapspace");
+ kread(VM_SWDEVT, &ptr, sizeof(ptr));
+ kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
+ /* Count up swap space. */
+ nfree = 0;
+ memset(perdev, 0, nswdev * sizeof(*perdev));
+ while (swaplist) {
+ int top, bottom, next_block;
+ kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
+ top = head.rl_end;
+ bottom = head.rl_start;
+
+ nfree += top - bottom + 1;
+
+ /*
+ * Swap space is split up among the configured disks.
+ *
+ * For interleaved swap devices, the first dmmax blocks
+ * of swap space some from the first disk, the next dmmax
+ * blocks from the next, and so on up to nswap blocks.
+ *
+ * The list of free space joins adjacent free blocks,
+ * ignoring device boundries. If we want to keep track
+ * of this information per device, we'll just have to
+ * extract it ourselves.
+ */
+ while (top / dmmax != bottom / dmmax) {
+ next_block = ((bottom + dmmax) / dmmax);
+ perdev[(bottom / dmmax) % nswdev] +=
+ next_block * dmmax - bottom;
+ bottom = next_block * dmmax;
+ }
+ perdev[(bottom / dmmax) % nswdev] +=
+ top - bottom + 1;
+
+ swaplist = head.rl_next;
+ }
+
+ header = getbsize(&hlen, &blocksize);
+ div = blocksize / 512;
+ avail = npfree = 0;
+ for (i = 0; i < nswdev; i++) {
+ int xsize, xfree;
+
+ /*
+ * Don't report statistics for partitions which have not
+ * yet been activated via swapon(8).
+ */
+ if (!(sw[i].sw_flags & SW_FREED))
+ continue;
+
+ /* The first dmmax is never allocated to avoid trashing of
+ * disklabels
+ */
+ xsize = sw[i].sw_nblks - dmmax;
+ xfree = perdev[i];
+ used = xsize - xfree;
+ npfree++;
+ avail += xsize;
+ }
+
+ /*
+ * If only one partition has been set up via swapon(8), we don't
+ * need to bother with totals.
+ */
+ used = avail - nfree;
+
+ free(perdev);
+ free(sw);
+ return((100*nfree)/avail); /* return free swap in percent */
+ }

View file

@ -1,90 +1,793 @@
diff -u ../xperfmon++.orig/StripCharP.h ./StripCharP.h diff -c -N ../xperfmon++/StripCharP.h ./StripCharP.h
--- ../xperfmon++.orig/StripCharP.h Wed Jul 27 22:29:30 1994 *** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
+++ ./StripCharP.h Sun Nov 12 00:07:24 1995 --- ./StripCharP.h Fri Dec 15 11:00:03 1995
@@ -62,10 +62,12 @@ ***************
#define HIGHLIGHT 1 << 1 *** 62,71 ****
#define ALL_GCS (FOREGROUND | HIGHLIGHT) #define HIGHLIGHT 1 << 1
#define ALL_GCS (FOREGROUND | HIGHLIGHT)
+#define NUM_VALUES 2048
+ /* New fields for the PerfChart widget instance record */
/* New fields for the PerfChart widget instance record */
typedef struct {
typedef struct { ! double valuedata[2048]; /* record of data points */
- double valuedata[2048]; /* record of data points */ Pixel fgpixel; /* color index for graph */
+ double valuedata[NUM_VALUES]; /* record of data points */ Pixel hipixel; /* color index for lines */
Pixel fgpixel; /* color index for graph */ Pixel warnColor;
Pixel hipixel; /* color index for lines */ --- 62,73 ----
Pixel warnColor; #define HIGHLIGHT 1 << 1
diff -u ../xperfmon++.orig/StripChart.c ./StripChart.c #define ALL_GCS (FOREGROUND | HIGHLIGHT)
--- ../xperfmon++.orig/StripChart.c Wed Jul 27 22:29:30 1994
+++ ./StripChart.c Sun Nov 12 00:07:24 1995 + #define NUM_VALUES 2048
@@ -215,8 +215,23 @@ +
static void Initialize (greq, gnew) /* New fields for the PerfChart widget instance record */
Widget greq, gnew;
{ typedef struct {
+ int i; ! double valuedata[NUM_VALUES]; /* record of data points */
+ Pixel fgpixel; /* color index for graph */
PerfChartWidget w = (PerfChartWidget)gnew; Pixel hipixel; /* color index for lines */
Pixel warnColor;
+ /* diff -c -N ../xperfmon++/StripChart.c ./StripChart.c
+ * XXX The missing initializations have been made obvious by FreeBSD 2.2's *** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
+ * new (`phk') malloc that doesn't initialize the malloc'ed areas to 0. --- ./StripChart.c Fri Dec 15 11:00:03 1995
+ * Perhaps more bogons will lurk around, but the floating arithmetic ones ***************
+ * have been the most annoying ones since they most likely cause a trap *** 53,58 ****
+ * at startup time. --- 53,64 ----
+ * #include <X11/StringDefs.h>
+ * Strange that people in the 90's still rely on malloc() #include <X11/Xaw/XawInit.h>
+ * returning an initialized region. #include "StripCharP.h"
+ */ + #ifdef __FreeBSD__
+ for ( i = 0; i < NUM_VALUES; i++ ) + #include <osreldate.h>
+ w->strip_chart.valuedata[i] = 0.0; + # if __FreeBSD_version >= 199504
+ + # include "system.h"
/* if we are working with a mono screen then turn off all warnings and alarms */ + # endif
+ #endif
if ( mono_screen ) { #include <X11/Xfuncs.h>
@@ -343,19 +358,19 @@
#define MS_PER_SEC 100
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */ ***************
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) { *** 108,114 ****
- XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL ); };
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor; #undef offset
} ! #define LABEL_ROOM 100
} static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */ static Boolean SetValues();
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) { static int repaint_window();
- XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL ); --- 114,124 ----
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL ); };
w->strip_chart.currentBG = w->strip_chart.warnColor;
} #undef offset
} ! #if __FreeBSD_version >= 199504
else { ! # define LABEL_ROOM 80
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */ ! #else
- XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL ); ! # define LABEL_ROOM 100
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL ); ! #endif
w->strip_chart.currentBG = w->strip_chart.okColor; static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
} static Boolean SetValues();
} static int repaint_window();
@@ -373,19 +388,19 @@ ***************
*** 215,222 ****
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */ --- 225,247 ----
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) { static void Initialize (greq, gnew)
- XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL ); Widget greq, gnew;
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL ); {
w->strip_chart.currentBG = w->strip_chart.alarmColor; + int i;
} +
} PerfChartWidget w = (PerfChartWidget)gnew;
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) { + /*
- XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL ); + * XXX The missing initializations have been made obvious by FreeBSD 2.2's
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL ); + * new (`phk') malloc that doesn't initialize the malloc'ed areas to 0.
w->strip_chart.currentBG = w->strip_chart.warnColor; + * Perhaps more bogons will lurk around, but the floating arithmetic ones
} + * have been the most annoying ones since they most likely cause a trap
} + * at startup time.
else { + *
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */ + * Strange that people in the 90's still rely on malloc()
- XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL ); + * returning an initialized region.
+ XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL ); + */
w->strip_chart.currentBG = w->strip_chart.okColor; + for ( i = 0; i < NUM_VALUES; i++ )
} + w->strip_chart.valuedata[i] = 0.0;
} +
/* if we are working with a mono screen then turn off all warnings and alarms */
if ( mono_screen ) {
***************
*** 323,330 ****
w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
}
}
! if (value < w->strip_chart.min_value)
! w->strip_chart.min_value = value;
w->strip_chart.valuedata[w->strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) {
--- 348,355 ----
w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
}
}
! if (value < w->strip_chart.min_value)
! w->strip_chart.min_value = value;
w->strip_chart.valuedata[w->strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) {
***************
*** 343,361 ****
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
--- 368,386 ----
if ( checkValue >= w->strip_chart.highAlarm ) { /* check for high alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue >= w->strip_chart.highWarn ) { /* check for high warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
***************
*** 373,391 ****
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues(w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues(w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
--- 398,416 ----
if ( checkValue <= w->strip_chart.lowAlarm ) { /* check for low alarm */
if ( w->strip_chart.currentBG != w->strip_chart.alarmColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.alarmColor, NULL );
w->strip_chart.currentBG = w->strip_chart.alarmColor;
}
}
else if ( checkValue <= w->strip_chart.lowWarn ) { /* check for low warning */
if ( w->strip_chart.currentBG != w->strip_chart.warnColor ) {
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.warnColor, NULL );
w->strip_chart.currentBG = w->strip_chart.warnColor;
}
}
else {
if ( w->strip_chart.currentBG != w->strip_chart.okColor ) { /* reset to okColor? */
! XtVaSetValues((Widget)w, XtNbackground, w->strip_chart.okColor, NULL );
w->strip_chart.currentBG = w->strip_chart.okColor;
}
}
***************
*** 448,455 ****
/* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */
! if (w->strip_chart.interval != 0 || scale <= (int)w->strip_chart.max_value)
! scale = ((int) (w->strip_chart.max_value)) + 1;
if (scale < w->strip_chart.min_scale)
scale = w->strip_chart.min_scale;
--- 473,487 ----
/* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */
!
! if (w->strip_chart.interval != 0 || scale <= (int)w->strip_chart.max_value) {
! #if __FreeBSD_version >= 199504
! if (strcmp(w->strip_chart.botLabel, botNames[FREE_MEM]) != 0 || w->strip_chart.max_value == 100)
! scale = ((int) (w->strip_chart.max_value)) + 1;
! #else
! scale = ((int) (w->strip_chart.max_value)) + 1;
! #endif
! }
if (scale < w->strip_chart.min_scale)
scale = w->strip_chart.min_scale;
***************
*** 479,490 ****
/* draw titles */
if ( w->strip_chart.topLabel ) {
! y = w->core.height/2;
x = 4;
XDS(w->strip_chart.topLabel);
}
if ( w->strip_chart.botLabel ) {
! y = (w->core.height/2) + w->strip_chart.font_height;
x = 4;
XDS(w->strip_chart.botLabel);
}
--- 511,522 ----
/* draw titles */
if ( w->strip_chart.topLabel ) {
! y = w->core.height/2 - 2;
x = 4;
XDS(w->strip_chart.topLabel);
}
if ( w->strip_chart.botLabel ) {
! y = (w->core.height/2 - 2) + w->strip_chart.font_height;
x = 4;
XDS(w->strip_chart.botLabel);
}
diff -c -N ../xperfmon++/TimeChart.h ./TimeChart.h
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
--- ./TimeChart.h Fri Dec 15 11:00:03 1995
***************
*** 88,99 ****
#define XtCFillRect "FillRect"
#define XtNgetValue "getValue"
! #define XtNhighlight "highlight"
#define XtNjumpScroll "jumpScroll"
#define XtNminScale "minScale"
#define XtNscale "scale"
#define XtNfillRect "fillRect"
! #define XtNupdate "update"
#define XtNvmunix "vmunix"
typedef struct _TimeChartRec *TimeChartWidget;
--- 88,99 ----
#define XtCFillRect "FillRect"
#define XtNgetValue "getValue"
! /* #define XtNhighlight "highlight" */
#define XtNjumpScroll "jumpScroll"
#define XtNminScale "minScale"
#define XtNscale "scale"
#define XtNfillRect "fillRect"
! /* #define XtNupdate "update" */
#define XtNvmunix "vmunix"
typedef struct _TimeChartRec *TimeChartWidget;
diff -c -N ../xperfmon++/misc.c ./misc.c
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
--- ./misc.c Fri Dec 15 11:00:04 1995
***************
*** 58,64 ****
int i, keycode, length = 0;
/* PerfmonWidget pw = (PerfmonWidget) w;*/
! length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL);
switch (keycode) {
case 'Q':
case 'q':
--- 58,64 ----
int i, keycode, length = 0;
/* PerfmonWidget pw = (PerfmonWidget) w;*/
! length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL);
switch (keycode) {
case 'Q':
case 'q':
diff -c -N ../xperfmon++/system.h ./system.h
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
--- ./system.h Fri Dec 15 11:00:03 1995
***************
*** 151,168 ****
--- 151,182 ----
"Idle",
"Free",
"Disk",
+ #ifdef __FreeBSD__
+ "Inter-",
+ #else
"Interrupts",
+ #endif
"Input",
"Output",
+ #ifdef __FreeBSD__
+ "Collis",
+ "NFS Clt",
+ "NFS Srv",
+ #else
"Collision",
"NFS Client",
"NFS Server",
+ #endif
};
static char *widgetLabels[] = {
"User",
"System",
"Idle",
+ #ifdef __FreeBSD__
+ "Swap",
+ #else
"Free",
+ #endif
"Disk",
"Intrpts",
"Input",
***************
*** 171,177 ****
--- 185,205 ----
"NFSClient",
"NFSServer",
};
+
static char *botNames[] = {
+ #ifdef __FreeBSD__
+ "CPU (%)",
+ "CPU (%)",
+ "CPU (%)",
+ "Swap (%)",
+ "Trsf/s",
+ "rupts/s",
+ "Pkts/s",
+ "Pkts/s",
+ "Pkts/s",
+ "Calls/s",
+ "Calls/s",
+ #else
"CPU",
"CPU",
"CPU",
***************
*** 183,186 ****
--- 211,215 ----
"Packets",
"Calls",
"Calls",
+ #endif
};
diff -c -N ../xperfmon++/xperfmon.c ./xperfmon.c
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
--- ./xperfmon.c Fri Dec 15 11:00:04 1995
***************
*** 58,63 ****
--- 58,67 ----
*
*/
+ #ifdef __FreeBSD__
+ #include <osreldate.h>
+ #endif
+
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
***************
*** 94,99 ****
--- 98,108 ----
{ NULL, NULL },
};
+ /* LK!!! */
+ int MIN_HEIGHT=420;
+ #define MIN_WIDTH 185
+ #define GRAPH_MIN_HEIGHT 28
+
#define XtNinterval "interval"
#define XtNcount "count"
#define XtCCount "Count"
***************
*** 101,110 ****
#define XtCFill "Fill"
#define XtNfast "fast"
#define XtCFast "Fast"
- #define XtNstufAdd "stufAdd"
- #define XtCStufAdd "StufAdd"
- #define XtNstufSub "stufSub"
- #define XtCStufSub "StufSub"
#define XtNdebug "debug"
#define XtCDebug "Debug"
#define XtNusercpuAdd "usercpuAdd"
--- 110,115 ----
***************
*** 171,181 ****
static XrmOptionDescRec optionDescList[] = {
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL},
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
!
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL },
--- 176,192 ----
static XrmOptionDescRec optionDescList[] = {
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL},
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
! #if __FreeBSD_version >= 199504
! { "-lowswapAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
! { "-lowswapWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
! { "-highswapAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
! { "-highswapWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
! #else
{ "-lowmemAlarm", "*perfChartFree.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowmemWarn", "*perfChartFree.lowWarn", XrmoptionSepArg, NULL },
{ "-highmemAlarm", "*perfChartFree.highAlarm", XrmoptionSepArg, NULL },
{ "-highmemWarn", "*perfChartFree.highWarn", XrmoptionSepArg, NULL },
+ #endif
{ "-lowuserAlarm", "*perfChartUser.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowuserWarn", "*perfChartUser.lowWarn", XrmoptionSepArg, NULL },
***************
*** 237,244 ****
--- 248,260 ----
{ "+systemcpu", XtNsystemcpuAdd, XrmoptionNoArg, "TRUE" },
{ "-idlecpu", XtNidlecpuSub, XrmoptionNoArg, "True" },
{ "+idlecpu", XtNidlecpuAdd, XrmoptionNoArg, "TRUE" },
+ #if __FreeBSD_version >= 199504
+ { "-freeswap", XtNfreememSub, XrmoptionNoArg, "True" },
+ { "+freeswap", XtNfreememAdd, XrmoptionNoArg, "TRUE" },
+ #else
{ "-freemem", XtNfreememSub, XrmoptionNoArg, "True" },
{ "+freemem", XtNfreememAdd, XrmoptionNoArg, "TRUE" },
+ #endif
{ "-diskxfr", XtNdiskxfrSub, XrmoptionNoArg, "True" },
{ "+diskxfr", XtNdiskxfrAdd, XrmoptionNoArg, "TRUE" },
{ "-interrupts", XtNinterruptsSub , XrmoptionNoArg, "True" },
***************
*** 253,269 ****
{ "+nfsclient", XtNnfsclientAdd, XrmoptionNoArg, "TRUE" },
{ "-nfsserver", XtNnfsserverSub, XrmoptionNoArg, "True" },
{ "+nfsserver", XtNnfsserverAdd, XrmoptionNoArg, "TRUE" },
- { "-stuf", XtNstufAdd, XrmoptionNoArg, (XtPointer)"True" },
- { "+stuf", XtNstufSub, XrmoptionNoArg, (XtPointer)"True" },
};
/* Application Resource List - no particular widget */
static XtResource resources[] = {
- { XtNstufAdd, XtCStufAdd, XtRBool, sizeof(Bool),
- XtOffsetOf(AppData, addG[1]), XtRImmediate, (XtPointer) NULL },
- { XtNstufSub, XtCStufSub, XtRBool, sizeof(Bool),
- XtOffsetOf(AppData, subG[0]), XtRImmediate, (XtPointer) NULL },
{ XtNinterval, XtCInterval, XtRInt, sizeof(int),
XtOffsetOf(AppData, interval), XtRImmediate, (caddr_t) DEF_INTERVAL },
{ XtNcount, XtCCount, XtRInt, sizeof(int),
--- 269,279 ----
***************
*** 324,329 ****
--- 334,342 ----
void
usage()
{
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, "\nxperfmon++ V1.3 for FreeBSD-2.X\n");
+ #endif
fprintf(stderr, "\nusage: xperfmon++ option option option .....\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " [-display [{host}]:[{vs}]]\n");
***************
*** 344,350 ****
--- 357,367 ----
fprintf(stderr, " [{-+}usercpu] ({remove|add} usercpu to list of graphs\n");
fprintf(stderr, " [{-+}systemcpu] ({remove|add} systemcpu to list of graphs\n");
fprintf(stderr, " [{-+}idlecpu] ({remove|add} idlecpu to list of graphs\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [{-+}freeswap] ({remove|add} freeswap to list of graphs\n");
+ #else
fprintf(stderr, " [{-+}freemem] ({remove|add} freemem to list of graphs\n");
+ #endif
fprintf(stderr, " [{-+}diskxfr] ({remove|add} disk transfers to list of graphs\n");
fprintf(stderr, " [{-+}interrupts] ({remove|add} interrupts to list of graphs\n");
fprintf(stderr, " [{-+}inputpkts] ({remove|add} input packets to list of graphs\n");
***************
*** 361,370 ****
--- 378,395 ----
fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n");
fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n");
fprintf(stderr, " Where \"*\" is one of the following:\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [swap | user | sys | idle | disk | intrpts |\n");
+ #else
fprintf(stderr, " [mem | user | sys | idle | disk | intrpts |\n");
+ #endif
fprintf(stderr, " input | output | collision | nfsclient | nfsserver]\n");
fprintf(stderr, " For Example:\n");
+ #if __FreeBSD_version >= 199504
+ fprintf(stderr, " [-lowswapAlarm {value}] ( Set low Free Swap Alarm Value)\n");
+ #else
fprintf(stderr, " [-lowmemAlarm {value}] ( Set low Free Memory Alarm Value)\n");
+ #endif
fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n");
exit(1);
}
***************
*** 386,391 ****
--- 411,417 ----
time(&timeStamp);
return;
}
+
/*ARGSUSED*/
void handleResize( w, unused, event, contin2disp )
Widget w;
***************
*** 394,399 ****
--- 420,426 ----
Boolean *contin2disp;
{
Dimension neww, newh;
+ Dimension hOverHead, boxH, timeH, newWidgetH;
int i;
char eventString[60];
switch (event->type) {
***************
*** 417,429 ****
newh=event->xconfigure.height;
strcpy(eventString,"configure");
break;
}
! if ( neww < 250 + 10 ) {
! neww = 250 + 10;
! w->core.width = 250 + 10;
! XtResizeWindow(w);
}
if ( appData.debug )
printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n",
(int)event->type, eventString,
--- 444,474 ----
newh=event->xconfigure.height;
strcpy(eventString,"configure");
break;
+ }
+ if ( neww < MIN_WIDTH ) {
+ neww = MIN_WIDTH;
+ w->core.width = MIN_WIDTH;
+ } else {
+ w->core.width = neww;
}
!
! if ( newh < MIN_HEIGHT ) {
! newh = MIN_HEIGHT;
! w->core.height = MIN_HEIGHT;
! }
!
! /* Now the graphs fit perfect into the window! */
! hOverHead = (5.6 * appData.numGraphsOn) - (6 / appData.numGraphsOn);
! boxH = labelBox->core.height;
! timeH = timechart->core.height;
! newWidgetH = (newh - (boxH+7) - (timeH+10) - hOverHead) / appData.numGraphsOn;
! w->core.height = newWidgetH * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10);
! if(w->core.height != newh) {
! newh = w->core.height;
}
+ XtResizeWindow(w);
+
if ( appData.debug )
printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n",
(int)event->type, eventString,
***************
*** 431,448 ****
neww, newh);
if ( event->type == ConfigureNotify ) {
! /* Dimension h = perfmon[0]->core.height;*/
! Dimension hOverHead = 5 * appData.numGraphsOn;
! Dimension boxH = labelBox->core.height;
! Dimension timeH = timechart->core.height;
! Dimension newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn;
if ( oldWidth == neww && oldHeight == newh ) return;
if ( appData.debug )
printf("BoxH=%hu, timeH=%hu, numGraphOn=%hu, newWidgetH=%hu\n",
boxH, timeH, appData.numGraphsOn, newWidgetH);
! neww -= 10; /* allow for spacing and borders */
for ( i=0; i<NUM_GRAPHS; i++ ) {
if ( appData.graphOn[i] ) {
--- 476,489 ----
neww, newh);
if ( event->type == ConfigureNotify ) {
!
if ( oldWidth == neww && oldHeight == newh ) return;
if ( appData.debug )
printf("BoxH=%hu, timeH=%hu, numGraphOn=%hu, newWidgetH=%hu\n",
boxH, timeH, appData.numGraphsOn, newWidgetH);
! neww -= 10; /* allow for spacing and borders */
for ( i=0; i<NUM_GRAPHS; i++ ) {
if ( appData.graphOn[i] ) {
***************
*** 464,472 ****
int argc;
char **argv;
{
Arg arg;
Pixmap icon_pixmap = None;
! Widget loadParent, pappaBox;
char *progname = argv[0];
Bool foundAnAdd = FALSE;
--- 505,517 ----
int argc;
char **argv;
{
+ /* LK!!! */
+ Dimension timeH, newWidgetW, newWidgetH, hOverHead, boxH;
+ unsigned int w, h;
+
Arg arg;
Pixmap icon_pixmap = None;
! Widget pappaBox;
char *progname = argv[0];
Bool foundAnAdd = FALSE;
***************
*** 540,561 ****
xperfmon_width, xperfmon_height));
XtSetValues(appData.toplevel, &arg, 1);
}
-
/* create windows */
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel,
XtNborderWidth, 0,
NULL);
-
XtOverrideTranslations(pappaBox, XtParseTranslationTable(defaultTranslations));
(void)gethostname(hostname, sizeof(hostname));
c = (char *) ((long) &hostname[0] + (int) strlen(hostname));
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0);
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox,
! XtNwidth, 250,
! /* XtNheight, 16,*/
XtNjustify, XtJustifyLeft,
XtNinternalHeight, 0,
XtNtop, XtChainTop,
--- 585,636 ----
xperfmon_width, xperfmon_height));
XtSetValues(appData.toplevel, &arg, 1);
}
/* create windows */
pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel,
XtNborderWidth, 0,
NULL);
XtOverrideTranslations(pappaBox, XtParseTranslationTable(defaultTranslations));
(void)gethostname(hostname, sizeof(hostname));
c = (char *) ((long) &hostname[0] + (int) strlen(hostname));
sprintf(c, "\nUpdate Interval = %5.1f secs", (float)(appData.interval*appData.ms_per_sec)/1000.0);
+ { /* LK!!! handle -geometry option correct, also small changes in handleResize */
+ Window rwin;
+ int x,y,px,py;
+ unsigned int pw,ph,bw,d;
+
+ XtRealizeWidget(appData.toplevel);
+
+ XGetGeometry(XtDisplay(appData.toplevel),XtWindow(appData.toplevel),
+ &rwin,&x,&y,&w,&h,&bw,&d);
+
+ if ( w > MIN_WIDTH) {
+ newWidgetW = w - 10;
+ appData.toplevel->core.width = w;
+ } else {
+ appData.toplevel->core.width = MIN_WIDTH;
+ newWidgetW = MIN_WIDTH - 10;
+ }
+
+ hOverHead = (5.6 * appData.numGraphsOn) - (6 / appData.numGraphsOn);
+ boxH = 22;
+ timeH = 12;
+ if (h > GRAPH_MIN_HEIGHT * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10))
+ newWidgetH = (h - hOverHead - (boxH+7) - (timeH+10)) / appData.numGraphsOn;
+ else
+ newWidgetH = GRAPH_MIN_HEIGHT;
+
+ MIN_HEIGHT = newWidgetH * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+10);
+ appData.toplevel->core.height = MIN_HEIGHT;
+
+ XtResizeWindow(appData.toplevel);
+ }
+
labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox,
! XtNwidth, newWidgetW,
! XtNheight, boxH,
XtNjustify, XtJustifyLeft,
XtNinternalHeight, 0,
XtNtop, XtChainTop,
***************
*** 570,577 ****
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
XtNtopLabel, topNames[i],
XtNbotLabel, botNames[i],
! XtNwidth, 250,
! XtNheight, 36,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNfillRect, (int)appData.fill,
XtNjumpScroll, 1,
--- 645,652 ----
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
XtNtopLabel, topNames[i],
XtNbotLabel, botNames[i],
! XtNwidth, newWidgetW,
! XtNheight, newWidgetH,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNfillRect, (int)appData.fill,
XtNjumpScroll, 1,
***************
*** 580,600 ****
}
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
XtNfromVert, perfmon[1],
! XtNwidth, 250,
! XtNheight, 18,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNjumpScroll, 1,
NULL);
sys_setup();
XtAddCallback(timechart, XtNgetValue, update_time_stat, NULL);
for ( i=0; i<NUM_GRAPHS; i++ )
if ( appData.graphOn[i] )
! XtAddCallback(perfmon[i], XtNgetValue, update_stat, i);
appData.interval_id = XtAppAddTimeOut(appData.app_context,
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
- XtRealizeWidget(appData.toplevel);
XtAppMainLoop(appData.app_context);
}
--- 655,676 ----
}
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
XtNfromVert, perfmon[1],
! XtNwidth, newWidgetW,
! XtNheight, timeH,
XtNupdate, appData.interval*appData.ms_per_sec,
XtNjumpScroll, 1,
NULL);
+
sys_setup();
XtAddCallback(timechart, XtNgetValue, update_time_stat, NULL);
for ( i=0; i<NUM_GRAPHS; i++ )
if ( appData.graphOn[i] )
! XtAddCallback(perfmon[i], XtNgetValue, update_stat, (XtPointer)i);
appData.interval_id = XtAppAddTimeOut(appData.app_context,
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
XtAppMainLoop(appData.app_context);
}
+

View file

@ -1 +1,4 @@
xperfmon++, version 1.1 (with shared libs for X11 and FreeBSD 2.X) xperfmon++, version 1.3 (compiled with shared libs for X11 and FreeBSD 2.X).
A graphical X11 system performance monitor dispaying user/system/idle CPU time,
free swap, disk io, network traffic and nfs calls.

View file

@ -1,8 +1,17 @@
This package contains the binary release of xperfmon++ V1.1 a X based This package contains the binary release of xperfmon++ V1.3 a X based
system performance meter for several systems, ported to FreeBSD 2.X. system performance meter for several systems, ported to FreeBSD 2.X.
The program monitors user-, system-, idle-cputime, free mem, disk io, The program monitors user-, system-, idle-cputime, free swap, disk io,
number of interrupts, network-input, -output, -collision packets and number of interrupts, network-input, -output, -collision packets and
NFS client and server activity. NFS client and server activity.
Please send BUGS and annotations to: lars.koeller@odie.physik2.uni-rostock.de Please send BUGS and annotations to: lars.koeller@odie.physik2.uni-rostock.de
Major changes in xperfmon++ V1.3 due to xperfmon++ V1.1:
- Clean fix of the -geometry option bug, now there is only
a MIN_WIDTH of 185 pixels. The MIN_HEIGTH is calculated
dynamically out of the number of active graphs.
- Display 'Free Swap' in percent without resizing of the graph
- Close some memory leaks
- Display unit of graph in label field.