summaryrefslogtreecommitdiff
path: root/sysutils/xperfmon/files/patch-aa
blob: e8ade8dc514fb19e23c04be7852f0c42a4798c60 (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
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
diff -c -N ../xperfmon++/StripCharP.h ./StripCharP.h
*** ../xperfmon++/StripCharP.h	Wed Jul 27 22:29:30 1994
--- ./StripCharP.h	Tue Dec  5 09:31:56 1995
***************
*** 62,71 ****
  #define HIGHLIGHT  1 << 1
  #define ALL_GCS (FOREGROUND | HIGHLIGHT)
  
  /* New fields for the PerfChart widget instance record */
  
  typedef struct {
!     double valuedata[2048];	/* record of data points */
      Pixel	fgpixel;	/* color index for graph */
      Pixel	hipixel;	/* color index for lines */
      Pixel       warnColor;
--- 62,73 ----
  #define HIGHLIGHT  1 << 1
  #define ALL_GCS (FOREGROUND | HIGHLIGHT)
  
+ #define NUM_VALUES 2048
+ 
  /* New fields for the PerfChart widget instance record */
  
  typedef struct {
!     double valuedata[NUM_VALUES]; /* record of data points */
      Pixel	fgpixel;	/* color index for graph */
      Pixel	hipixel;	/* color index for lines */
      Pixel       warnColor;
diff -c -N ../xperfmon++/StripChart.c ./StripChart.c
*** ../xperfmon++/StripChart.c	Wed Jul 27 22:29:30 1994
--- ./StripChart.c	Fri Mar 14 13:31:42 1997
***************
*** 53,58 ****
--- 53,70 ----
  #include <X11/StringDefs.h>
  #include <X11/Xaw/XawInit.h>
  #include "StripCharP.h"
+ 
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ 
+ #if (defined(BSD) && (BSD >= 199306))
+ # include <osreldate.h>
+ #else
+ # error You have to use at least a FreeBSD 2.X system
+ #endif
+ 
+ # include "system.h"
  #include <X11/Xfuncs.h>
  
  #define MS_PER_SEC 100
***************
*** 108,114 ****
  };
  
  #undef offset
! #define LABEL_ROOM 100
  static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
  static Boolean SetValues();
  static int repaint_window();
--- 120,130 ----
  };
  
  #undef offset
! #if (defined(BSD) && (BSD >= 199306))
! # define LABEL_ROOM 80
! #else
! # define LABEL_ROOM 100
! #endif
  static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
  static Boolean SetValues();
  static int repaint_window();
***************
*** 215,222 ****
--- 231,253 ----
  static void Initialize (greq, gnew)
      Widget greq, gnew;
  {
+     int i;
+ 
      PerfChartWidget w = (PerfChartWidget)gnew;
  
+     /*
+      * XXX The missing initializations have been made obvious by FreeBSD 2.2's
+      * new (`phk') malloc that doesn't initialize the malloc'ed areas to 0.
+      * 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.
+      *
+      * Strange that people in the 90's still rely on malloc()
+      * returning an initialized region.
+      */
+     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)) {
--- 354,361 ----
  	   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;
  	       }
  	   }
--- 374,392 ----
  
  	   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;
  	       }
  	   }
--- 404,422 ----
  
  	   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;
  
--- 479,493 ----
  
      /* 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 (defined(BSD) && (BSD >= 199306))
!       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);
  	}
--- 517,528 ----
  /* 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.c ./TimeChart.c
*** ../xperfmon++/TimeChart.c	Wed Jul 27 22:29:31 1994
--- ./TimeChart.c	Fri Mar 14 13:30:16 1997
***************
*** 47,52 ****
--- 47,62 ----
   *                   Moffett Field, California, rsmith@proteus.arc.nasa.gov
  ******************************************************************/
  
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ 
+ #if (defined(BSD) && (BSD >= 199306))
+ # include <osreldate.h>
+ #else
+ # error You have to use at least a FreeBSD 2.X system
+ #endif
+ 
  #include <stdio.h>
  #include <X11/IntrinsicP.h>
  #include <X11/StringDefs.h>
diff -c -N ../xperfmon++/TimeChart.h ./TimeChart.h
*** ../xperfmon++/TimeChart.h	Wed Jul 27 22:29:31 1994
--- ./TimeChart.h	Mon Oct 30 12:53:59 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 Mar 14 13:31:48 1997
***************
*** 22,27 ****
--- 22,38 ----
   * Author:           Roger Smith, Sterling Software @ NASA-Ames Research Center
   *                   Moffett Field, California, rsmith@proteus.arc.nasa.gov
   */
+ 
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ 
+ #if (defined(BSD) && (BSD >= 199306))
+ # include <osreldate.h>
+ #else
+ # error You have to use at least a FreeBSD 2.X system
+ #endif
+ 
  #include <stdio.h>
  
  #include <X11/IntrinsicP.h>
***************
*** 58,64 ****
      int i, keycode, length = 0;
  /*    PerfmonWidget pw = (PerfmonWidget) w;*/
  
!     length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL);
      switch (keycode) {
      case 'Q':
      case 'q':
--- 69,75 ----
      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 Mar 14 13:16:19 1997
***************
*** 151,168 ****
--- 151,182 ----
      "Idle",
      "Free",
      "Disk",
+ #if (defined(BSD) && (BSD >= 199306))
+     "Inter-",
+ #else
      "Interrupts",
+ #endif
      "Input",
      "Output",
+ #if (defined(BSD) && (BSD >= 199306))
+     "Collis",
+     "NFS Clt",
+     "NFS Srv",
+ #else
      "Collision",
      "NFS Client",
      "NFS Server",
+ #endif
  };
  static char *widgetLabels[] = {
      "User",
      "System",
      "Idle",
+ #if (defined(BSD) && (BSD >= 199306))
+     "Swap",
+ #else
      "Free",
+ #endif
      "Disk",
      "Intrpts",
      "Input",
***************
*** 171,177 ****
--- 185,205 ----
      "NFSClient",
      "NFSServer",
  };
+ 
  static char *botNames[] = {
+ #if (defined(BSD) && (BSD >= 199306))
+     "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 Mar 14 13:30:50 1997
***************
*** 58,63 ****
--- 58,73 ----
   *
   */
  
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ 
+ #if (defined(BSD) && (BSD >= 199306))
+ # include <osreldate.h>
+ #else
+ # error You have to use at least a FreeBSD 2.X system
+ #endif
+ 
  #include <stdio.h>
  #include <X11/IntrinsicP.h>
  #include <X11/StringDefs.h>
***************
*** 94,99 ****
--- 104,114 ----
       { 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"
--- 116,121 ----
***************
*** 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 },
--- 182,198 ----
  static XrmOptionDescRec optionDescList[] = {
      { "-interval",  ".interval",    XrmoptionSepArg,    (caddr_t) NULL},
      { "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
! #if (defined(BSD) && (BSD >= 199306))
!     { "-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 ****
--- 254,266 ----
      { "+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),
--- 275,285 ----
***************
*** 324,329 ****
--- 340,348 ----
  void
  usage()
  {
+ #if (defined(BSD) && (BSD >= 199306))
+     fprintf(stderr, "\nxperfmon++ V1.33 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 ****
--- 363,373 ----
      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 (defined(BSD) && (BSD >= 199306))
+     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 ****
--- 384,401 ----
      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 (defined(BSD) && (BSD >= 199306))
+     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 (defined(BSD) && (BSD >= 199306))
+     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 ****
--- 417,423 ----
      time(&timeStamp);
      return;
  }
+ 
  /*ARGSUSED*/
  void handleResize( w, unused, event, contin2disp )
  Widget w;
***************
*** 394,400 ****
  Boolean *contin2disp;
  {
      Dimension neww, newh;
!     int i;
      char eventString[60];
      switch (event->type) {
      case Expose:
--- 426,433 ----
  Boolean *contin2disp;
  {
      Dimension neww, newh;
!     Dimension hOverHead, boxH, timeH, newWidgetH;
!     int i, window_size_changed;
      char eventString[60];
      switch (event->type) {
      case Expose:
***************
*** 403,415 ****
  	strcpy(eventString,"expose");
  	break;
      case MapNotify:
! 	neww=0;
! 	newh=0;
  	strcpy(eventString,"map notify");
  	break;
      case ReparentNotify:
! 	neww=0;
! 	newh=0;
  	strcpy(eventString,"reparent");
  	break;
      case ConfigureNotify:
--- 436,453 ----
  	strcpy(eventString,"expose");
  	break;
      case MapNotify:
! 	neww=w->core.width;
! 	newh=oldHeight;
  	strcpy(eventString,"map notify");
  	break;
+     case UnmapNotify:
+ 	neww=w->core.width;
+ 	newh=oldHeight;
+ 	strcpy(eventString,"unmap notify");
+ 	break;
      case ReparentNotify:
! 	neww=w->core.width;
! 	newh=oldHeight;
  	strcpy(eventString,"reparent");
  	break;
      case ConfigureNotify:
***************
*** 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,
--- 455,489 ----
  	newh=event->xconfigure.height;
  	strcpy(eventString,"configure");
  	break;
+     }
  
+     if ( neww < MIN_WIDTH ) {
+ 	neww = MIN_WIDTH;
+ 	w->core.width = MIN_WIDTH;
+ 	window_size_changed = TRUE;
+     } else {
+         w->core.width = neww;
      }
! 
!     if ( newh < MIN_HEIGHT ) {
! 	newh = MIN_HEIGHT;
! 	w->core.height = MIN_HEIGHT;
! 	window_size_changed = TRUE;
!     }
! 
!     /* 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;
      }
+ 
+     if( neww != oldWidth || newh != oldHeight || window_size_changed == TRUE )
+       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] ) {
--- 491,504 ----
  	       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] ) {
***************
*** 455,460 ****
--- 511,517 ----
  	XFlush(XtDisplay(w));
  
      }
+ 
      oldWidth = neww+=10, oldHeight = newh;
      return;
  }
***************
*** 464,472 ****
      int argc;
      char **argv;
  {
      Arg arg;
      Pixmap icon_pixmap = None;
!     Widget  loadParent, pappaBox;
  
      char *progname = argv[0];
      Bool foundAnAdd = FALSE;
--- 521,533 ----
      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;
***************
*** 478,483 ****
--- 539,548 ----
  				 optionDescList, XtNumber(optionDescList), 
  				 &argc, argv,
  				 NULL, NULL);
+ 
+     appData.toplevel->core.width=MIN_WIDTH;
+     appData.toplevel->core.height=MIN_HEIGHT;
+ 
      if (argc != 1) usage();
  
      if ( appData.toplevel->core.depth == 1 )
***************
*** 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,
--- 605,656 ----
  		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,
--- 665,672 ----
  	    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);
  }
--- 675,696 ----
      }
      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);
  }
+