aboutsummaryrefslogtreecommitdiff
path: root/sysutils/xperfmon3/files/patch-ad
blob: 8b15c86cbf831a6b4fb683b47fd0b795d0c77ff3 (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
*** ../xperfmon++/TimeChart.c	Wed Jul 27 22:29:31 1994
--- ./TimeChart.c	Tue Apr 10 21:50:32 2001
***************
*** 1,4 ****
! /* $XConsortium: TimeChart.c,v 1.20 91/05/24 17:20:42 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,9 ----
! /*
!  * Enhancement and error correction for FreeBSD-3.X
!  * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
!  *
!  *      $Id: TimeChart.c,v 1.5 2001/04/10 19:50:19 lkoeller Exp lkoeller $
!  */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 6,18 ****
  
                          All Rights Reserved
  
! Permission to use, copy, modify, and distribute this software and its 
! documentation for any purpose and without fee is hereby granted, 
  provided that the above copyright notice appear in all copies and that
! both that copyright notice and this permission notice appear in 
  supporting documentation, and that the names of Digital or MIT not be
  used in advertising or publicity pertaining to distribution of the
! software without specific, written prior permission.  
  
  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
--- 11,23 ----
  
                          All Rights Reserved
  
! Permission to use, copy, modify, and distribute this software and its
! documentation for any purpose and without fee is hereby granted,
  provided that the above copyright notice appear in all copies and that
! both that copyright notice and this permission notice appear in
  supporting documentation, and that the names of Digital or MIT not be
  used in advertising or publicity pertaining to distribution of the
! software without specific, written prior permission.
  
  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
***************
*** 28,34 ****
   * documentation for any purpose and without fee is hereby granted, provided that
   * the above copyright notice appear in all copies and that both that
   * copyright notice and this permission notice appear in supporting
!  * documentation, and that the name of NASA and Sterling Software (collectively 
   * or individually) are not be used in advertising or
   * publicity pertaining to distribution of the software without specific,
   * written prior permission.  NASA and Sterling Software makes no representations about the
--- 33,39 ----
   * documentation for any purpose and without fee is hereby granted, provided that
   * the above copyright notice appear in all copies and that both that
   * copyright notice and this permission notice appear in supporting
!  * documentation, and that the name of NASA and Sterling Software (collectively
   * or individually) are not be used in advertising or
   * publicity pertaining to distribution of the software without specific,
   * written prior permission.  NASA and Sterling Software makes no representations about the
***************
*** 39,45 ****
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NASA & STERLING SOFTWARE
   * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   * 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 
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   *
   * 1994 Revision
--- 44,50 ----
   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NASA & STERLING SOFTWARE
   * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   * 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
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   *
   * 1994 Revision
***************
*** 47,52 ****
--- 52,61 ----
   *                   Moffett Field, California, rsmith@proteus.arc.nasa.gov
  ******************************************************************/
  
+ #ifndef LINT
+ static char rcsid[] = "$Id: TimeChart.c,v 1.5 2001/04/10 19:50:19 lkoeller Exp lkoeller $";
+ #endif
+ 
  #include <stdio.h>
  #include <X11/IntrinsicP.h>
  #include <X11/StringDefs.h>
***************
*** 97,103 ****
  extern void handleResize();
  static Boolean SetValues();
  static int repaint_window();
- static int firstTime=TRUE;
  Dimension oldHeight, oldWidth;
  time_t timeStamp;
  char numstring[32];
--- 106,111 ----
***************
*** 190,199 ****
  TimeChartWidget w;
  unsigned int which;
  {
!   if (which & FOREGROUND) 
      XtReleaseGC((Widget) w, w->time_chart.fgGC);
  
!   if (which & HIGHLIGHT) 
      XtReleaseGC((Widget) w, w->time_chart.hiGC);
  }
  
--- 198,207 ----
  TimeChartWidget w;
  unsigned int which;
  {
!   if (which & FOREGROUND)
      XtReleaseGC((Widget) w, w->time_chart.fgGC);
  
!   if (which & HIGHLIGHT)
      XtReleaseGC((Widget) w, w->time_chart.hiGC);
  }
  
***************
*** 239,245 ****
  }
  
  /*
!  * NOTE: This function really needs to recieve graphics exposure 
   *       events, but since this is not easily supported until R4 I am
   *       going to hold off until then.
   */
--- 247,253 ----
  }
  
  /*
!  * NOTE: This function really needs to recieve graphics exposure
   *       events, but since this is not easily supported until R4 I am
   *       going to hold off until then.
   */
***************
*** 251,263 ****
       Region region;
  {
      TimeChartWidget ww = (TimeChartWidget)w;
!     if ( firstTime ) {
! 	XtInsertEventHandler(appData.toplevel, StructureNotifyMask, FALSE, handleResize, (Opaque)NULL, XtListHead);
! 	firstTime = FALSE;
! 	oldHeight = (int)ww->core.parent->core.parent->core.height;
! 	oldWidth = (int)ww->core.parent->core.parent->core.width;
! /*	printf("oldHeight=%d, oldWidth=%d\n", oldHeight, oldWidth);*/
!     }
      if (event->type == GraphicsExpose)
  	(void) repaint_window ((TimeChartWidget)w, event->xgraphicsexpose.x,
  			       event->xgraphicsexpose.width);
--- 259,268 ----
       Region region;
  {
      TimeChartWidget ww = (TimeChartWidget)w;
! 
!     oldHeight = (int)ww->core.parent->core.parent->core.height;
!     oldWidth = (int)ww->core.parent->core.parent->core.width;
! 
      if (event->type == GraphicsExpose)
  	(void) repaint_window ((TimeChartWidget)w, event->xgraphicsexpose.x,
  			       event->xgraphicsexpose.width);
***************
*** 274,280 ****
     TimeChartWidget w = (TimeChartWidget)client_data;
     time_t value;
     Display *dpy = XtDisplay(w);
-    Window win = XtWindow(w);
     int x,y;
  
  /*   if (w->time_chart.update > 0)
--- 279,284 ----
***************
*** 342,353 ****
  TimeChartWidget w;
  int left, width;
  {
!     register int i, j;
      int oldInterval;
      register int next = w->time_chart.interval;
      int scale = w->time_chart.scale;
      int scalewidth = 0;
!     int x, x1, x2, y, y1, y2;
      char numstring[32];
  #if 0
      /* Compute the minimum scale required to graph the data, but don't go
--- 346,357 ----
  TimeChartWidget w;
  int left, width;
  {
!     register int i;
      int oldInterval;
      register int next = w->time_chart.interval;
      int scale = w->time_chart.scale;
      int scalewidth = 0;
!     int x, y;
      char numstring[32];
  #if 0
      /* Compute the minimum scale required to graph the data, but don't go
***************
*** 364,388 ****
  
        SetPoints(w);
  
!       if (XtIsRealized ((Widget) w)) 
  	XClearWindow (XtDisplay (w), XtWindow (w));
  
      }
  #endif
!     if (XtIsRealized ((Widget) w)) 
  	XClearWindow (XtDisplay (w), XtWindow (w));
  
      if ( left == 0 || left < LABEL_ROOM ) left = LABEL_ROOM;
!     
      if (XtIsRealized((Widget)w)) {
  	Display *dpy = XtDisplay(w);
! 	Window win = XtWindow(w);
! 	
  	width += left - 1;
  	if (!scalewidth) scalewidth = width;
! 	
  	if (next < ++width) width = next;
! 	
  	w->time_chart.next_x = 0;
  	w->time_chart.last_end = 0;
  	w->time_chart.num_timestamps = 0;
--- 368,391 ----
  
        SetPoints(w);
  
!       if (XtIsRealized ((Widget) w))
  	XClearWindow (XtDisplay (w), XtWindow (w));
  
      }
  #endif
!     if (XtIsRealized ((Widget) w))
  	XClearWindow (XtDisplay (w), XtWindow (w));
  
      if ( left == 0 || left < LABEL_ROOM ) left = LABEL_ROOM;
! 
      if (XtIsRealized((Widget)w)) {
  	Display *dpy = XtDisplay(w);
! 
  	width += left - 1;
  	if (!scalewidth) scalewidth = width;
! 
  	if (next < ++width) width = next;
! 
  	w->time_chart.next_x = 0;
  	w->time_chart.last_end = 0;
  	w->time_chart.num_timestamps = 0;
***************
*** 425,431 ****
  		}
  	    }
  	}
! 	if ( oldInterval ) 
  	    w->time_chart.interval = oldInterval;
      }
      return(next);
--- 428,434 ----
  		}
  	    }
  	}
! 	if ( oldInterval )
  	    w->time_chart.interval = oldInterval;
      }
      return(next);
***************
*** 442,449 ****
  TimeChartWidget w;
  Boolean blit;
  {
!     double old_max;
!     int left, i, j;
      register int next = w->time_chart.interval;
  
      if (!XtIsRealized((Widget) w)) return;
--- 445,451 ----
  TimeChartWidget w;
  Boolean blit;
  {
!     int j;
      register int next = w->time_chart.interval;
  
      if (!XtIsRealized((Widget) w)) return;
***************
*** 461,474 ****
      next = w->time_chart.interval = j;
  
      XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w),
! 	      w->time_chart.hiGC, 
  	      (int) (w->core.width - j), 0,		     /* source x, y */
  	      (unsigned int) j, (unsigned int) w->core.height, /* width, height */
  	      0, 0);					     /* dest x, y */
  
  
!     XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), 
! 	       (int) j, 0, 
  	       (unsigned int) w->core.width - j, (unsigned int)w->core.height,
  	       FALSE);
  
--- 463,476 ----
      next = w->time_chart.interval = j;
  
      XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w),
! 	      w->time_chart.hiGC,
  	      (int) (w->core.width - j), 0,		     /* source x, y */
  	      (unsigned int) j, (unsigned int) w->core.height, /* width, height */
  	      0, 0);					     /* dest x, y */
  
  
!     XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w),
! 	       (int) j, 0,
  	       (unsigned int) w->core.width - j, (unsigned int)w->core.height,
  	       FALSE);
  
***************
*** 480,489 ****
  	if ( j > 31 ) break;
  	w->time_chart.timestamp_end[j]--;
      }
!     
      if (w->time_chart.timestamp_end[0] <= LABEL_ROOM ) {
! 	XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), 
! 		   0, 0, 
  		   LABEL_ROOM, (unsigned int)w->core.height,
  		   FALSE);
  	for ( j=1; j < w->time_chart.num_timestamps; j++ ) {
--- 482,491 ----
  	if ( j > 31 ) break;
  	w->time_chart.timestamp_end[j]--;
      }
! 
      if (w->time_chart.timestamp_end[0] <= LABEL_ROOM ) {
! 	XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w),
! 		   0, 0,
  		   LABEL_ROOM, (unsigned int)w->core.height,
  		   FALSE);
  	for ( j=1; j < w->time_chart.num_timestamps; j++ ) {
***************
*** 491,497 ****
  	}
  	w->time_chart.num_timestamps--;
      }
!     
      return;
  }
  
--- 493,499 ----
  	}
  	w->time_chart.num_timestamps--;
      }
! 
      return;
  }
  
***************
*** 516,532 ****
  */
      if ( w->time_chart.min_scale > (int) ((w->time_chart.max_value) + 1) )
        ret_val = TRUE;
!      
      if ( w->time_chart.fgpixel != old->time_chart.fgpixel ) {
        new_gc |= FOREGROUND;
        ret_val = True;
      }
!     
      if ( w->time_chart.hipixel != old->time_chart.hipixel ) {
        new_gc |= HIGHLIGHT;
        ret_val = True;
      }
!     
      DestroyGC(old, new_gc);
      CreateGC(w, new_gc);
  
--- 518,534 ----
  */
      if ( w->time_chart.min_scale > (int) ((w->time_chart.max_value) + 1) )
        ret_val = TRUE;
! 
      if ( w->time_chart.fgpixel != old->time_chart.fgpixel ) {
        new_gc |= FOREGROUND;
        ret_val = True;
      }
! 
      if ( w->time_chart.hipixel != old->time_chart.hipixel ) {
        new_gc |= HIGHLIGHT;
        ret_val = True;
      }
! 
      DestroyGC(old, new_gc);
      CreateGC(w, new_gc);
  
***************
*** 554,560 ****
  	w->time_chart.points = NULL;
  	return;
      }
!     
      size = sizeof(XPoint) * (w->time_chart.scale - 1);
  
      points = (XPoint *) XtRealloc( (XtPointer) w->time_chart.points, size);
--- 556,562 ----
  	w->time_chart.points = NULL;
  	return;
      }
! 
      size = sizeof(XPoint) * (w->time_chart.scale - 1);
  
      points = (XPoint *) XtRealloc( (XtPointer) w->time_chart.points, size);