f5c1a46665
o Fix compiler -Wall warnings o Calc etime correct for multi CPU machines o Show disk stats for "ad" disk devices, too o Count number of network in/out packets correctly o Get free swapspace only every 10 time intervals to limit CPU usage.
419 lines
13 KiB
Text
419 lines
13 KiB
Text
*** ../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);
|