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.
181 lines
6.7 KiB
Plaintext
181 lines
6.7 KiB
Plaintext
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
|
|
--- ./misc.c Tue Apr 10 21:48:00 2001
|
|
***************
|
|
*** 1,10 ****
|
|
/* Copyright 1994, Roger Smith for Sterling Software and NASA-Ames Research Center
|
|
*
|
|
* 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 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
|
|
--- 1,17 ----
|
|
+ /*
|
|
+ * Enhancement and error correction for FreeBSD-3.X
|
|
+ * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
|
|
+ *
|
|
+ * $Id: misc.c,v 3.4 2001/04/10 19:47:38 lkoeller Exp lkoeller $
|
|
+ */
|
|
+
|
|
/* Copyright 1994, Roger Smith for Sterling Software and NASA-Ames Research Center
|
|
*
|
|
* 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 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
|
|
***************
|
|
*** 15,27 ****
|
|
* 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
|
|
* Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
#include <X11/IntrinsicP.h>
|
|
--- 22,40 ----
|
|
* 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
|
|
* Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
|
*/
|
|
+
|
|
+ #ifndef LINT
|
|
+ static char rcsid[] = "$Id: misc.c,v 3.4 2001/04/10 19:47:38 lkoeller Exp lkoeller $";
|
|
+ #endif
|
|
+
|
|
+ #include "fbsd_vers.h"
|
|
#include <stdio.h>
|
|
|
|
#include <X11/IntrinsicP.h>
|
|
***************
|
|
*** 42,48 ****
|
|
|
|
static void adjust_timeout();
|
|
|
|
! /* This routine interprets the key that was pressed on top of the window.
|
|
* It returns TRUE if Quit has been selected, signaling that the program
|
|
* is done.
|
|
*/
|
|
--- 55,61 ----
|
|
|
|
static void adjust_timeout();
|
|
|
|
! /* This routine interprets the key that was pressed on top of the window.
|
|
* It returns TRUE if Quit has been selected, signaling that the program
|
|
* is done.
|
|
*/
|
|
***************
|
|
*** 58,64 ****
|
|
int i, keycode, length = 0;
|
|
/* PerfmonWidget pw = (PerfmonWidget) w;*/
|
|
|
|
! length = XLookupString(event, strbuf, STRBUFSIZE, &keycode, NULL);
|
|
switch (keycode) {
|
|
case 'Q':
|
|
case 'q':
|
|
--- 71,77 ----
|
|
int i, keycode, length = 0;
|
|
/* PerfmonWidget pw = (PerfmonWidget) w;*/
|
|
|
|
! length = XLookupString((XKeyEvent *)event, strbuf, STRBUFSIZE, (KeySym *)&keycode, NULL);
|
|
switch (keycode) {
|
|
case 'Q':
|
|
case 'q':
|
|
***************
|
|
*** 88,103 ****
|
|
break;
|
|
case 'L':
|
|
case 'l': /* print out a chart of current limit settings */
|
|
! printf("\n%10s %5s %5s %5s %5s\n",
|
|
! "Widget", "Hi ", "Hi ", "Low", "Low ");
|
|
! printf("%10s %5s %5s %5s %5s\n",
|
|
! "Name ", "Warn", "Alarm", "Warn", "Alarm");
|
|
! printf("%10s %5s %5s %5s %5s\n",
|
|
! "------", "-----","-----","-----","-----");
|
|
for ( i=0; i<NUM_GRAPHS; i++ ) {
|
|
if ( perfmon[i] ) {
|
|
PerfChartWidget pw = (PerfChartWidget)perfmon[i];
|
|
! printf("%10s %5d %5d %5d %5d\n",
|
|
widgetLabels[i],
|
|
pw->strip_chart.highWarn,
|
|
pw->strip_chart.highAlarm,
|
|
--- 101,116 ----
|
|
break;
|
|
case 'L':
|
|
case 'l': /* print out a chart of current limit settings */
|
|
! printf("\n%16s %6s %6s %6s %6s\n",
|
|
! " Widget ", " Hi ", " Hi ", " Low", " Low ");
|
|
! printf("%16s %6s %6s %6s %6s\n",
|
|
! " Name ", " Warn", " Alarm", " Warn", " Alarm");
|
|
! printf("%16s %6s %6s %6s %6s\n",
|
|
! "--------", "------","------","------","------");
|
|
for ( i=0; i<NUM_GRAPHS; i++ ) {
|
|
if ( perfmon[i] ) {
|
|
PerfChartWidget pw = (PerfChartWidget)perfmon[i];
|
|
! printf("%16s %6d %6d %6d %6d\n",
|
|
widgetLabels[i],
|
|
pw->strip_chart.highWarn,
|
|
pw->strip_chart.highAlarm,
|
|
***************
|
|
*** 142,148 ****
|
|
adjust_timeout(delta)
|
|
int delta;
|
|
{
|
|
- int i;
|
|
char hostname[132], *c;
|
|
|
|
if ( appData.ms_per_sec == 1 )
|
|
--- 155,160 ----
|
|
***************
|
|
*** 152,158 ****
|
|
appData.interval += delta;
|
|
|
|
XtRemoveTimeOut(appData.interval_id);
|
|
!
|
|
appData.interval_id =
|
|
XtAppAddTimeOut(appData.app_context,
|
|
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
|
|
--- 164,170 ----
|
|
appData.interval += delta;
|
|
|
|
XtRemoveTimeOut(appData.interval_id);
|
|
!
|
|
appData.interval_id =
|
|
XtAppAddTimeOut(appData.app_context,
|
|
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
|
|
***************
|
|
*** 160,166 ****
|
|
|
|
(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);
|
|
XtVaSetValues(labelBox, XtNlabel, hostname, NULL);
|
|
}
|
|
--- 172,178 ----
|
|
|
|
(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);
|
|
XtVaSetValues(labelBox, XtNlabel, hostname, NULL);
|
|
}
|