summaryrefslogtreecommitdiff
path: root/sysutils/xperfmon/files/patch-aa
blob: c73a0099d29f53f2d403e877cfb29fde855b3aa4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
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);
 }
+