Update to Version 3.1 this includes several bugfixes:

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.
This commit is contained in:
Lars Koeller 2001-04-10 20:43:11 +00:00
parent 97652512b1
commit f5c1a46665
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=41231
12 changed files with 321 additions and 148 deletions

View file

@ -6,7 +6,7 @@
# #
PORTNAME= xperfmon++ PORTNAME= xperfmon++
PORTVERSION= 3.0 PORTVERSION= 3.1
CATEGORIES= sysutils CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.uni-bielefeld.de/pub/systems/FreeBSD/lkoeller/ \ MASTER_SITES= ftp://ftp.uni-bielefeld.de/pub/systems/FreeBSD/lkoeller/ \
ftp://ftp.u-aizu.ac.jp/pub/misc/tools/xperfmon/ \ ftp://ftp.u-aizu.ac.jp/pub/misc/tools/xperfmon/ \

View file

@ -4,7 +4,7 @@
* *
* Handel the FreeBSD Versions in a central file! * Handel the FreeBSD Versions in a central file!
* *
* $FreeBSD$ * $Id: fbsd_vers.h,v 3.2 2001/04/10 20:02:26 lkoeller Exp lkoeller $
*/ */
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
@ -14,9 +14,9 @@
#if (defined(BSD) && (BSD >= 199506)) #if (defined(BSD) && (BSD >= 199506))
# include <osreldate.h> # include <osreldate.h>
#else #else
# error You can compile this xperfmon++ V3.0 only on FreeBSD-3.X systems. xperfmon++ V1.31 up to V2.0 runs on FreeBSD 2.[12].X system! # error You can compile this xperfmon++ V3.1 only on FreeBSD-3.X/4.X systems. xperfmon++ V1.31 up to V2.0 runs on FreeBSD 2.[12].X system!
#endif #endif
#if __FreeBSD_version < 300000 #if __FreeBSD_version < 300000
# error You can compile this xperfmon++ V3.0 only on FreeBSD-3.X systems. xperfmon++ V1.31 up to V2.0 runs on FreeBSD 2.[12].X system! # error You can compile this xperfmon++ V3.1 only on FreeBSD-3.X/4.X systems. xperfmon++ V1.31 up to V2.0 runs on FreeBSD 2.[12].X system!
#endif #endif

View file

@ -5,7 +5,7 @@
* *
* Work has started on 7th Sep 1998 on Northsea island Föhr. * Work has started on 7th Sep 1998 on Northsea island Föhr.
* *
* $FreeBSD$ * $Id: freebsd_system.c,v 3.8 2001/04/10 19:39:44 lkoeller Exp lkoeller $
*/ */
/* /*
@ -105,7 +105,7 @@
*/ */
#ifndef LINT #ifndef LINT
static char rcsid[] = "$FreeBSD$"; static char rcsid[] = "$Id: freebsd_system.c,v 3.8 2001/04/10 19:39:44 lkoeller Exp lkoeller $";
#endif #endif
#include "fbsd_vers.h" #include "fbsd_vers.h"
@ -121,7 +121,6 @@ static char rcsid[] = "$FreeBSD$";
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/dkstat.h> #include <sys/dkstat.h>
#include <sys/buf.h>
#include <sys/time.h> #include <sys/time.h>
#include <vm/vm.h> #include <vm/vm.h>
#include <net/if.h> #include <net/if.h>
@ -139,6 +138,7 @@ static char rcsid[] = "$FreeBSD$";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <strings.h> #include <strings.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
@ -223,8 +223,7 @@ static int interrupts, old_interrupts;
static struct statinfo cur, last; static struct statinfo cur, last;
static struct devstat_match *matches = NULL; static struct devstat_match *matches = NULL;
static struct device_selection *dev_select = NULL; static struct device_selection *dev_select = NULL;
static devstat_select_mode select_mode; static int num_matches = 0, num_devices = 0, ncpu;
static int num_matches = 0, num_devices = 0;
static int num_selected = 0, num_selections = 0; static int num_selected = 0, num_selections = 0;
static int num_devices_specified = 0, maxshowdevs; static int num_devices_specified = 0, maxshowdevs;
static long generation, select_generation; static long generation, select_generation;
@ -254,23 +253,29 @@ static void get_nfsstat(void);
void void
sys_setup(void) sys_setup(void)
{ {
int size;
get_namelist(getbootfile(), _PATH_MEM); get_namelist(getbootfile(), _PATH_MEM);
/* To make calc of etime independent of number of CPUs */
size = sizeof(ncpu);
if (sysctlbyname("hw.ncpu", &ncpu, &size, NULL, 0) < 0)
ncpu = 1;
/* Initialize all stats, i.e. global variables */
get_cpustat(); get_cpustat();
get_load(); get_load();
get_ttystat(); get_ttystat();
interrupts=0;
get_interrupts(); get_interrupts();
init_diskio(); init_diskio();
get_diskio(); get_diskio();
/*
* To force first scale of 'free swapspace' to 100%, we need this hack!
* Wee use a value < 0 cause it's not a valid value!
*/
current_values[FREE_MEM] = -0.4 * SCALE_HACK;
get_netstat(); get_netstat();
/*
* To force first scale of 'free swapspace' to 100%, we need
* set it the first time by hand!
*/
current_values[FREE_MEM] = 100 * SCALE_HACK;
/* /*
* Check if we have NFS in the kernel * Check if we have NFS in the kernel
*/ */
@ -287,7 +292,7 @@ sys_setup(void)
void void
update_stats(void) update_stats(void)
{ {
static int firsttime = 1; static int firsttime = 1, i = FREE_MEM_INT;
/* /*
* For any stat we need etime, so get it! * For any stat we need etime, so get it!
*/ */
@ -312,15 +317,18 @@ update_stats(void)
current_values[INTERRUPTS] = (interrupts - old_interrupts)/etime * SCALE_HACK; current_values[INTERRUPTS] = (interrupts - old_interrupts)/etime * SCALE_HACK;
} }
/* if (perfmon[FREE_MEM] && !firsttime) {
* The first time called, we want to get 100% /* Calc swapspace only every FREE_MEM_INT intervals */
* for the full scale of the graph! if ( i == FREE_MEM_INT ) {
*/ i = 1;
if (perfmon[FREE_MEM] && !firsttime) current_values[FREE_MEM] = get_swapspace() * SCALE_HACK;
current_values[FREE_MEM] = } else
(current_values[FREE_MEM] < 0 ? 100.0 * SCALE_HACK : get_swapspace() * SCALE_HACK); i++;
else } else {
--firsttime; /* First time called we set freeswap to 100% to have full scale!*/
firsttime--;
current_values[FREE_MEM] = 100 * SCALE_HACK;
}
if (perfmon[DISK_TRANSFERS] || perfmon[DISK_MB] || if (perfmon[DISK_TRANSFERS] || perfmon[DISK_MB] ||
perfmon[TAPE_TRANSFERS] || perfmon[TAPE_MB] || perfmon[TAPE_TRANSFERS] || perfmon[TAPE_MB] ||
@ -341,6 +349,9 @@ update_stats(void)
(packets.input - old_packets.input)/etime * SCALE_HACK; (packets.input - old_packets.input)/etime * SCALE_HACK;
current_values[ OUTPUT_PACKETS] = current_values[ OUTPUT_PACKETS] =
(packets.output - old_packets.output)/etime * SCALE_HACK; (packets.output - old_packets.output)/etime * SCALE_HACK;
/* LK!!! DEBUG
printf("input: %f output: %f\n",current_values[INPUT_PACKETS]/SCALE_HACK,
current_values[ OUTPUT_PACKETS]/SCALE_HACK); */
current_values[COLLISION_PACKETS] = current_values[COLLISION_PACKETS] =
(packets.collisions - old_packets.collisions)/etime * SCALE_HACK; (packets.collisions - old_packets.collisions)/etime * SCALE_HACK;
} }
@ -402,7 +413,7 @@ get_namelist(kernel_name, memory_name)
time(&now); time(&now);
nintv = now - boottime; nintv = now - boottime;
if (nintv <= 0 || nintv > 60*60*24*365*10) if (nintv <= 0 || nintv > 60*60*24*365*10)
errx(1, "Time makes no sense ... namelist must be wrong", NULL); errx(1, "Time makes no sense ... namelist must be wrong");
} }
@ -442,6 +453,7 @@ get_cpustat(void)
etime = 1.0; etime = 1.0;
etime /= (float)hz; etime /= (float)hz;
etime /= ncpu;
/* /*
* scale to percent * scale to percent
@ -461,7 +473,7 @@ get_load(void)
loadavg[0] = 0.0; loadavg[0] = 0.0;
if (getloadavg(loadavg, sizeof(loadavg)/sizeof(loadavg[0])) == -1) { if (getloadavg(loadavg, sizeof(loadavg)/sizeof(loadavg[0])) == -1) {
fprintf(stderr, "xperfmon++: getloadavg() returned no values\n"); fprintf(stderr, "xperfmon++: getloadavg() returned no values\n");
return; return(0.0);
} }
return(loadavg[0]); return(loadavg[0]);
} }
@ -490,12 +502,13 @@ get_interrupts(void)
unsigned long *intrcnt; unsigned long *intrcnt;
int nintr; int nintr;
old_interrupts = interrupts;
nintr = namelist[X_EINTRCNT].n_value - namelist[X_INTRCNT].n_value; nintr = namelist[X_EINTRCNT].n_value - namelist[X_INTRCNT].n_value;
if ((intrcnt = (unsigned long *)malloc((size_t) nintr)) == NULL) if ((intrcnt = (unsigned long *)malloc((size_t) nintr)) == NULL)
err(1, "xperfmon++: malloc failed in get_interrupts()"); err(1, "xperfmon++: malloc failed in get_interrupts()");
nintr /= sizeof(long); nintr /= sizeof(long);
kread(X_INTRCNT, intrcnt, (size_t)nintr*sizeof(long)); kread(X_INTRCNT, intrcnt, (size_t)nintr*sizeof(long));
old_interrupts = interrupts;
for (i = 0, interrupts = 0; i < nintr; i++) for (i = 0, interrupts = 0; i < nintr; i++)
interrupts += *(intrcnt + i); interrupts += *(intrcnt + i);
free(intrcnt); free(intrcnt);
@ -521,7 +534,7 @@ get_nfsstat(void)
size_t size = sizeof(nfsstats); size_t size = sizeof(nfsstats);
if (sysctlbyname("vfs.nfs.nfsstats", &nfsstats, &size, (void *)0, (size_t)0) < 0) { if (sysctlbyname("vfs.nfs.nfsstats", &nfsstats, &size, (void *)0, (size_t)0) < 0) {
#endif #endif
fprintf(stderr, "xperfmon++: get_nfsstat(): Can?%t get NFS statistics with sysctl()\n"); fprintf(stderr, "xperfmon++: get_nfsstat(): Can't get NFS statistics with sysctl()\n");
return; return;
} }
@ -619,7 +632,7 @@ get_swapspace(void)
struct kvm_swap swapary[1]; struct kvm_swap swapary[1];
n = kvm_getswapinfo(kd, swapary, 1, 0); n = kvm_getswapinfo(kd, swapary, 1, 0);
if (n < 0) if (n < 0 || swapary[0].ksw_total == 0)
return(0); return(0);
percentfree = ((((double)swapary[0].ksw_total - percentfree = ((((double)swapary[0].ksw_total -
@ -729,6 +742,7 @@ static void
get_netstat(void) get_netstat(void)
{ {
off_t ifnetaddr; off_t ifnetaddr;
char name[32], tname[16], *interface = '\0';
if ((ifnetaddr = namelist[N_IFNET].n_value) != 0) { if ((ifnetaddr = namelist[N_IFNET].n_value) != 0) {
struct ifnet ifnet; struct ifnet ifnet;
@ -748,9 +762,15 @@ get_netstat(void)
while (ifnetaddr || ifaddraddr) { while (ifnetaddr || ifaddraddr) {
if (ifaddraddr == 0) { if (ifaddraddr == 0) {
ifnetfound = ifnetaddr; ifnetfound = ifnetaddr;
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1) /* Get stats and interface name to select a specific one (TODO) */
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1 ||
kvm_read(kd, (u_long)ifnet.if_name, (char *)tname, 16) == -1)
return; return;
tname[15] = '\0';
ifnetaddr = (u_long)ifnet.if_link.tqe_next; ifnetaddr = (u_long)ifnet.if_link.tqe_next;
snprintf(name, 32, "%s%d", tname, ifnet.if_unit);
if (interface != 0 && (strcmp(name, interface) != 0))
continue;
ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first; ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first;
} }
if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) { if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) {
@ -758,9 +778,9 @@ get_netstat(void)
continue; continue;
} }
ifaddraddr = (u_long)ifa.ifa_link.tqe_next; ifaddraddr = (u_long)ifa.ifa_link.tqe_next;
/* Normalize number of packets, we count interface four timess */
packets.input += ifnet.if_ipackets; packets.input += (ifnet.if_ipackets >> 2);
packets.output += ifnet.if_opackets; packets.output += (ifnet.if_opackets >> 2);
packets.collisions += ifnet.if_collisions; packets.collisions += ifnet.if_collisions;
} }
} }
@ -773,7 +793,7 @@ get_netstat(void)
static void static void
init_diskio(void) init_diskio(void)
{ {
int retval, i; int retval;
cur.dinfo = (struct devinfo *) malloc(sizeof(struct devinfo)); cur.dinfo = (struct devinfo *) malloc(sizeof(struct devinfo));
last.dinfo = (struct devinfo *) malloc(sizeof(struct devinfo)); last.dinfo = (struct devinfo *) malloc(sizeof(struct devinfo));
@ -823,11 +843,10 @@ init_diskio(void)
static void static void
get_diskio(void) get_diskio(void)
{ {
register int i, dn; register int dn;
long double busy_seconds; long double busy_seconds;
long double transfers_per_second, mb_per_second; long double transfers_per_second, mb_per_second;
struct devinfo *tmp_dinfo; struct devinfo *tmp_dinfo;
int retval;
tmp_dinfo = last.dinfo; tmp_dinfo = last.dinfo;
last.dinfo = cur.dinfo; last.dinfo = cur.dinfo;
@ -890,7 +909,8 @@ get_diskio(void)
errx(1, "xperfmon++: %s", devstat_errbuf); errx(1, "xperfmon++: %s", devstat_errbuf);
if (strcmp(cur.dinfo->devices[di].device_name, "da") == 0 || if (strcmp(cur.dinfo->devices[di].device_name, "da") == 0 ||
strcmp(cur.dinfo->devices[di].device_name, "wd") == 0) { strcmp(cur.dinfo->devices[di].device_name, "ad") == 0 ||
strcmp(cur.dinfo->devices[di].device_name, "wd") == 0) {
#ifdef DEBUG #ifdef DEBUG
printf( "da%d: %Lf %Lf\n", cur.dinfo->devices[di].unit_number, transfers_per_second, mb_per_second); printf( "da%d: %Lf %Lf\n", cur.dinfo->devices[di].unit_number, transfers_per_second, mb_per_second);
#endif #endif
@ -904,8 +924,8 @@ get_diskio(void)
diskstat.sa_trsf += transfers_per_second; diskstat.sa_trsf += transfers_per_second;
diskstat.sa_mb += mb_per_second; diskstat.sa_mb += mb_per_second;
} }
if (strcmp(cur.dinfo->devices[di].device_name, "cd") == 0 || if (strcmp(cur.dinfo->devices[di].device_name, "cd") == 0 ||
strcmp(cur.dinfo->devices[di].device_name, "acd") == 0) { strcmp(cur.dinfo->devices[di].device_name, "acd") == 0) {
#ifdef DEBUG #ifdef DEBUG
printf( "cd%d: %Lf %Lf\n", cur.dinfo->devices[di].unit_number, transfers_per_second, mb_per_second); printf( "cd%d: %Lf %Lf\n", cur.dinfo->devices[di].unit_number, transfers_per_second, mb_per_second);
#endif #endif

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994 *** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
--- ./StripChart.c Sun Jan 10 21:14:40 1999 --- ./StripChart.c Tue Apr 10 21:49:59 2001
*************** ***************
*** 1,4 **** *** 1,4 ****
! /* $XConsortium: StripChart.c,v 1.20 91/05/24 17:20:42 converse Exp $ */ ! /* $XConsortium: StripChart.c,v 1.20 91/05/24 17:20:42 converse Exp $ */
@ -11,7 +11,7 @@
! * Enhancement and error correction for FreeBSD-3.X ! * Enhancement and error correction for FreeBSD-3.X
! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de> ! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
! * ! *
! * $Id: StripChart.c,v 3.8 1999/01/10 20:14:30 lkoeller Exp lkoeller $ ! * $Id: StripChart.c,v 3.9 2001/04/10 19:49:34 lkoeller Exp lkoeller $
! */ ! */
/*********************************************************** /***********************************************************
@ -86,7 +86,7 @@
******************************************************************/ ******************************************************************/
+ #ifndef LINT + #ifndef LINT
+ static char rcsid[] = "$Id: StripChart.c,v 3.8 1999/01/10 20:14:30 lkoeller Exp lkoeller $"; + static char rcsid[] = "$Id: StripChart.c,v 3.9 2001/04/10 19:49:34 lkoeller Exp lkoeller $";
+ #endif + #endif
+ +
+ #include "fbsd_vers.h" + #include "fbsd_vers.h"
@ -203,7 +203,11 @@
* going to hold off until then. * going to hold off until then.
*/ */
*************** ***************
*** 295,301 **** *** 291,301 ****
XtIntervalId *id; /* unused */
{
PerfChartWidget w = (PerfChartWidget)client_data;
- XGCValues myXGCV;
double value, checkValue; double value, checkValue;
Display *dpy = XtDisplay(w); Display *dpy = XtDisplay(w);
Window win = XtWindow(w); Window win = XtWindow(w);
@ -211,7 +215,10 @@
/* if (w->strip_chart.update > 0) /* if (w->strip_chart.update > 0)
w->strip_chart.interval_id = w->strip_chart.interval_id =
XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w), XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w),
--- 324,330 ---- --- 320,329 ----
XtIntervalId *id; /* unused */
{
PerfChartWidget w = (PerfChartWidget)client_data;
double value, checkValue; double value, checkValue;
Display *dpy = XtDisplay(w); Display *dpy = XtDisplay(w);
Window win = XtWindow(w); Window win = XtWindow(w);
@ -232,7 +239,7 @@
if (value > w->strip_chart.max_value) { if (value > w->strip_chart.max_value) {
w->strip_chart.max_value = value; w->strip_chart.max_value = value;
if (w->strip_chart.max_value > w->strip_chart.scale) { if (w->strip_chart.max_value > w->strip_chart.scale) {
--- 340,350 ---- --- 339,349 ----
XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value ); XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value );
@ -254,7 +261,7 @@
w->strip_chart.valuedata[w->strip_chart.interval] = value; w->strip_chart.valuedata[w->strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) { if (XtIsRealized((Widget)w)) {
--- 352,359 ---- --- 351,358 ----
w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width); w->strip_chart.interval = repaint_window(w, 0, (int) w->core.width);
} }
} }
@ -325,7 +332,7 @@
w->strip_chart.currentBG = w->strip_chart.okColor; w->strip_chart.currentBG = w->strip_chart.okColor;
} }
} }
--- 361,420 ---- --- 360,419 ----
(int)(w->core.height * value) / w->strip_chart.scale); (int)(w->core.height * value) / w->strip_chart.scale);
/* Check for high warnings and alarms */ /* Check for high warnings and alarms */
@ -409,7 +416,7 @@
if (w->strip_chart.points != NULL) { if (w->strip_chart.points != NULL) {
w->strip_chart.points[0].x = w->strip_chart.interval; w->strip_chart.points[0].x = w->strip_chart.interval;
--- 422,442 ---- --- 421,441 ----
if ( !w->strip_chart.fillRect ) { /* draw line graph */ if ( !w->strip_chart.fillRect ) { /* draw line graph */
int y = (int) (w->core.height - int y = (int) (w->core.height -
@ -432,7 +439,7 @@
if (w->strip_chart.points != NULL) { if (w->strip_chart.points != NULL) {
w->strip_chart.points[0].x = w->strip_chart.interval; w->strip_chart.points[0].x = w->strip_chart.interval;
*************** ***************
*** 434,440 **** *** 434,455 ****
#define XDS(s) XDrawString(XtDisplay(w), XtWindow(w), \ #define XDS(s) XDrawString(XtDisplay(w), XtWindow(w), \
w->strip_chart.hiGC, x, y, s, strlen(s)) w->strip_chart.hiGC, x, y, s, strlen(s))
@ -440,16 +447,13 @@
repaint_window(w, left, width) repaint_window(w, left, width)
PerfChartWidget w; PerfChartWidget w;
int left, width; int left, width;
--- 463,469 ---- {
#define XDS(s) XDrawString(XtDisplay(w), XtWindow(w), \ ! register int i, j;
w->strip_chart.hiGC, x, y, s, strlen(s)) register int next = w->strip_chart.interval;
int scale = w->strip_chart.scale;
! static int int scalewidth = 0;
repaint_window(w, left, width) ! int x, x1, x2, y, y1, y2;
PerfChartWidget w; char numstring[24];
int left, width;
***************
*** 448,455 ****
/* Compute the minimum scale required to graph the data, but don't go /* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */ lower than min_scale. */
@ -458,7 +462,21 @@
if (scale < w->strip_chart.min_scale) if (scale < w->strip_chart.min_scale)
scale = w->strip_chart.min_scale; scale = w->strip_chart.min_scale;
--- 477,486 ---- --- 462,485 ----
#define XDS(s) XDrawString(XtDisplay(w), XtWindow(w), \
w->strip_chart.hiGC, x, y, s, strlen(s))
! static int
repaint_window(w, left, width)
PerfChartWidget w;
int left, width;
{
! register int i;
register int next = w->strip_chart.interval;
int scale = w->strip_chart.scale;
int scalewidth = 0;
! int x, y, y1;
char numstring[24];
/* Compute the minimum scale required to graph the data, but don't go /* Compute the minimum scale required to graph the data, but don't go
lower than min_scale. */ lower than min_scale. */
@ -478,7 +496,7 @@
XClearWindow (XtDisplay (w), XtWindow (w)); XClearWindow (XtDisplay (w), XtWindow (w));
} }
--- 492,498 ---- --- 491,497 ----
SetPoints(w); SetPoints(w);
@ -512,7 +530,7 @@
x = LABEL_ROOM - XTW(numstring); x = LABEL_ROOM - XTW(numstring);
y = w->strip_chart.font_height - 4; y = w->strip_chart.font_height - 4;
XDS(numstring); /* draw max value */ XDS(numstring); /* draw max value */
--- 510,540 ---- --- 509,539 ----
/* draw titles */ /* draw titles */
if ( w->strip_chart.topLabel ) { if ( w->strip_chart.topLabel ) {
@ -561,7 +579,7 @@
else { else {
/* If this is not the left most point, then draw a line /* If this is not the left most point, then draw a line
* connecting this point with the one to its left. * connecting this point with the one to its left.
--- 549,562 ---- --- 548,561 ----
if ( i == left && left + 1 == width && width != next ) { if ( i == left && left + 1 == width && width != next ) {
y1 = (int) (w->core.height - y1 = (int) (w->core.height -
@ -585,7 +603,7 @@
i, /* x */ i, /* x */
y, /* y */ y, /* y */
(unsigned int) 1, /* width */ (unsigned int) 1, /* width */
--- 573,579 ---- --- 572,578 ----
int y = (int) (w->core.height - int y = (int) (w->core.height -
(int)(w->core.height * w->strip_chart.valuedata[i]) / (int)(w->core.height * w->strip_chart.valuedata[i]) /
w->strip_chart.scale); w->strip_chart.scale);
@ -602,7 +620,7 @@
for (i = 1; i < w->strip_chart.scale; i++) { for (i = 1; i < w->strip_chart.scale; i++) {
j = i * ((int)w->core.height / w->strip_chart.scale); j = i * ((int)w->core.height / w->strip_chart.scale);
XDrawLine(dpy, win, w->strip_chart.hiGC, left , j, scalewidth, j); XDrawLine(dpy, win, w->strip_chart.hiGC, left , j, scalewidth, j);
--- 582,588 ---- --- 581,587 ----
} }
@ -611,6 +629,25 @@
j = i * ((int)w->core.height / w->strip_chart.scale); j = i * ((int)w->core.height / w->strip_chart.scale);
XDrawLine(dpy, win, w->strip_chart.hiGC, left , j, scalewidth, j); XDrawLine(dpy, win, w->strip_chart.hiGC, left , j, scalewidth, j);
*************** ***************
*** 566,573 ****
PerfChartWidget w;
Boolean blit;
{
! double old_max, old_min;
! int left, i, j;
register int next = w->strip_chart.interval;
if (!XtIsRealized((Widget) w)) return;
--- 602,609 ----
PerfChartWidget w;
Boolean blit;
{
! double old_max;
! int i, j;
register int next = w->strip_chart.interval;
if (!XtIsRealized((Widget) w)) return;
***************
*** 582,598 **** *** 582,598 ****
bcopy((char *)(w->strip_chart.valuedata + next - j), bcopy((char *)(w->strip_chart.valuedata + next - j),
(char *)(w->strip_chart.valuedata), j * sizeof(double)); (char *)(w->strip_chart.valuedata), j * sizeof(double));
@ -629,7 +666,7 @@
w->strip_chart.max_value = w->strip_chart.valuedata[i]; w->strip_chart.max_value = w->strip_chart.valuedata[i];
if ( w->strip_chart.valuedata[i] < w->strip_chart.min_value ) if ( w->strip_chart.valuedata[i] < w->strip_chart.min_value )
w->strip_chart.min_value = w->strip_chart.valuedata[i]; w->strip_chart.min_value = w->strip_chart.valuedata[i];
--- 619,645 ---- --- 618,644 ----
bcopy((char *)(w->strip_chart.valuedata + next - j), bcopy((char *)(w->strip_chart.valuedata + next - j),
(char *)(w->strip_chart.valuedata), j * sizeof(double)); (char *)(w->strip_chart.valuedata), j * sizeof(double));
next = w->strip_chart.interval = j; next = w->strip_chart.interval = j;
@ -671,7 +708,7 @@
left = j; left = j;
for (i = 1; i < w->strip_chart.scale; i++) { for (i = 1; i < w->strip_chart.scale; i++) {
j = i * ((int)w->core.height / w->strip_chart.scale); j = i * ((int)w->core.height / w->strip_chart.scale);
--- 658,669 ---- --- 657,668 ----
(unsigned int) j-LABEL_ROOM, (unsigned int) w->core.height, (unsigned int) j-LABEL_ROOM, (unsigned int) w->core.height,
LABEL_ROOM, 0); LABEL_ROOM, 0);
@ -705,7 +742,7 @@
DestroyGC(old, new_gc); DestroyGC(old, new_gc);
CreateGC(w, new_gc); CreateGC(w, new_gc);
--- 692,714 ---- --- 691,713 ----
draw_graph, (XtPointer)w); draw_graph, (XtPointer)w);
} }
*/ */
@ -747,7 +784,7 @@
points[i - 1].y = HEIGHT / w->strip_chart.scale; points[i - 1].y = HEIGHT / w->strip_chart.scale;
} }
} }
--- 737,753 ---- --- 736,752 ----
w->strip_chart.points = NULL; w->strip_chart.points = NULL;
return; return;
} }

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994 *** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
--- ./misc.c Sun Jan 10 21:14:22 1999 --- ./misc.c Tue Apr 10 21:48:00 2001
*************** ***************
*** 1,10 **** *** 1,10 ****
/* Copyright 1994, Roger Smith for Sterling Software and NASA-Ames Research Center /* Copyright 1994, Roger Smith for Sterling Software and NASA-Ames Research Center
@ -17,7 +17,7 @@
+ * Enhancement and error correction for FreeBSD-3.X + * Enhancement and error correction for FreeBSD-3.X
+ * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de> + * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
+ * + *
+ * $Id: misc.c,v 3.3 1999/01/10 20:13:27 lkoeller Exp lkoeller $ + * $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 /* Copyright 1994, Roger Smith for Sterling Software and NASA-Ames Research Center
@ -58,7 +58,7 @@
*/ */
+ +
+ #ifndef LINT + #ifndef LINT
+ static char rcsid[] = "$Id: misc.c,v 3.3 1999/01/10 20:13:27 lkoeller Exp lkoeller $"; + static char rcsid[] = "$Id: misc.c,v 3.4 2001/04/10 19:47:38 lkoeller Exp lkoeller $";
+ #endif + #endif
+ +
+ #include "fbsd_vers.h" + #include "fbsd_vers.h"
@ -135,6 +135,16 @@
pw->strip_chart.highWarn, pw->strip_chart.highWarn,
pw->strip_chart.highAlarm, 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 **** *** 152,158 ****
appData.interval += delta; appData.interval += delta;
@ -143,7 +153,7 @@
appData.interval_id = appData.interval_id =
XtAppAddTimeOut(appData.app_context, XtAppAddTimeOut(appData.app_context,
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel); appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
--- 165,171 ---- --- 164,170 ----
appData.interval += delta; appData.interval += delta;
XtRemoveTimeOut(appData.interval_id); XtRemoveTimeOut(appData.interval_id);
@ -160,7 +170,7 @@
(float)(appData.interval*appData.ms_per_sec)/1000.0); (float)(appData.interval*appData.ms_per_sec)/1000.0);
XtVaSetValues(labelBox, XtNlabel, hostname, NULL); XtVaSetValues(labelBox, XtNlabel, hostname, NULL);
} }
--- 173,179 ---- --- 172,178 ----
(void)gethostname(hostname, sizeof(hostname)); (void)gethostname(hostname, sizeof(hostname));
c = (char *) ((long) &hostname[0] + (int) strlen(hostname)); c = (char *) ((long) &hostname[0] + (int) strlen(hostname));

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994 *** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
--- ./xperfmon.c Tue Jan 26 22:17:32 1999 --- ./xperfmon.c Tue Apr 10 22:01:25 2001
*************** ***************
*** 1,6 **** *** 1,6 ****
/* /*
@ -13,7 +13,7 @@
! * Enhancement and error correction for FreeBSD-3.X ! * Enhancement and error correction for FreeBSD-3.X
! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de> ! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
! * ! *
! * $Id: xperfmon.c,v 3.5 1999/01/10 17:04:06 lkoeller Exp lkoeller $ ! * $Id: xperfmon.c,v 3.7 2001/04/10 20:01:01 lkoeller Exp lkoeller $
! */ ! */
! !
! /* ! /*
@ -78,7 +78,7 @@
*/ */
+ #ifndef LINT + #ifndef LINT
+ static char rcsid[] = "$Id: xperfmon.c,v 3.5 1999/01/10 17:04:06 lkoeller Exp lkoeller $"; + static char rcsid[] = "$Id: xperfmon.c,v 3.7 2001/04/10 20:01:01 lkoeller Exp lkoeller $";
+ #endif + #endif
+ +
+ #include "fbsd_vers.h" + #include "fbsd_vers.h"
@ -103,12 +103,11 @@
double testValue; double testValue;
*************** ***************
*** 94,99 **** *** 94,99 ****
--- 110,122 ---- --- 110,121 ----
{ NULL, NULL }, { NULL, NULL },
}; };
+ /* LK!!! */ + /* LK!!! */
+ char *info1 = "da1";
+ int MIN_HEIGHT=78; + int MIN_HEIGHT=78;
+ #define MIN_WIDTH 185 + #define MIN_WIDTH 185
+ #define ADD_TO_TIMEH (11+(int)(appData.numGraphsOn*0.2)) + #define ADD_TO_TIMEH (11+(int)(appData.numGraphsOn*0.2))
@ -118,7 +117,7 @@
#define XtNcount "count" #define XtNcount "count"
#define XtCCount "Count" #define XtCCount "Count"
*************** ***************
*** 101,156 **** *** 101,164 ****
#define XtCFill "Fill" #define XtCFill "Fill"
#define XtNfast "fast" #define XtNfast "fast"
#define XtCFast "Fast" #define XtCFast "Fast"
@ -175,7 +174,15 @@
#define DEF_INTERVAL 1 #define DEF_INTERVAL 1
#define DEF_COUNT -1 #define DEF_COUNT -1
--- 124,280 ---- #define MS_PER_SEC 1000
#define SLOWEST_INTERVAL 100
- static int defaultInterval = DEF_INTERVAL;
- static int defaultCount = DEF_COUNT;
Widget perfmon[NUM_GRAPHS], timechart, labelBox;
AppData appData;
--- 123,285 ----
#define XtCFill "Fill" #define XtCFill "Fill"
#define XtNfast "fast" #define XtNfast "fast"
#define XtCFast "Fast" #define XtCFast "Fast"
@ -333,6 +340,12 @@
#define DEF_INTERVAL 1 #define DEF_INTERVAL 1
#define DEF_COUNT -1 #define DEF_COUNT -1
#define MS_PER_SEC 1000
#define SLOWEST_INTERVAL 100
Widget perfmon[NUM_GRAPHS], timechart, labelBox;
AppData appData;
*************** ***************
*** 171,207 **** *** 171,207 ****
static XrmOptionDescRec optionDescList[] = { static XrmOptionDescRec optionDescList[] = {
@ -372,7 +385,7 @@
{ "-lowinputAlarm", "*perfChartInput.lowAlarm", XrmoptionSepArg, NULL }, { "-lowinputAlarm", "*perfChartInput.lowAlarm", XrmoptionSepArg, NULL },
{ "-lowinputWarn", "*perfChartInput.lowWarn", XrmoptionSepArg, NULL }, { "-lowinputWarn", "*perfChartInput.lowWarn", XrmoptionSepArg, NULL },
{ "-highinputAlarm", "*perfChartInput.highAlarm", XrmoptionSepArg, NULL }, { "-highinputAlarm", "*perfChartInput.highAlarm", XrmoptionSepArg, NULL },
--- 295,392 ---- --- 292,389 ----
static XrmOptionDescRec optionDescList[] = { static XrmOptionDescRec optionDescList[] = {
{ "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL}, { "-interval", ".interval", XrmoptionSepArg, (caddr_t) NULL},
{ "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" }, { "-immediate", "*PerfChart.immediate", XrmoptionNoArg, "True" },
@ -473,7 +486,7 @@
{ "-highinputAlarm", "*perfChartInput.highAlarm", XrmoptionSepArg, NULL }, { "-highinputAlarm", "*perfChartInput.highAlarm", XrmoptionSepArg, NULL },
*************** ***************
*** 217,222 **** *** 217,222 ****
--- 402,438 ---- --- 399,435 ----
{ "-highcollisionAlarm", "*perfChartCollision.highAlarm", XrmoptionSepArg, NULL }, { "-highcollisionAlarm", "*perfChartCollision.highAlarm", XrmoptionSepArg, NULL },
{ "-highcollisionWarn", "*perfChartCollision.highWarn", XrmoptionSepArg, NULL }, { "-highcollisionWarn", "*perfChartCollision.highWarn", XrmoptionSepArg, NULL },
@ -557,7 +570,7 @@
{ XtNinterval, XtCInterval, XtRInt, sizeof(int), { XtNinterval, XtCInterval, XtRInt, sizeof(int),
XtOffsetOf(AppData, interval), XtRImmediate, (caddr_t) DEF_INTERVAL }, XtOffsetOf(AppData, interval), XtRImmediate, (caddr_t) DEF_INTERVAL },
{ XtNcount, XtCCount, XtRInt, sizeof(int), { XtNcount, XtCCount, XtRInt, sizeof(int),
--- 442,543 ---- --- 439,540 ----
{ "-lownfsserverWarn", "*perfChartNFSServer.lowWarn", XrmoptionSepArg, NULL }, { "-lownfsserverWarn", "*perfChartNFSServer.lowWarn", XrmoptionSepArg, NULL },
{ "-highnfsserverAlarm", "*perfChartNFSServer.highAlarm", XrmoptionSepArg, NULL }, { "-highnfsserverAlarm", "*perfChartNFSServer.highAlarm", XrmoptionSepArg, NULL },
{ "-highnfsserverWarn", "*perfChartNFSServer.highWarn", XrmoptionSepArg, NULL }, { "-highnfsserverWarn", "*perfChartNFSServer.highWarn", XrmoptionSepArg, NULL },
@ -705,7 +718,7 @@
{ XtNnfsclientAdd, XtCNfsclientAdd, XtRBool, sizeof(Bool), { XtNnfsclientAdd, XtCNfsclientAdd, XtRBool, sizeof(Bool),
XtOffsetOf(AppData, addG[NFS_CLT]), XtRImmediate, (XtPointer) NULL }, XtOffsetOf(AppData, addG[NFS_CLT]), XtRImmediate, (XtPointer) NULL },
{ XtNnfsclientSub, XtCNfsclientSub, XtRBool, sizeof(Bool), { XtNnfsclientSub, XtCNfsclientSub, XtRBool, sizeof(Bool),
--- 548,684 ---- --- 545,681 ----
XtOffsetOf(AppData, debug), XtRImmediate, (caddr_t)NULL }, XtOffsetOf(AppData, debug), XtRImmediate, (caddr_t)NULL },
{ XtNfast, XtCFast, XtRBoolean, sizeof(Boolean), { XtNfast, XtCFast, XtRBoolean, sizeof(Boolean),
XtOffsetOf(AppData, fast), XtRImmediate, (XtPointer) NULL }, XtOffsetOf(AppData, fast), XtRImmediate, (XtPointer) NULL },
@ -857,7 +870,7 @@
fprintf(stderr, "\nusage: xperfmon++ option option option .....\n"); fprintf(stderr, "\nusage: xperfmon++ option option option .....\n");
fprintf(stderr, "options:\n"); fprintf(stderr, "options:\n");
fprintf(stderr, " [-display [{host}]:[{vs}]]\n"); fprintf(stderr, " [-display [{host}]:[{vs}]]\n");
--- 686,701 ---- --- 683,698 ----
{ XtNnfsserverAdd, XtCNfsserverAdd, XtRBool, sizeof(Bool), { XtNnfsserverAdd, XtCNfsserverAdd, XtRBool, sizeof(Bool),
XtOffsetOf(AppData, addG[NFS_SRV]), XtRImmediate, (XtPointer) NULL }, XtOffsetOf(AppData, addG[NFS_SRV]), XtRImmediate, (XtPointer) NULL },
{ XtNnfsserverSub, XtCNfsserverSub, XtRBool, sizeof(Bool), { XtNnfsserverSub, XtCNfsserverSub, XtRBool, sizeof(Bool),
@ -869,7 +882,7 @@
usage() usage()
{ {
+ #if __FreeBSD_version >= 300000 + #if __FreeBSD_version >= 300000
+ fprintf(stderr, "\nxperfmon++ V3.0 for FreeBSD-3.X\n"); + fprintf(stderr, "\nxperfmon++ V3.1 for FreeBSD-3.X/4.X\n");
+ #endif + #endif
fprintf(stderr, "\nusage: xperfmon++ option option option .....\n"); fprintf(stderr, "\nusage: xperfmon++ option option option .....\n");
fprintf(stderr, "options:\n"); fprintf(stderr, "options:\n");
@ -894,7 +907,7 @@
fprintf(stderr, "NOTE: The default is ALL graphs! A \"-\" option takes away from the default list.\n"); fprintf(stderr, "NOTE: The default is ALL graphs! A \"-\" option takes away from the default list.\n");
fprintf(stderr, " Any \"+\" option resets the default list to empty and then adds the option.\n\n"); fprintf(stderr, " Any \"+\" option resets the default list to empty and then adds the option.\n\n");
fprintf(stderr, "ALARMS:\n"); fprintf(stderr, "ALARMS:\n");
--- 712,761 ---- --- 709,758 ----
fprintf(stderr, " [-fast] (changes interval from seconds to milliseconds)\n"); fprintf(stderr, " [-fast] (changes interval from seconds to milliseconds)\n");
fprintf(stderr, " [-immediate] (background limit alarm color is based on current sample)\n"); fprintf(stderr, " [-immediate] (background limit alarm color is based on current sample)\n");
fprintf(stderr, " [-fill] (output filled graph instead of line graph)\n\n"); fprintf(stderr, " [-fill] (output filled graph instead of line graph)\n\n");
@ -957,7 +970,7 @@
fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n"); fprintf(stderr, "WARNING: It is an error condition to set both a high, and a low, limit warning or alarm.\n");
exit(1); exit(1);
} }
--- 765,785 ---- --- 762,782 ----
fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n"); fprintf(stderr, " [-high*Alarm {value}] ( Set High Alarm value for *)\n");
fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n"); fprintf(stderr, " [-high*Warn {value}] ( Set High Warning value for *)\n");
fprintf(stderr, " Where \"*\" is one of the following:\n"); fprintf(stderr, " Where \"*\" is one of the following:\n");
@ -981,7 +994,7 @@
} }
*************** ***************
*** 386,391 **** *** 386,391 ****
--- 801,807 ---- --- 798,804 ----
time(&timeStamp); time(&timeStamp);
return; return;
} }
@ -998,12 +1011,12 @@
char eventString[60]; char eventString[60];
switch (event->type) { switch (event->type) {
case Expose: case Expose:
--- 810,817 ---- --- 807,814 ----
Boolean *contin2disp; Boolean *contin2disp;
{ {
Dimension neww, newh; Dimension neww, newh;
! Dimension hOverHead, boxH, timeH, newWidgetH; ! Dimension hOverHead, boxH, timeH, newWidgetH;
! int i, window_size_changed; ! int i, window_size_changed=FALSE;
char eventString[60]; char eventString[60];
switch (event->type) { switch (event->type) {
case Expose: case Expose:
@ -1022,7 +1035,7 @@
strcpy(eventString,"reparent"); strcpy(eventString,"reparent");
break; break;
case ConfigureNotify: case ConfigureNotify:
--- 820,837 ---- --- 817,834 ----
strcpy(eventString,"expose"); strcpy(eventString,"expose");
break; break;
case MapNotify: case MapNotify:
@ -1056,10 +1069,15 @@
if ( appData.debug ) if ( appData.debug )
printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n", printf("Resize Request: type=%d %s, oldw=%hu, oldh=%hu, neww=%hu, newh=%hu\n",
(int)event->type, eventString, (int)event->type, eventString,
--- 839,872 ---- --- 836,874 ----
newh=event->xconfigure.height; newh=event->xconfigure.height;
strcpy(eventString,"configure"); strcpy(eventString,"configure");
break; break;
+ default:
+ neww=MIN_WIDTH;
+ newh=w->core.height;
+ window_size_changed = TRUE;
+ break;
+ } + }
+ if ( neww < MIN_WIDTH ) { + if ( neww < MIN_WIDTH ) {
@ -1104,7 +1122,7 @@
if ( oldWidth == neww && oldHeight == newh ) return; if ( oldWidth == neww && oldHeight == newh ) return;
if ( appData.debug ) if ( appData.debug )
--- 874,880 ---- --- 876,882 ----
neww, newh); neww, newh);
if ( event->type == ConfigureNotify ) { if ( event->type == ConfigureNotify ) {
@ -1132,7 +1150,7 @@
char *progname = argv[0]; char *progname = argv[0];
Bool foundAnAdd = FALSE; Bool foundAnAdd = FALSE;
--- 894,917 ---- --- 896,918 ----
XFlush(XtDisplay(w)); XFlush(XtDisplay(w));
} }
@ -1149,7 +1167,6 @@
+ /* LK!!! */ + /* LK!!! */
+ Dimension timeH, newWidgetW, newWidgetH, hOverHead, boxH; + Dimension timeH, newWidgetW, newWidgetH, hOverHead, boxH;
+ unsigned int w, h; + unsigned int w, h;
+ static char *da_str[] = {"da1 da2"};
+ +
Arg arg; Arg arg;
Pixmap icon_pixmap = None; Pixmap icon_pixmap = None;
@ -1169,14 +1186,10 @@
if (argc != 1) usage(); if (argc != 1) usage();
if ( appData.toplevel->core.depth == 1 ) if ( appData.toplevel->core.depth == 1 )
--- 919,936 ---- --- 920,933 ----
int i; int i;
gprogname = progname; gprogname = progname;
!
! /* topNames[DA_MB] = da_str[0]; LK!!! */
!
!
! appData.toplevel = XtVaAppInitialize(&appData.app_context, "XPerfmon++", ! appData.toplevel = XtVaAppInitialize(&appData.app_context, "XPerfmon++",
! optionDescList, XtNumber(optionDescList), ! optionDescList, XtNumber(optionDescList),
&argc, argv, &argc, argv,
@ -1189,8 +1202,21 @@
if ( appData.toplevel->core.depth == 1 ) if ( appData.toplevel->core.depth == 1 )
*************** ***************
*** 488,493 **** *** 488,500 ****
--- 941,949 ---- XtGetApplicationResources(appData.toplevel, &appData, resources,
XtNumber(resources), NULL, 0 );
/*check resources to make sure they are in range */
if ( (int)appData.fast ) {
short uid = getuid();
short euid = geteuid();
if ( appData.debug ) fprintf(stderr, "uid = %hd, euid = %hd\n", uid, euid);
! if ( uid != 0 & euid != 0 ) {
fprintf(stderr, "xperfmon++: ERROR: Must be root to use \"-fast\"\n");
exit();
}
--- 938,953 ----
XtGetApplicationResources(appData.toplevel, &appData, resources, XtGetApplicationResources(appData.toplevel, &appData, resources,
XtNumber(resources), NULL, 0 ); XtNumber(resources), NULL, 0 );
@ -1200,6 +1226,13 @@
/*check resources to make sure they are in range */ /*check resources to make sure they are in range */
if ( (int)appData.fast ) { if ( (int)appData.fast ) {
short uid = getuid();
short euid = geteuid();
if ( appData.debug ) fprintf(stderr, "uid = %hd, euid = %hd\n", uid, euid);
! if ( (uid != 0) & (euid != 0) ) {
fprintf(stderr, "xperfmon++: ERROR: Must be root to use \"-fast\"\n");
exit();
}
*************** ***************
*** 512,518 **** *** 512,518 ****
@ -1209,7 +1242,7 @@
if ( appData.addG[i] ) { if ( appData.addG[i] ) {
foundAnAdd = appData.graphOn[i] = TRUE; foundAnAdd = appData.graphOn[i] = TRUE;
appData.numGraphsOn++; appData.numGraphsOn++;
--- 968,974 ---- --- 965,971 ----
/* build graphOn table */ /* build graphOn table */
@ -1226,7 +1259,7 @@
appData.graphOn[i] = FALSE; appData.graphOn[i] = FALSE;
else else
appData.numGraphsOn++; appData.numGraphsOn++;
--- 976,982 ---- --- 973,979 ----
if ( !foundAnAdd ) { if ( !foundAnAdd ) {
for ( i=0; i<NUM_GRAPHS; i++ ) { for ( i=0; i<NUM_GRAPHS; i++ ) {
appData.graphOn[i] = TRUE; appData.graphOn[i] = TRUE;
@ -1258,7 +1291,7 @@
XtNjustify, XtJustifyLeft, XtNjustify, XtJustifyLeft,
XtNinternalHeight, 0, XtNinternalHeight, 0,
XtNtop, XtChainTop, XtNtop, XtChainTop,
--- 996,1047 ---- --- 993,1044 ----
xperfmon_width, xperfmon_height)); xperfmon_width, xperfmon_height));
XtSetValues(appData.toplevel, &arg, 1); XtSetValues(appData.toplevel, &arg, 1);
} }
@ -1275,8 +1308,8 @@
+ { /* LK!!! handle -geometry option correct, also small changes in handleResize */ + { /* LK!!! handle -geometry option correct, also small changes in handleResize */
+ Window rwin; + Window rwin;
+ int x,y,px,py; + int x,y;
+ unsigned int pw,ph,bw,d; + unsigned int bw,d;
+ +
+ XtRealizeWidget(appData.toplevel); + XtRealizeWidget(appData.toplevel);
+ +
@ -1295,7 +1328,7 @@
+ boxH = 22; + boxH = 22;
+ timeH = 12; + timeH = 12;
+ if (h > GRAPH_MIN_HEIGHT * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+ADD_TO_TIMEH)) + if (h > GRAPH_MIN_HEIGHT * appData.numGraphsOn + hOverHead + (boxH+7) + (timeH+ADD_TO_TIMEH))
+ newWidgetH = (h - hOverHead - (boxH+7) - (timeH+ADD_TO_TIMEH) ) / appData.numGraphsOn; + newWidgetH = (h - hOverHead - (boxH+7) - (timeH+ADD_TO_TIMEH)) / appData.numGraphsOn;
+ else + else
+ newWidgetH = GRAPH_MIN_HEIGHT; + newWidgetH = GRAPH_MIN_HEIGHT;
+ +
@ -1347,7 +1380,7 @@
- XtRealizeWidget(appData.toplevel); - XtRealizeWidget(appData.toplevel);
XtAppMainLoop(appData.app_context); XtAppMainLoop(appData.app_context);
} }
--- 1053,1086 ---- --- 1050,1085 ----
for ( i=0; i<NUM_GRAPHS; i++ ) { for ( i=0; i<NUM_GRAPHS; i++ ) {
if ( appData.graphOn[i] ) { if ( appData.graphOn[i] ) {
sprintf(hostname, "perfChart%s", widgetLabels[i]); sprintf(hostname, "perfChart%s", widgetLabels[i]);
@ -1381,4 +1414,6 @@
appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel); appData.interval*appData.ms_per_sec, start_graphs, (caddr_t) appData.toplevel);
XtAppMainLoop(appData.app_context); XtAppMainLoop(appData.app_context);
+
+ exit(0);
} }

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994 *** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994
--- ./TimeChart.c Sun Jan 10 18:08:06 1999 --- ./TimeChart.c Tue Apr 10 21:50:32 2001
*************** ***************
*** 1,4 **** *** 1,4 ****
! /* $XConsortium: TimeChart.c,v 1.20 91/05/24 17:20:42 converse Exp $ */ ! /* $XConsortium: TimeChart.c,v 1.20 91/05/24 17:20:42 converse Exp $ */
@ -11,7 +11,7 @@
! * Enhancement and error correction for FreeBSD-3.X ! * Enhancement and error correction for FreeBSD-3.X
! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de> ! * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
! * ! *
! * $Id: TimeChart.c,v 1.4 1999/01/10 17:07:57 lkoeller Exp lkoeller $ ! * $Id: TimeChart.c,v 1.5 2001/04/10 19:50:19 lkoeller Exp lkoeller $
! */ ! */
/*********************************************************** /***********************************************************
@ -86,7 +86,7 @@
******************************************************************/ ******************************************************************/
+ #ifndef LINT + #ifndef LINT
+ static char rcsid[] = "$Id: TimeChart.c,v 1.4 1999/01/10 17:07:57 lkoeller Exp lkoeller $"; + static char rcsid[] = "$Id: TimeChart.c,v 1.5 2001/04/10 19:50:19 lkoeller Exp lkoeller $";
+ #endif + #endif
+ +
#include <stdio.h> #include <stdio.h>
@ -169,6 +169,43 @@
(void) repaint_window ((TimeChartWidget)w, event->xgraphicsexpose.x, (void) repaint_window ((TimeChartWidget)w, event->xgraphicsexpose.x,
event->xgraphicsexpose.width); 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 **** *** 364,388 ****
SetPoints(w); SetPoints(w);
@ -185,7 +222,7 @@
! !
if (XtIsRealized((Widget)w)) { if (XtIsRealized((Widget)w)) {
Display *dpy = XtDisplay(w); Display *dpy = XtDisplay(w);
Window win = XtWindow(w); ! Window win = XtWindow(w);
! !
width += left - 1; width += left - 1;
if (!scalewidth) scalewidth = width; if (!scalewidth) scalewidth = width;
@ -195,7 +232,7 @@
w->time_chart.next_x = 0; w->time_chart.next_x = 0;
w->time_chart.last_end = 0; w->time_chart.last_end = 0;
w->time_chart.num_timestamps = 0; w->time_chart.num_timestamps = 0;
--- 369,393 ---- --- 368,391 ----
SetPoints(w); SetPoints(w);
@ -211,7 +248,6 @@
! !
if (XtIsRealized((Widget)w)) { if (XtIsRealized((Widget)w)) {
Display *dpy = XtDisplay(w); Display *dpy = XtDisplay(w);
Window win = XtWindow(w);
! !
width += left - 1; width += left - 1;
if (!scalewidth) scalewidth = width; if (!scalewidth) scalewidth = width;
@ -230,7 +266,7 @@
w->time_chart.interval = oldInterval; w->time_chart.interval = oldInterval;
} }
return(next); return(next);
--- 430,436 ---- --- 428,434 ----
} }
} }
} }
@ -239,6 +275,24 @@
} }
return(next); 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 **** *** 461,474 ****
next = w->time_chart.interval = j; next = w->time_chart.interval = j;
@ -254,7 +308,7 @@
(unsigned int) w->core.width - j, (unsigned int)w->core.height, (unsigned int) w->core.width - j, (unsigned int)w->core.height,
FALSE); FALSE);
--- 466,479 ---- --- 463,476 ----
next = w->time_chart.interval = j; next = w->time_chart.interval = j;
XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w), XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w),
@ -281,7 +335,7 @@
LABEL_ROOM, (unsigned int)w->core.height, LABEL_ROOM, (unsigned int)w->core.height,
FALSE); FALSE);
for ( j=1; j < w->time_chart.num_timestamps; j++ ) { for ( j=1; j < w->time_chart.num_timestamps; j++ ) {
--- 485,494 ---- --- 482,491 ----
if ( j > 31 ) break; if ( j > 31 ) break;
w->time_chart.timestamp_end[j]--; w->time_chart.timestamp_end[j]--;
} }
@ -301,7 +355,7 @@
return; return;
} }
--- 496,502 ---- --- 493,499 ----
} }
w->time_chart.num_timestamps--; w->time_chart.num_timestamps--;
} }
@ -328,7 +382,7 @@
DestroyGC(old, new_gc); DestroyGC(old, new_gc);
CreateGC(w, new_gc); CreateGC(w, new_gc);
--- 521,537 ---- --- 518,534 ----
*/ */
if ( w->time_chart.min_scale > (int) ((w->time_chart.max_value) + 1) ) if ( w->time_chart.min_scale > (int) ((w->time_chart.max_value) + 1) )
ret_val = TRUE; ret_val = TRUE;
@ -355,7 +409,7 @@
size = sizeof(XPoint) * (w->time_chart.scale - 1); size = sizeof(XPoint) * (w->time_chart.scale - 1);
points = (XPoint *) XtRealloc( (XtPointer) w->time_chart.points, size); points = (XPoint *) XtRealloc( (XtPointer) w->time_chart.points, size);
--- 559,565 ---- --- 556,562 ----
w->time_chart.points = NULL; w->time_chart.points = NULL;
return; return;
} }

View file

@ -111,5 +111,4 @@
#define XtNvmunix "vmunix" #define XtNvmunix "vmunix"
! !
typedef struct _TimeChartRec *TimeChartWidget; typedef struct _TimeChartRec *TimeChartWidget;
typedef struct _TimeChartClassRec *TimeChartWidgetClass; typedef struct _TimeChartClassRec *TimeChartWidgetClass;

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994 *** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
--- ./system.h Sun Jan 10 18:08:49 1999 --- ./system.h Tue Apr 10 21:49:11 2001
*************** ***************
*** 1,4 **** *** 1,4 ****
--- 1,11 ---- --- 1,11 ----
@ -7,7 +7,7 @@
+ * Enhancement and error correction for FreeBSD-3.X + * Enhancement and error correction for FreeBSD-3.X
+ * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de> + * COPYRIGHT 1998 by Lars Köller <Lars.Koeller@Uni-Bielefeld.de>
+ * + *
+ * $Id: system.h,v 3.4 1999/01/10 17:08:28 lkoeller Exp lkoeller $ + * $Id: system.h,v 3.5 2001/04/10 19:48:22 lkoeller Exp lkoeller $
+ */ + */
+ +
+ /* + /*
@ -74,10 +74,13 @@
#define MAX_STATS NUM_POSSIBLE_STATS + 1 #define MAX_STATS NUM_POSSIBLE_STATS + 1
#define LINES_PER_LABEL 2 #define LINES_PER_LABEL 2
--- 62,72 ---- --- 62,75 ----
/* This file information needed by both system.c and Perfmon.c */ /* This file information needed by both system.c and Perfmon.c */
! #include <time.h>
! #include <unistd.h>
!
! #if __FreeBSD_version >= 300000 ! #if __FreeBSD_version >= 300000
! # define NUM_POSSIBLE_STATS 25 ! # define NUM_POSSIBLE_STATS 25
! #else ! #else
@ -105,7 +108,7 @@
struct statistic { struct statistic {
int min_val, max_val; int min_val, max_val;
--- 88,132 ---- --- 91,137 ----
for (stat = 0; stat < num_stats; stat++) for (stat = 0; stat < num_stats; stat++)
#define NO_STAT -1 #define NO_STAT -1
@ -120,6 +123,8 @@
! #define TTY_CHARS_OUT 7 ! #define TTY_CHARS_OUT 7
! #define INTERRUPTS 8 ! #define INTERRUPTS 8
! #define FREE_MEM 9 ! #define FREE_MEM 9
! /* Refresh swap only every FREE_MEM_INT intervals */
! #define FREE_MEM_INT 10
! #define DISK_TRANSFERS 10 ! #define DISK_TRANSFERS 10
! #define DISK_MB 11 ! #define DISK_MB 11
! #define TAPE_TRANSFERS 12 ! #define TAPE_TRANSFERS 12
@ -153,7 +158,7 @@
int min_val, max_val; int min_val, max_val;
*************** ***************
*** 113,118 **** *** 113,118 ****
--- 152,197 ---- --- 157,202 ----
#define VALID_UPDATE(x) ((x <= MAX_TIME) && (x > 0)) #define VALID_UPDATE(x) ((x <= MAX_TIME) && (x > 0))
@ -202,7 +207,7 @@
#define IDL_CPU 2 #define IDL_CPU 2
*************** ***************
*** 125,130 **** *** 125,130 ****
--- 204,210 ---- --- 209,215 ----
#define NFS_CLT 9 #define NFS_CLT 9
#define NFS_SRV 10 #define NFS_SRV 10
#define LAST_ITEM NFS_SRV /* must equal last item above */ #define LAST_ITEM NFS_SRV /* must equal last item above */
@ -244,7 +249,7 @@
"CPU", "CPU",
"CPU", "CPU",
"CPU", "CPU",
--- 226,299 ---- --- 231,304 ----
}AppData, *AppDataPtr; }AppData, *AppDataPtr;
static char *topNames[] = { static char *topNames[] = {
@ -321,7 +326,7 @@
"CPU", "CPU",
*************** ***************
*** 183,186 **** *** 183,186 ****
--- 305,351 ---- --- 310,356 ----
"Packets", "Packets",
"Calls", "Calls",
"Calls", "Calls",

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994 *** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994
--- ./Imakefile Wed Dec 2 23:33:54 1998 --- ./Imakefile Tue Apr 10 21:51:28 2001
*************** ***************
*** 17,31 **** *** 17,31 ****
SYS_MODULE= sgi_system SYS_MODULE= sgi_system
@ -24,7 +24,7 @@
! #if defined (FreeBSDArchitecture) ! #if defined (FreeBSDArchitecture)
! FreeBSDFLAGS= -lkvm -ldevstat ! FreeBSDFLAGS= -lkvm -ldevstat
! SYS_MODULE= freebsd_system ! SYS_MODULE= freebsd_system
! CC= gcc ! CC?= gcc
! EXTRA_DEFINES= -DHAVE_SYS_PARAM_H ! EXTRA_DEFINES= -DHAVE_SYS_PARAM_H
! #endif ! #endif
! !
@ -36,5 +36,4 @@
! SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c ! SRCS = TimeChart.c StripChart.c misc.c $(SYS_MODULE).c xperfmon.c
! OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o ! OBJS = TimeChart.o StripChart.o misc.o $(SYS_MODULE).o xperfmon.o
ComplexProgramTarget(xperfmon++) ComplexProgramTarget(xperfmon++)

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/README Wed Jul 27 22:29:30 1994 *** ../xperfmon++/README Wed Jul 27 22:29:30 1994
--- ./README Thu Oct 15 21:25:22 1998 --- ./README Tue Apr 10 22:07:01 2001
*************** ***************
*** 6,12 **** *** 6,12 ****
program will compile correctly under X11R5 and/or Motif. program will compile correctly under X11R5 and/or Motif.
@ -18,11 +18,12 @@
Replaced Perfmon widget with a highly modified StripChart widget. Charts Replaced Perfmon widget with a highly modified StripChart widget. Charts
now smooth scroll, scales update immediately, and there is a scrolling timestamp now smooth scroll, scales update immediately, and there is a scrolling timestamp
*************** ***************
*** 18,20 **** *** 17,20 ****
--- 18,66 ---- --- 17,75 ----
1-25-94 Completed port to DEC-Ultrix by Roger Smith, Sterling Software @ NASA-Ames
Research Center, rsmith@proteus.arc.nasa.gov. Imake will build for correct Research Center, rsmith@proteus.arc.nasa.gov. Imake will build for correct
O/S if x11r5 is fully installed in all the right places. 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 + 3-15-95 Completely new port of systemdependent file (bsd_system.c) for FreeBSD-2.X
+ by Lars Köller @University of Rostock, Germany. + by Lars Köller @University of Rostock, Germany.
@ -69,3 +70,11 @@
+ Compiles on FreeBSD-3.X + Compiles on FreeBSD-3.X
+ by Lars Köller @University of Bielefeld, Germany. + by Lars Köller @University of Bielefeld, Germany.
+ E-Mail: Lars.Koeller@Uni-Bielefeld.DE + E-Mail: Lars.Koeller@Uni-Bielefeld.DE
+
+ 04-10-01 Correct several bugs in V3.0:
+ Calc etime correct for multi CPU machines, show disk stats for new
+ "ad" disk devices, count number of network in/out packets correctly,
+ get free swapspace only every 10 intervals to limit CPU usage.
+ Compiles on FreeBSD-3.X/4.X
+ by Lars Köller @University of Bielefeld, Germany.
+ E-Mail: Lars.Koeller@Uni-Bielefeld.DE

View file

@ -1,5 +1,5 @@
*** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994 *** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994
--- ./xperfmon++.man Sun Jan 10 21:28:14 1999 --- ./xperfmon++.man Tue Apr 10 22:04:19 2001
*************** ***************
*** 1,5 **** *** 1,5 ****
! ./" .TH XPERFMON++ 1 "19 January 1988" "X Version 11" ! ./" .TH XPERFMON++ 1 "19 January 1988" "X Version 11"
@ -8,7 +8,7 @@
xperfmon++ - X Window System-based performance monitor xperfmon++ - X Window System-based performance monitor
.SH SYNOPSIS .SH SYNOPSIS
--- 1,4 ---- --- 1,4 ----
! .TH XPERFMON++ 1 "10 Oct 1998" "V3.0 for FreeBSD-3.X" ! .TH XPERFMON++ 1 "10 Oct 1998" "V3.1 for FreeBSD-3.X/4.X"
.SH NAME .SH NAME
xperfmon++ - X Window System-based performance monitor xperfmon++ - X Window System-based performance monitor
.SH SYNOPSIS .SH SYNOPSIS
@ -149,7 +149,7 @@
Graph \fISystem Interrupts\fP. Graph \fISystem Interrupts\fP.
.TP 26 .TP 26
+ .B \-freeswap | \+freeswap + .B \-freeswap | \+freeswap
+ Graph \fIFree Swap in %\fP. + Graph \fIFree Swap in %\fP. Calculation is done only every 10 intervals.
+ .TP 26 + .TP 26
+ .B \-diskxfr | \+diskxfr + .B \-diskxfr | \+diskxfr
+ Graph \fIDisk Transfers\fP per second. + Graph \fIDisk Transfers\fP per second.
@ -580,7 +580,7 @@
above address. above address.
.PP .PP
Enjoy! Enjoy!
--- 514,561 ---- --- 514,566 ----
If you like this program, or if you have difficulties, I would like to hear your comments. If you like this program, or if you have difficulties, I would like to hear your comments.
E-Mail me at rsmith@proteus.arc.nasa.gov. E-Mail me at rsmith@proteus.arc.nasa.gov.
.PP .PP
@ -625,6 +625,11 @@
+ number of graphs and rescaling the window fixed (hope this was the last time). + number of graphs and rescaling the window fixed (hope this was the last time).
+ Output of Warn/Alarm values (press L|l in xperfmon++ window) corrected. + Output of Warn/Alarm values (press L|l in xperfmon++ window) corrected.
+ .PP + .PP
+ .I xperfmon++ V3.1 for FreeBSD 3.X/4.X (several bugfixes)
+ Calc etime correct for multi CPU machines, show disk stats for new
+ "ad" disk devices, count number of network in/out packets correctly,
+ get free swapspace only every 10 intervals to limit CPU usage.
+ .PP
+ Please E-Mail any bugs or comments with the subject + Please E-Mail any bugs or comments with the subject
+ "xperfmon++ V3: ..." to Lars.Koeller@Uni-Bielefeld.DE or lkoeller@cc.FH-Lippe.DE. + "xperfmon++ V3: ..." to Lars.Koeller@Uni-Bielefeld.DE or lkoeller@cc.FH-Lippe.DE.
.PP .PP