summaryrefslogblamecommitdiff
path: root/sysutils/xperfmon3/files/patch-aa
blob: c73a0099d29f53f2d403e877cfb29fde855b3aa4 (plain) (tree)





































































                                                                                                  
  








































































































































































































































































































































































                                                                                                                   
diff -u ../xperfmon++.orig/Imakefile ./Imakefile
--- ../xperfmon++.orig/Imakefile	Wed Jul 27 22:29:29 1994
+++ ./Imakefile	Sun Nov 12 00:07:24 1995
@@ -17,15 +17,21 @@
 SYS_MODULE=	sgi_system
 #endif
 
-EXTRA_LIBRARIES =     $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS)
+#if defined (i386BsdArchitecture)
+BSDFLAGS=	-lkvm
+SYS_MODULE=     bsd_system
+CC=		gcc
+#endif
+
+EXTRA_LIBRARIES =     $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(BSDFLAGS)
 
    INSTPGMFLAGS =  $(INSTKMEMFLAGS)
 LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB)
        INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11
-#       INCLUDES = -I. -I$(TOOLKITSRC) -I$(TOP) -I$(TOP)/X11 -I/usr/include/bsd
-     CDEBUGFLAGS = -O
-           SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c nfs.c
-           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 nfs.c
+#      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
+       OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o
 
 ComplexProgramTarget(xperfmon++)
 
diff -u ../xperfmon++.orig/README ./README
--- ../xperfmon++.orig/README	Wed Jul 27 22:29:30 1994
+++ ./README	Sun Nov 12 00:07:24 1995
@@ -18,3 +18,20 @@
 		Research Center, rsmith@proteus.arc.nasa.gov. Imake will build for correct
 		O/S if x11r5 is fully installed in all the right places.
 
+
+3-15-95		Completely new port of systemdependent file (bsd_system.c) for FreeBSD-2.X
+		by Lars K�ller @University of Rostock, Germany.
+		E-Mail: <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. 
+		Fix memory leak in bsd_system.c
+		by Lars K�ller @University of Rostock, Germany.
+		E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
+
+30-10-95	Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system
+		tries to minimize the free unused amount of memory.
+		Include basic support for FreeBSD > 2.1.
+		Number of interrupts now independent from 
+		by Lars K�ller @University of Rostock, Germany.
+		E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
diff -u ../xperfmon++.orig/TimeChart.h ./TimeChart.h
--- ../xperfmon++.orig/TimeChart.h	Wed Jul 27 22:29:31 1994
+++ ./TimeChart.h	Sun Nov 12 00:07:24 1995
@@ -88,12 +88,12 @@
 #define XtCFillRect "FillRect"
 
 #define XtNgetValue "getValue"
-#define XtNhighlight "highlight"
+/* #define XtNhighlight "highlight" */
 #define XtNjumpScroll "jumpScroll"
 #define XtNminScale "minScale"
 #define XtNscale "scale"
 #define XtNfillRect "fillRect"
-#define XtNupdate "update"
+/* #define XtNupdate "update" */
 #define XtNvmunix "vmunix"
  
 typedef struct _TimeChartRec *TimeChartWidget;
diff -u ../xperfmon++.orig/XPerfmon++.ad ./XPerfmon++.ad
--- ../xperfmon++.orig/XPerfmon++.ad	Wed Jul 27 22:29:32 1994
+++ ./XPerfmon++.ad	Sun Nov 12 00:07:23 1995
@@ -4,24 +4,37 @@
 ! commented out, the "NFS Server" graph background will be the application
 ! default color, unless some other resource file has specified it.
 ! *PerfChart.highAlarm:		99998
+*perfChartUser.highAlarm:	95
+*perfChartUser.highWarn:	75
+
+*perfChartSystem.highAlarm:	40
+*perfChartSystem.highWarn:	25
+
 *perfChartIdle.lowWarn:		10
 *perfChartIdle.lowAlarm:	5
-*perfChartUser.highAlarm:	90
-*perfChartUser.highWarn:	75
-*perfChartSystem.highAlarm:	90
-*perfChartSystem.highWarn:	75
-*perfChartFree.lowWarn:		2000
-*perfChartFree.lowAlarm:	1000
-*perfChartDisk.highWarn:	25
-*perfChartDisk.highAlarm:	50
-*perfChartIntrpts.highWarn:	500
-*perfChartIntrpts.highAlarm:	750
-*perfChartInput.highWarn:	300
-*perfChartInput.highAlarm:	500
-*perfChartOutput.highWarn:	300
-*perfChartOutput.highAlarm:	500
+
+*perfChartSwap.highWarn:	50
+*perfChartSwap.highAlarm:	100
+
+*perfChartDisk.highWarn:	50
+*perfChartDisk.highAlarm:	100
+
+*perfChartIntrpts.highWarn:	400
+*perfChartIntrpts.highAlarm:	600
+
+*perfChartInput.highWarn:	500
+*perfChartInput.highAlarm:	1000
+
+*perfChartOutput.highWarn:	500
+*perfChartOutput.highAlarm:	1000
+
 *perfChartCollision.highWarn:	20
 *perfChartCollision.highAlarm:	50
-*perfChartNFSClient.highWarn:	200
-*perfChartNFSClient.highAlarm:	400
+
+*perfChartNFSClient.highWarn:	100
+*perfChartNFSClient.highAlarm:	200
+
+*perfChartNFSServer.highWarn:	100
+*perfChartNFSServer.highAlarm:	200
 *font:				6x13
+
Only in .: bsd_system.c
diff -u ../xperfmon++.orig/misc.c ./misc.c
--- ../xperfmon++.orig/misc.c	Wed Jul 27 22:29:33 1994
+++ ./misc.c	Sun Nov 12 00:07:24 1995
@@ -58,7 +58,7 @@
     int i, keycode, length = 0;
 /*    PerfmonWidget pw = (PerfmonWidget) w;*/
 
-    length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL);
+    length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL);
     switch (keycode) {
     case 'Q':
     case 'q':
diff -u ../xperfmon++.orig/system.h ./system.h
--- ../xperfmon++.orig/system.h	Wed Jul 27 22:29:34 1994
+++ ./system.h	Sun Nov 12 00:07:24 1995
@@ -149,7 +149,11 @@
     "User",
     "System",
     "Idle",
+#ifdef __FreeBSD__
+    "Swap",
+#else
     "Free",
+#endif
     "Disk",
     "Interrupts",
     "Input",
@@ -162,7 +166,11 @@
     "User",
     "System",
     "Idle",
+#ifdef __FreeBSD__
+    "Swap",
+#else
     "Free",
+#endif
     "Disk",
     "Intrpts",
     "Input",
@@ -175,7 +183,11 @@
     "CPU",
     "CPU",
     "CPU",
+#ifdef __FreeBSD__
+    "Usage (MB)",
+#else
     "Memory",
+#endif
     "Transfers",
     "",
     "Packets",
diff -u ../xperfmon++.orig/xperfmon++.man ./xperfmon++.man
--- ../xperfmon++.orig/xperfmon++.man	Wed Jul 27 22:29:39 1994
+++ ./xperfmon++.man	Sun Nov 12 00:14:56 1995
@@ -94,8 +94,8 @@
 .B \-idlecpu | \+idlecpu
 Graph \fIIdle\fP CPU Percentage.
 .TP 26
-.B \-freemem | \+freemem
-Graph \fIFree Memory\fP.
+.B \-{freemem/usedswap} | \+{freemem/usedswap}
+Graph \fIFree Memory/Used Swap (Operating system dependent, swap only for FreeBSD)\fP.
 .TP 26
 .B \-diskxfr | \+diskxfr
 Graph \fIDisk Transfers\fP per interval period.
@@ -176,8 +176,8 @@
 .B idle
 Set \fIlimit\fP value for Idle CPU Percentage.
 .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).
 .TP 12
 .B disk
 Set \fIlimit\fP value for Disk Transfers.
@@ -314,7 +314,7 @@
 Set System CPU Percentage resource.
 .TP 16
 .B Free
-Set Free Memory resource.
+Set Free Memory/Swap resource.
 .TP 16
 .B Disk
 Set Disk Transfer count resource.
diff -u ../xperfmon++.orig/xperfmon.c ./xperfmon.c
--- ../xperfmon++.orig/xperfmon.c	Wed Jul 27 22:29:39 1994
+++ ./xperfmon.c	Sun Nov 12 00:13:55 1995
@@ -58,6 +58,10 @@
  *
  */
 
+#ifdef __FreeBSD__
+#include <osreldate.h>
+#endif
+
 #include <stdio.h>
 #include <X11/IntrinsicP.h>
 #include <X11/StringDefs.h>
@@ -94,6 +98,11 @@
      { NULL,           NULL      },
 };
 
+/* LK!!! */
+#define MIN_WIDTH 240
+#define MIN_HEIGHT 430
+
+
 #define XtNinterval "interval"
 #define XtNcount "count"
 #define XtCCount "Count"
@@ -171,11 +180,17 @@
 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,8 +252,13 @@
     { "+systemcpu", XtNsystemcpuAdd,     XrmoptionNoArg,     "TRUE" },
     { "-idlecpu",   XtNidlecpuSub,     XrmoptionNoArg,     "True" },
     { "+idlecpu",   XtNidlecpuAdd,     XrmoptionNoArg,     "TRUE" },
+#if __FreeBSD_version >= 199504
+    { "-usedswap",  XtNfreememSub,     XrmoptionNoArg,     "True" },
+    { "+usedswap",  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" },
@@ -344,7 +364,11 @@
     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, "    [{-+}usedswap]         ({remove|add} usedswap 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,10 +385,18 @@
     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,6 +418,7 @@
     time(&timeStamp);
     return;
 }
+
 /*ARGSUSED*/
 void handleResize( w, unused, event, contin2disp )
 Widget w;
@@ -419,9 +452,15 @@
 	break;
 
     }
-    if ( neww < 250 + 10 ) {
-	neww = 250 + 10;
-	w->core.width = 250 + 10;
+    if ( neww < MIN_WIDTH + 10 ) {
+	neww = MIN_WIDTH + 10;
+	w->core.width = MIN_WIDTH + 10;
+	XtResizeWindow(w);
+    }
+/* LK!!! */
+    if ( newh < MIN_HEIGHT + 10 ) {
+	newh = MIN_HEIGHT + 10;
+	w->core.height = MIN_HEIGHT + 10;
 	XtResizeWindow(w);
     }
     if ( appData.debug )
@@ -436,6 +475,7 @@
 	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 )
@@ -464,6 +504,9 @@
     int argc;
     char **argv;
 {
+/* LK!!! */
+    Dimension neww, newh, timeH, newWidgetH, hOverHead, boxH;
+
     Arg arg;
     Pixmap icon_pixmap = None;
     Widget  loadParent, pappaBox;
@@ -540,7 +583,6 @@
 		xperfmon_width, xperfmon_height));
 	XtSetValues(appData.toplevel, &arg, 1);
     }
-
 /* create windows */
 
     pappaBox = XtVaCreateManagedWidget("PappaBox", boxWidgetClass, appData.toplevel, 
@@ -553,8 +595,24 @@
     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!!! quick and dirty hack */
+    XtRealizeWidget(appData.toplevel);
+
+    neww = appData.toplevel->core.width;
+    newh = appData.toplevel->core.height;
+    if ( neww < MIN_WIDTH + 10) {
+	neww = MIN_WIDTH + 10;
+	appData.toplevel->core.width = MIN_WIDTH + 10;
+	XtResizeWindow(appData.toplevel);
+    }
+    if ( newh < MIN_HEIGHT + 10) {
+	newh = MIN_HEIGHT + 10;
+	appData.toplevel->core.height = MIN_HEIGHT + 10;
+	XtResizeWindow(appData.toplevel);
+    }
+    neww -= 10;
     labelBox = XtVaCreateManagedWidget("LabelBox", labelWidgetClass, pappaBox,
-					 XtNwidth, 250,
+					 XtNwidth, neww,
 /*					 XtNheight, 16,*/
 				         XtNjustify, XtJustifyLeft,
 				         XtNinternalHeight, 0,
@@ -562,6 +620,13 @@
 				         XtNlabel, hostname,
 				         XtNborderWidth, 0,
 					 NULL);
+
+/* same as in handleResize */
+    hOverHead = 5 * appData.numGraphsOn;
+    boxH = labelBox->core.height;
+    timeH = 18;
+    newWidgetH = (newh - (boxH+8) - (timeH+10) - hOverHead) / appData.numGraphsOn;
+
 /* build the graph widgets */
 
     for ( i=0; i<NUM_GRAPHS; i++ ) {
@@ -570,8 +635,8 @@
 	    perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox, 
 						 XtNtopLabel, topNames[i],
 						 XtNbotLabel, botNames[i],
-						 XtNwidth, 250,
-						 XtNheight, 36,
+						 XtNwidth, neww,
+						 XtNheight,  newWidgetH,
 						 XtNupdate, appData.interval*appData.ms_per_sec,
 						 XtNfillRect, (int)appData.fill,
 						 XtNjumpScroll, 1,
@@ -580,7 +645,7 @@
     }
     timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox, 
 					 XtNfromVert, perfmon[1], 
-					 XtNwidth, 250,
+					 XtNwidth, neww,
 					 XtNheight, 18,
 					 XtNupdate, appData.interval*appData.ms_per_sec,
 					 XtNjumpScroll, 1,
@@ -590,7 +655,7 @@
 
     for ( i=0; i<NUM_GRAPHS; i++ ) 
 	if ( appData.graphOn[i] ) 
-	    XtAddCallback(perfmon[i], XtNgetValue, update_stat, 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);
@@ -598,3 +663,4 @@
     XtRealizeWidget(appData.toplevel);
     XtAppMainLoop(appData.app_context);
 }
+