mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
Update of xperfmon++ from Lars. The previous port didn't work with
2.2 (says Lars). I have now also moved freebsd_system.c out into a files subdirectory, it used to be created in its entirety by patch-aa before which makes maintenance fairly uncomfortable. I have now verified that it builds and works with FreeBSD 2.1.x (freefall -- it is really funny to watch it there, the disk transfers and interrupts remain in the red zone all the time ;-), 3.0-current (thud), and 2.2. Submitted by: Lars_Koeller@odie.physik2.Uni-Rostock.DE OKed by: asami
This commit is contained in:
parent
99b6cfec86
commit
aadef3786f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=5963
16 changed files with 1490 additions and 1412 deletions
|
@ -1,22 +1,24 @@
|
||||||
# New ports collection makefile for: xperfmon++ V1.3
|
# New ports collection makefile for: xperfmon++ V1.40
|
||||||
# Version required: 1.1
|
# Version required: 1.1
|
||||||
# Date created: 15 December 95
|
# Date created: 14 March 97
|
||||||
# Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
|
# Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
#
|
#
|
||||||
# $Id: Makefile,v 1.9 1996/05/20 07:32:45 asami Exp $
|
# $Id: Makefile,v 1.6 1995/12/15 11:16:54 Lars Koeller Exp $
|
||||||
#
|
#
|
||||||
|
PREFIX= /usr/X11R6
|
||||||
DISTNAME= xperfmon++
|
DISTNAME= xperfmon++
|
||||||
PKGNAME= xperfmon++-1.33
|
PKGNAME= xperfmon++v1.40
|
||||||
CATEGORIES= sysutils x11
|
USE_IMAKE= yes
|
||||||
|
CATEGORIES+= sysutils x11
|
||||||
|
|
||||||
# In Germany try this
|
# In Germany try this
|
||||||
#MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
|
#MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
|
||||||
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
|
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
|
||||||
|
|
||||||
DISTFILES= xperfmon++v1.1.tar.Z
|
DISTFILES= xperfmon++v1.1.tar.Z
|
||||||
|
EXTRACT_ONLY= xperfmon++v1.1.tar.Z
|
||||||
|
|
||||||
MAINTAINER= Lars_Koeller@odie.physik2.uni-rostock.de
|
MAINTAINER= Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
|
||||||
EXTRACT_ONLY= xperfmon++v1.1.tar.Z
|
|
||||||
USE_IMAKE= yes
|
|
||||||
|
|
||||||
.include <bsd.port.mk>
|
.include <bsd.port.mk>
|
||||||
|
|
||||||
|
|
633
sysutils/xperfmon/files/freebsd_system.c
Normal file
633
sysutils/xperfmon/files/freebsd_system.c
Normal file
|
@ -0,0 +1,633 @@
|
||||||
|
/*
|
||||||
|
* Perfmon Performance Monitor
|
||||||
|
*
|
||||||
|
* Copyright 1985, Massachusetts Institute of Technology
|
||||||
|
* Copyright 1989, PCS Computer Systeme GmbH, West Germany
|
||||||
|
* Copyright 1994, Sterling Software @ NASA-Ames Research Center
|
||||||
|
* Copyright 1995, Regents of the University of California,
|
||||||
|
* Lars Köller <Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
* documentation for any purpose is hereby granted without fee, 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 PCS and Sterling Software not be used in advertising or
|
||||||
|
* publicity pertaining to distribution of the software without specific,
|
||||||
|
* written prior permission. PCS and Sterling Software makes no representations about the
|
||||||
|
* suitability of this software for any purpose. It is provided "as is"
|
||||||
|
* without express or implied warranty.
|
||||||
|
*
|
||||||
|
* PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & 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.
|
||||||
|
*
|
||||||
|
* Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
|
||||||
|
* Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
|
||||||
|
* tom@meepmeep.pcs.com
|
||||||
|
* 1994 Revision
|
||||||
|
* Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
||||||
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
|
* 1995 FreeBSD 2.x Version
|
||||||
|
* Author: Lars Koeller, Univerity of Rostock, Germany
|
||||||
|
* Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This file contains only system functions - that is the functions that
|
||||||
|
* get the information the performance monitor is monitoring. No calls
|
||||||
|
* to any X routines should be made here. The reason for doing this is
|
||||||
|
* so that as the X toolkit becomes available and the X window system
|
||||||
|
* improves no changes will have to be made to this file, and as this
|
||||||
|
* program is made available for a new type of machine, only this file
|
||||||
|
* will need to be changed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <X11/IntrinsicP.h>
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <paths.h>
|
||||||
|
#include <kvm.h>
|
||||||
|
#include <nlist.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <sys/dkstat.h>
|
||||||
|
#include <sys/buf.h>
|
||||||
|
#include <sys/vmmeter.h>
|
||||||
|
#include <vm/vm.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#if __FreeBSD_version >= 300000
|
||||||
|
# include <net/if_var.h>
|
||||||
|
#endif
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/conf.h>
|
||||||
|
#include <sys/rlist.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#include <nfs/nfsv2.h>
|
||||||
|
#include <nfs/rpcv2.h>
|
||||||
|
#include <nfs/nfs.h>
|
||||||
|
|
||||||
|
#ifndef CTL_FS
|
||||||
|
#define CTL_FS CTL_VFS /* compatibility w/ Lite1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It's a mess with all these version numbers:
|
||||||
|
*
|
||||||
|
* 2.0-RELEASE: 199411
|
||||||
|
* 2.1-current's: 199501, 199503
|
||||||
|
* 2.0.5-RELEASE: 199504
|
||||||
|
* 2.2-current before 2.1: 199508
|
||||||
|
* 2.1.0-RELEASE: 199511
|
||||||
|
* 2.2-current before 2.1.5: 199512
|
||||||
|
* 2.1.5-RELEASE: 199607
|
||||||
|
* 2.2-current before 2.1.6: 199608
|
||||||
|
* 2.1.6-RELEASE: 199612
|
||||||
|
* 2.1.7-RELEASE: 199612
|
||||||
|
* 2.2-RELEASE: 220000 (ahhhhh)
|
||||||
|
* 3.0-current as of Feb 1997: 300000 (ohhhhh)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FreeBSD version 2.2 and greater have NFSv3
|
||||||
|
*/
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
# define HAS_NFS_V3
|
||||||
|
#endif /* FreeBSD_version */
|
||||||
|
|
||||||
|
#include "is.h"
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function Prototypes
|
||||||
|
*/
|
||||||
|
static int get_namelist(const char *kernel_name, const char *memory_name);
|
||||||
|
static void kread(int nlx, void *addr, size_t size);
|
||||||
|
static void collect_stats(void);
|
||||||
|
static int total_disk_transfers(void);
|
||||||
|
static int get_swapspace(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Variables & Structs
|
||||||
|
*/
|
||||||
|
static unsigned long *intrcnt;
|
||||||
|
static int nintr, hz;
|
||||||
|
static kvm_t *kd;
|
||||||
|
static char errbuf[_POSIX2_LINE_MAX];
|
||||||
|
static char dr_name[DK_NDRIVE][DK_NAMELEN];
|
||||||
|
static double etime;
|
||||||
|
|
||||||
|
int current_values[NUM_GRAPHS];
|
||||||
|
stat_type stats;
|
||||||
|
|
||||||
|
extern Widget perfmon[NUM_GRAPHS];
|
||||||
|
|
||||||
|
static struct packet {
|
||||||
|
int input, output, collisions;
|
||||||
|
} packets, old_packets;
|
||||||
|
|
||||||
|
static struct nfsstats nfsstats;
|
||||||
|
static struct _nfsStats {
|
||||||
|
int nfsServer, nfsClient;
|
||||||
|
} nfsStats, old_nfsStats;
|
||||||
|
|
||||||
|
struct nlist nl[] = {
|
||||||
|
#define X_CPTIME 0
|
||||||
|
{ "_cp_time" },
|
||||||
|
#define X_SUM 1
|
||||||
|
{ "_cnt" },
|
||||||
|
#define X_BOOTTIME 2
|
||||||
|
{ "_boottime" },
|
||||||
|
#define X_DKXFER 3
|
||||||
|
{ "_dk_xfer" },
|
||||||
|
#define X_HZ 4
|
||||||
|
{ "_hz" },
|
||||||
|
#define N_IFNET 5
|
||||||
|
{ "_ifnet" },
|
||||||
|
#define X_INTRCNT 6
|
||||||
|
{ "_intrcnt" },
|
||||||
|
#define X_EINTRCNT 7
|
||||||
|
{ "_eintrcnt" },
|
||||||
|
#define VM_NSWAP 8
|
||||||
|
{ "_nswap" }, /* size of largest swap device */
|
||||||
|
#define VM_NSWDEV 9
|
||||||
|
{ "_nswdev" }, /* number of swap devices */
|
||||||
|
#define VM_DMMAX 10
|
||||||
|
{ "_dmmax" }, /* maximum size of a swap block */
|
||||||
|
#define VM_SWAPLIST 11
|
||||||
|
{ "_swaplist" },/* list of free swap areas */
|
||||||
|
#define VM_SWDEVT 12
|
||||||
|
{ "_swdevt" }, /* list of swap devices and sizes */
|
||||||
|
{ "" },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
long time[CPUSTATES];
|
||||||
|
long xfer[DK_NDRIVE];
|
||||||
|
struct vmmeter Sum;
|
||||||
|
struct vmmeter Rate;
|
||||||
|
int interrupts;
|
||||||
|
} s, s1;
|
||||||
|
|
||||||
|
int first_time_getswap;
|
||||||
|
|
||||||
|
#define rate s.Rate
|
||||||
|
#define sum s.Sum
|
||||||
|
|
||||||
|
/*
|
||||||
|
This routine does all necessary setting up of structures
|
||||||
|
that will handle system calls.
|
||||||
|
*/
|
||||||
|
void sys_setup()
|
||||||
|
{
|
||||||
|
get_namelist(getbootfile(), _PATH_KMEM);
|
||||||
|
collect_stats();
|
||||||
|
/* hack to enforce a resize of the 'Free Swap' graph
|
||||||
|
without this the left border always displays the first drawn line
|
||||||
|
cause this field isn't resized very often due to slow change of
|
||||||
|
the free swapspace! */
|
||||||
|
first_time_getswap = 1;
|
||||||
|
etime = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Update the data structures
|
||||||
|
*/
|
||||||
|
void update_stats()
|
||||||
|
{
|
||||||
|
int state;
|
||||||
|
double pct, tot;;
|
||||||
|
|
||||||
|
collect_stats();
|
||||||
|
|
||||||
|
tot = 0;
|
||||||
|
for (state = 0; state < CPUSTATES; ++state)
|
||||||
|
tot += s.time[state];
|
||||||
|
if (tot)
|
||||||
|
pct = 100 / tot;
|
||||||
|
else
|
||||||
|
pct = 0;
|
||||||
|
current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
|
||||||
|
current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
|
||||||
|
current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
|
||||||
|
|
||||||
|
if (perfmon[FREE_MEM]) {
|
||||||
|
if(!first_time_getswap)
|
||||||
|
current_values[FREE_MEM] = get_swapspace();
|
||||||
|
else {
|
||||||
|
current_values[FREE_MEM] = 100;
|
||||||
|
first_time_getswap = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (perfmon[DISK_TRANSFERS])
|
||||||
|
current_values[DISK_TRANSFERS] = total_disk_transfers();
|
||||||
|
if (perfmon[INTERRUPTS])
|
||||||
|
current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
|
||||||
|
if (perfmon[INPUT_PACKETS])
|
||||||
|
current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
|
||||||
|
if (perfmon[OUTPUT_PACKETS])
|
||||||
|
current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
|
||||||
|
if (perfmon[COLLISION_PACKETS])
|
||||||
|
current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
|
||||||
|
if (perfmon[NFS_CLIENT_CALLS])
|
||||||
|
current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
|
||||||
|
if (perfmon[NFS_SERVER_CALLS])
|
||||||
|
current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the overall disk transfer rates
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
total_disk_transfers()
|
||||||
|
{
|
||||||
|
register int i, total_xfers = 0;
|
||||||
|
|
||||||
|
for(i=0; i < DK_NDRIVE; i++)
|
||||||
|
total_xfers += s.xfer[i];
|
||||||
|
return(total_xfers/etime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect all the data
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
collect_stats()
|
||||||
|
{
|
||||||
|
off_t ifnetaddr;
|
||||||
|
register int i, tmp;
|
||||||
|
int mib[3], size;
|
||||||
|
|
||||||
|
kread(X_CPTIME, s.time, sizeof(s.time));
|
||||||
|
kread(X_DKXFER, s.xfer, sizeof(s.xfer));
|
||||||
|
kread(X_SUM, &sum, sizeof(sum) );
|
||||||
|
|
||||||
|
nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
|
||||||
|
if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
|
||||||
|
err(1, "xperfmon++ malloc in collect_stats");
|
||||||
|
nintr /= sizeof(long);
|
||||||
|
kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
|
||||||
|
s1.interrupts = s.interrupts;
|
||||||
|
s.interrupts = 0;
|
||||||
|
for (i = 0; i < nintr; i++)
|
||||||
|
s.interrupts += *(intrcnt + i);
|
||||||
|
|
||||||
|
free(intrcnt);
|
||||||
|
etime = 0;
|
||||||
|
for (i=0; i < DK_NDRIVE; i++) {
|
||||||
|
tmp = s.xfer[i];
|
||||||
|
s.xfer[i] -= s1.xfer[i];
|
||||||
|
s1.xfer[i] = tmp;
|
||||||
|
}
|
||||||
|
for (i=0; i < CPUSTATES; i++) {
|
||||||
|
tmp = s.time[i];
|
||||||
|
s.time[i] -= s1.time[i];
|
||||||
|
s1.time[i] = tmp;
|
||||||
|
etime += s.time[i];
|
||||||
|
}
|
||||||
|
if(etime == 0.)
|
||||||
|
etime = 1.;
|
||||||
|
etime /= hz;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the Network-Traffic
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ifnetaddr = nl[N_IFNET].n_value) != 0) {
|
||||||
|
#if __FreeBSD_version < 300000
|
||||||
|
struct ifnet ifnet;
|
||||||
|
kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
||||||
|
old_packets = packets;
|
||||||
|
packets.input = packets.output = packets.collisions = 0;
|
||||||
|
while (ifnetaddr) {
|
||||||
|
kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
|
||||||
|
packets.input += ifnet.if_ipackets;
|
||||||
|
packets.output += ifnet.if_opackets;
|
||||||
|
packets.collisions += ifnet.if_collisions;
|
||||||
|
ifnetaddr = (u_long) ifnet.if_next;
|
||||||
|
}
|
||||||
|
#else /* 3.0-current, Jan 1997 */
|
||||||
|
/* Stolen from netstat/if.c */
|
||||||
|
struct ifnet ifnet;
|
||||||
|
struct ifnethead ifnethead;
|
||||||
|
u_long ifaddraddr, ifnetfound;
|
||||||
|
struct ifaddr ifa;
|
||||||
|
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnethead, sizeof ifnethead) == -1)
|
||||||
|
return;
|
||||||
|
ifnetaddr = (u_long)ifnethead.tqh_first;
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
old_packets = packets;
|
||||||
|
packets.input = packets.output = packets.collisions = 0;
|
||||||
|
ifaddraddr = 0;
|
||||||
|
while (ifnetaddr || ifaddraddr) {
|
||||||
|
if (ifaddraddr == 0) {
|
||||||
|
ifnetfound = ifnetaddr;
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
||||||
|
return;
|
||||||
|
ifnetaddr = (u_long)ifnet.if_link.tqe_next;
|
||||||
|
ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first;
|
||||||
|
}
|
||||||
|
if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) {
|
||||||
|
ifaddraddr = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ifaddraddr = (u_long)ifa.ifa_link.tqe_next;
|
||||||
|
|
||||||
|
packets.input += ifnet.if_ipackets;
|
||||||
|
packets.output += ifnet.if_opackets;
|
||||||
|
packets.collisions += ifnet.if_collisions;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the NFS and RPC Calls
|
||||||
|
*/
|
||||||
|
|
||||||
|
size = sizeof(nfsstats);
|
||||||
|
mib[0] = CTL_FS;
|
||||||
|
mib[1] = MOUNT_NFS;
|
||||||
|
mib[2] = NFS_NFSSTATS;
|
||||||
|
|
||||||
|
if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
old_nfsStats = nfsStats;
|
||||||
|
|
||||||
|
nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_SETATTR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_LOOKUP] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READLINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READ] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_WRITE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_CREATE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_REMOVE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_RENAME] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_LINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_SYMLINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_MKDIR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_RMDIR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READDIR] +
|
||||||
|
#ifndef HAS_NFS_V3
|
||||||
|
nfsstats.rpccnt[NFSPROC_STATFS] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
|
||||||
|
#else /* HAS_NFS_V3 */
|
||||||
|
nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_FSSTAT] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_FSINFO] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_PATHCONF] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_COMMIT] +
|
||||||
|
#endif /* HAS_NFS_V3 */
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_VACATED] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_EVICTED];
|
||||||
|
|
||||||
|
nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_SETATTR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READLINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READ] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_WRITE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_CREATE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_REMOVE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_RENAME] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_LINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_MKDIR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_RMDIR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READDIR] +
|
||||||
|
#ifndef HAS_NFS_V3
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_STATFS] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
|
||||||
|
#else /* HAS_NFS_V3 */
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_FSINFO] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_COMMIT] +
|
||||||
|
#endif /* HAS_NFS_V3 */
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reads the nlist from the kernel
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
get_namelist(kernel_name, memory_name)
|
||||||
|
const char *kernel_name, *memory_name;
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
time_t boottime;
|
||||||
|
register int i, c;
|
||||||
|
int nintv;
|
||||||
|
|
||||||
|
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
|
||||||
|
if (kd == 0) {
|
||||||
|
(void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((c = kvm_nlist(kd, nl)) != 0) {
|
||||||
|
if (c > 0) {
|
||||||
|
(void)fprintf(stderr,"xperfmon++: undefined symbols:");
|
||||||
|
for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
|
||||||
|
if (nl[c].n_type == 0)
|
||||||
|
fprintf(stderr, " %s", nl[c].n_name);
|
||||||
|
(void)fputc('\n', stderr);
|
||||||
|
} else
|
||||||
|
(void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
kread(X_BOOTTIME, &boottime, sizeof(boottime));
|
||||||
|
kread(X_HZ, &hz, sizeof(hz));
|
||||||
|
for (i = 0; i < DK_NDRIVE; i++) {
|
||||||
|
strcpy(dr_name[i], "xx");
|
||||||
|
}
|
||||||
|
time(&now);
|
||||||
|
nintv = now - boottime;
|
||||||
|
if (nintv <= 0 || nintv > 60*60*24*365*10) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Time makes no sense... namelist must be wrong.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return(nintv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Kread reads something from the kernel, given its nlist index.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
kread(nlx, addr, size)
|
||||||
|
int nlx;
|
||||||
|
void *addr;
|
||||||
|
size_t size;
|
||||||
|
{
|
||||||
|
char *sym;
|
||||||
|
|
||||||
|
if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
|
||||||
|
sym = nl[nlx].n_name;
|
||||||
|
if (*sym == '_')
|
||||||
|
++sym;
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"xpermon++: symbol %s not defined\n", sym);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
|
||||||
|
sym = nl[nlx].n_name;
|
||||||
|
if (*sym == '_')
|
||||||
|
++sym;
|
||||||
|
(void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get_swapspace is based on a program called swapinfo written
|
||||||
|
* by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
get_swapspace()
|
||||||
|
{
|
||||||
|
char *header;
|
||||||
|
int hlen, nswap, nswdev, dmmax;
|
||||||
|
int i, div, avail, nfree, npfree, used;
|
||||||
|
struct swdevt *sw;
|
||||||
|
long blocksize, *perdev;
|
||||||
|
struct rlist head;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
struct rlisthdr swaplist;
|
||||||
|
struct rlist *swapptr;
|
||||||
|
#else
|
||||||
|
struct rlist *swaplist;
|
||||||
|
#endif
|
||||||
|
u_long ptr;
|
||||||
|
kread(VM_NSWAP, &nswap, sizeof(nswap));
|
||||||
|
kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
|
||||||
|
kread(VM_DMMAX, &dmmax, sizeof(dmmax));
|
||||||
|
kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
|
||||||
|
if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
|
||||||
|
(perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
|
||||||
|
err(1, "xperfmon++ malloc in get_swapspace");
|
||||||
|
kread(VM_SWDEVT, &ptr, sizeof(ptr));
|
||||||
|
kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
|
||||||
|
/* Count up swap space. */
|
||||||
|
nfree = 0;
|
||||||
|
memset(perdev, 0, nswdev * sizeof(*perdev));
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
swapptr = swaplist.rlh_list;
|
||||||
|
while (swapptr) {
|
||||||
|
#else
|
||||||
|
while (swaplist) {
|
||||||
|
#endif
|
||||||
|
int top, bottom, next_block;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
kvm_read(kd, (u_long)swapptr, &head, sizeof(struct rlist));
|
||||||
|
#else
|
||||||
|
kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
|
||||||
|
#endif
|
||||||
|
top = head.rl_end;
|
||||||
|
bottom = head.rl_start;
|
||||||
|
|
||||||
|
nfree += top - bottom + 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Swap space is split up among the configured disks.
|
||||||
|
*
|
||||||
|
* For interleaved swap devices, the first dmmax blocks
|
||||||
|
* of swap space some from the first disk, the next dmmax
|
||||||
|
* blocks from the next, and so on up to nswap blocks.
|
||||||
|
*
|
||||||
|
* The list of free space joins adjacent free blocks,
|
||||||
|
* ignoring device boundries. If we want to keep track
|
||||||
|
* of this information per device, we'll just have to
|
||||||
|
* extract it ourselves.
|
||||||
|
*/
|
||||||
|
while (top / dmmax != bottom / dmmax) {
|
||||||
|
next_block = ((bottom + dmmax) / dmmax);
|
||||||
|
perdev[(bottom / dmmax) % nswdev] +=
|
||||||
|
next_block * dmmax - bottom;
|
||||||
|
bottom = next_block * dmmax;
|
||||||
|
}
|
||||||
|
perdev[(bottom / dmmax) % nswdev] +=
|
||||||
|
top - bottom + 1;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
swapptr = head.rl_next;
|
||||||
|
#else
|
||||||
|
swaplist = head.rl_next;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
header = getbsize(&hlen, &blocksize);
|
||||||
|
div = blocksize / 512;
|
||||||
|
avail = npfree = 0;
|
||||||
|
for (i = 0; i < nswdev; i++) {
|
||||||
|
int xsize, xfree;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't report statistics for partitions which have not
|
||||||
|
* yet been activated via swapon(8).
|
||||||
|
*/
|
||||||
|
if (!(sw[i].sw_flags & SW_FREED))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* The first dmmax is never allocated to avoid trashing of
|
||||||
|
* disklabels
|
||||||
|
*/
|
||||||
|
xsize = sw[i].sw_nblks - dmmax;
|
||||||
|
xfree = perdev[i];
|
||||||
|
used = xsize - xfree;
|
||||||
|
npfree++;
|
||||||
|
avail += xsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If only one partition has been set up via swapon(8), we don't
|
||||||
|
* need to bother with totals.
|
||||||
|
*/
|
||||||
|
used = avail - nfree;
|
||||||
|
|
||||||
|
free(perdev);
|
||||||
|
free(sw);
|
||||||
|
return((100*nfree)/avail); /* return free swap in percent */
|
||||||
|
}
|
|
@ -1,582 +1,4 @@
|
||||||
diff -c -N ../xperfmon++/freebsd_system.c ./freebsd_system.c
|
diff -c -N ../xperfmon++/StripCharP.h ./StripCharP.h
|
||||||
*** ../xperfmon++/freebsd_system.c Thu Jan 1 01:00:00 1970
|
|
||||||
--- ./freebsd_system.c Sun Sep 22 17:14:41 1996
|
|
||||||
***************
|
|
||||||
*** 0 ****
|
|
||||||
--- 1,572 ----
|
|
||||||
+ /*
|
|
||||||
+ * Perfmon Performance Monitor
|
|
||||||
+ *
|
|
||||||
+ * Copyright 1985, Massachusetts Institute of Technology
|
|
||||||
+ * Copyright 1989, PCS Computer Systeme GmbH, West Germany
|
|
||||||
+ * Copyright 1994, Sterling Software @ NASA-Ames Research Center
|
|
||||||
+ * Copyright 1995, Regents of the University of California,
|
|
||||||
+ * Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de
|
|
||||||
+ *
|
|
||||||
+ * Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
+ * documentation for any purpose is hereby granted without fee, 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 PCS and Sterling Software not be used in advertising or
|
|
||||||
+ * publicity pertaining to distribution of the software without specific,
|
|
||||||
+ * written prior permission. PCS and Sterling Software makes no representations about the
|
|
||||||
+ * suitability of this software for any purpose. It is provided "as is"
|
|
||||||
+ * without express or implied warranty.
|
|
||||||
+ *
|
|
||||||
+ * PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
||||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & 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.
|
|
||||||
+ *
|
|
||||||
+ * Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
|
|
||||||
+ * Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
|
|
||||||
+ * tom@meepmeep.pcs.com
|
|
||||||
+ * 1994 Revision
|
|
||||||
+ * Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
|
||||||
+ * Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
|
||||||
+ * 1995 FreeBSD 2.x Version
|
|
||||||
+ * Author: Lars Koeller, Univerity of Rostock, Germany
|
|
||||||
+ * Lars_Koeller@odie.physik2.uni-rostock.de
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ /* This file contains only system functions - that is the functions that
|
|
||||||
+ * get the information the performance monitor is monitoring. No calls
|
|
||||||
+ * to any X routines should be made here. The reason for doing this is
|
|
||||||
+ * so that as the X toolkit becomes available and the X window system
|
|
||||||
+ * improves no changes will have to be made to this file, and as this
|
|
||||||
+ * program is made available for a new type of machine, only this file
|
|
||||||
+ * will need to be changed.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ #ifdef _HAVE_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 <X11/IntrinsicP.h>
|
|
||||||
+
|
|
||||||
+ #include "system.h"
|
|
||||||
+
|
|
||||||
+ #include <stdio.h>
|
|
||||||
+ #include <stdlib.h>
|
|
||||||
+ #include <strings.h>
|
|
||||||
+ #include <unistd.h>
|
|
||||||
+ #include <paths.h>
|
|
||||||
+ #include <kvm.h>
|
|
||||||
+ #include <nlist.h>
|
|
||||||
+ #include <limits.h>
|
|
||||||
+ #include <errno.h>
|
|
||||||
+ #include <err.h>
|
|
||||||
+
|
|
||||||
+ #include <sys/file.h>
|
|
||||||
+ #include <sys/param.h>
|
|
||||||
+ #include <sys/socket.h>
|
|
||||||
+ #include <sys/sysctl.h>
|
|
||||||
+ #include <sys/dkstat.h>
|
|
||||||
+ #include <sys/buf.h>
|
|
||||||
+ #include <sys/vmmeter.h>
|
|
||||||
+ #include <vm/vm.h>
|
|
||||||
+ #include <net/if.h>
|
|
||||||
+ #include <netinet/in.h>
|
|
||||||
+ #include <sys/stat.h>
|
|
||||||
+ #include <sys/conf.h>
|
|
||||||
+ #include <sys/rlist.h>
|
|
||||||
+ #include <sys/mount.h>
|
|
||||||
+ #include <nfs/nfsv2.h>
|
|
||||||
+ #include <nfs/nfs.h>
|
|
||||||
+
|
|
||||||
+ #ifndef CTL_FS
|
|
||||||
+ #define CTL_FS CTL_VFS /* compatibility w/ Lite1 */
|
|
||||||
+ #endif
|
|
||||||
+
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ # define HAS_NFS_V3
|
|
||||||
+ #endif /* FreeBSD_version */
|
|
||||||
+
|
|
||||||
+ #include "is.h"
|
|
||||||
+
|
|
||||||
+ #ifndef TRUE
|
|
||||||
+ #define TRUE 1
|
|
||||||
+ #define FALSE 0
|
|
||||||
+ #endif
|
|
||||||
+
|
|
||||||
+ #define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Function Prototypes
|
|
||||||
+ */
|
|
||||||
+ static int get_namelist(const char *kernel_name, const char *memory_name);
|
|
||||||
+ static void kread(int nlx, void *addr, size_t size);
|
|
||||||
+ static void collect_stats(void);
|
|
||||||
+ static int total_disk_transfers(void);
|
|
||||||
+ static int get_swapspace(void);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Variables & Structs
|
|
||||||
+ */
|
|
||||||
+ static unsigned long *intrcnt;
|
|
||||||
+ static int nintr, hz;
|
|
||||||
+ static kvm_t *kd;
|
|
||||||
+ static char errbuf[_POSIX2_LINE_MAX];
|
|
||||||
+ static char dr_name[DK_NDRIVE][DK_NAMELEN];
|
|
||||||
+ static double etime;
|
|
||||||
+
|
|
||||||
+ int current_values[NUM_GRAPHS];
|
|
||||||
+ stat_type stats;
|
|
||||||
+
|
|
||||||
+ extern Widget perfmon[NUM_GRAPHS];
|
|
||||||
+
|
|
||||||
+ static struct packet {
|
|
||||||
+ int input, output, collisions;
|
|
||||||
+ } packets, old_packets;
|
|
||||||
+
|
|
||||||
+ static struct nfsstats nfsstats;
|
|
||||||
+ static struct _nfsStats {
|
|
||||||
+ int nfsServer, nfsClient;
|
|
||||||
+ } nfsStats, old_nfsStats;
|
|
||||||
+
|
|
||||||
+ struct nlist nl[] = {
|
|
||||||
+ #define X_CPTIME 0
|
|
||||||
+ { "_cp_time" },
|
|
||||||
+ #define X_SUM 1
|
|
||||||
+ { "_cnt" },
|
|
||||||
+ #define X_BOOTTIME 2
|
|
||||||
+ { "_boottime" },
|
|
||||||
+ #define X_DKXFER 3
|
|
||||||
+ { "_dk_xfer" },
|
|
||||||
+ #define X_HZ 4
|
|
||||||
+ { "_hz" },
|
|
||||||
+ #define N_IFNET 5
|
|
||||||
+ { "_ifnet" },
|
|
||||||
+ #define X_INTRCNT 6
|
|
||||||
+ { "_intrcnt" },
|
|
||||||
+ #define X_EINTRCNT 7
|
|
||||||
+ { "_eintrcnt" },
|
|
||||||
+ #define VM_NSWAP 8
|
|
||||||
+ { "_nswap" }, /* size of largest swap device */
|
|
||||||
+ #define VM_NSWDEV 9
|
|
||||||
+ { "_nswdev" }, /* number of swap devices */
|
|
||||||
+ #define VM_DMMAX 10
|
|
||||||
+ { "_dmmax" }, /* maximum size of a swap block */
|
|
||||||
+ #define VM_SWAPLIST 11
|
|
||||||
+ { "_swaplist" },/* list of free swap areas */
|
|
||||||
+ #define VM_SWDEVT 12
|
|
||||||
+ { "_swdevt" }, /* list of swap devices and sizes */
|
|
||||||
+ { "" },
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ struct {
|
|
||||||
+ long time[CPUSTATES];
|
|
||||||
+ long xfer[DK_NDRIVE];
|
|
||||||
+ struct vmmeter Sum;
|
|
||||||
+ struct vmmeter Rate;
|
|
||||||
+ int interrupts;
|
|
||||||
+ } s, s1;
|
|
||||||
+
|
|
||||||
+ int first_time_getswap;
|
|
||||||
+
|
|
||||||
+ #define rate s.Rate
|
|
||||||
+ #define sum s.Sum
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ This routine does all necessary setting up of structures
|
|
||||||
+ that will handle system calls.
|
|
||||||
+ */
|
|
||||||
+ void sys_setup()
|
|
||||||
+ {
|
|
||||||
+ get_namelist(getbootfile(), _PATH_KMEM);
|
|
||||||
+ collect_stats();
|
|
||||||
+ /* hack to enforce a resize of the 'Free Swap' graph
|
|
||||||
+ without this the left border always displays the first drawn line
|
|
||||||
+ cause this field isn't resized very often due to slow change of
|
|
||||||
+ the free swapspace! */
|
|
||||||
+ first_time_getswap = 1;
|
|
||||||
+ etime = 1.0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Update the data structures
|
|
||||||
+ */
|
|
||||||
+ void update_stats()
|
|
||||||
+ {
|
|
||||||
+ int state;
|
|
||||||
+ double pct, tot;;
|
|
||||||
+
|
|
||||||
+ collect_stats();
|
|
||||||
+
|
|
||||||
+ tot = 0;
|
|
||||||
+ for (state = 0; state < CPUSTATES; ++state)
|
|
||||||
+ tot += s.time[state];
|
|
||||||
+ if (tot)
|
|
||||||
+ pct = 100 / tot;
|
|
||||||
+ else
|
|
||||||
+ pct = 0;
|
|
||||||
+ current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
|
|
||||||
+ current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
|
|
||||||
+ current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
|
|
||||||
+
|
|
||||||
+ if (perfmon[FREE_MEM]) {
|
|
||||||
+ if(!first_time_getswap)
|
|
||||||
+ current_values[FREE_MEM] = get_swapspace();
|
|
||||||
+ else {
|
|
||||||
+ current_values[FREE_MEM] = 100;
|
|
||||||
+ first_time_getswap = 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (perfmon[DISK_TRANSFERS])
|
|
||||||
+ current_values[DISK_TRANSFERS] = total_disk_transfers();
|
|
||||||
+ if (perfmon[INTERRUPTS])
|
|
||||||
+ current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
|
|
||||||
+ if (perfmon[INPUT_PACKETS])
|
|
||||||
+ current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
|
|
||||||
+ if (perfmon[OUTPUT_PACKETS])
|
|
||||||
+ current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
|
|
||||||
+ if (perfmon[COLLISION_PACKETS])
|
|
||||||
+ current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
|
|
||||||
+ if (perfmon[NFS_CLIENT_CALLS])
|
|
||||||
+ current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
|
|
||||||
+ if (perfmon[NFS_SERVER_CALLS])
|
|
||||||
+ current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the overall disk transfer rates
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ total_disk_transfers()
|
|
||||||
+ {
|
|
||||||
+ register int i, total_xfers = 0;
|
|
||||||
+
|
|
||||||
+ for(i=0; i < DK_NDRIVE; i++)
|
|
||||||
+ total_xfers += s.xfer[i];
|
|
||||||
+ return(total_xfers/etime);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect all the data
|
|
||||||
+ */
|
|
||||||
+ void
|
|
||||||
+ collect_stats()
|
|
||||||
+ {
|
|
||||||
+ off_t ifnetaddr;
|
|
||||||
+ register int i, tmp;
|
|
||||||
+ int mib[3], size;
|
|
||||||
+
|
|
||||||
+ kread(X_CPTIME, s.time, sizeof(s.time));
|
|
||||||
+ kread(X_DKXFER, s.xfer, sizeof(s.xfer));
|
|
||||||
+ kread(X_SUM, &sum, sizeof(sum) );
|
|
||||||
+
|
|
||||||
+ nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
|
|
||||||
+ if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
|
|
||||||
+ err(1, "xperfmon++ malloc in collect_stats");
|
|
||||||
+ nintr /= sizeof(long);
|
|
||||||
+ kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
|
|
||||||
+ s1.interrupts = s.interrupts;
|
|
||||||
+ s.interrupts = 0;
|
|
||||||
+ for (i = 0; i < nintr; i++)
|
|
||||||
+ s.interrupts += *(intrcnt + i);
|
|
||||||
+
|
|
||||||
+ free(intrcnt);
|
|
||||||
+ etime = 0;
|
|
||||||
+ for (i=0; i < DK_NDRIVE; i++) {
|
|
||||||
+ tmp = s.xfer[i];
|
|
||||||
+ s.xfer[i] -= s1.xfer[i];
|
|
||||||
+ s1.xfer[i] = tmp;
|
|
||||||
+ }
|
|
||||||
+ for (i=0; i < CPUSTATES; i++) {
|
|
||||||
+ tmp = s.time[i];
|
|
||||||
+ s.time[i] -= s1.time[i];
|
|
||||||
+ s1.time[i] = tmp;
|
|
||||||
+ etime += s.time[i];
|
|
||||||
+ }
|
|
||||||
+ if(etime == 0.)
|
|
||||||
+ etime = 1.;
|
|
||||||
+ etime /= hz;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the Network-Traffic
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if (nl[N_IFNET].n_value != 0) {
|
|
||||||
+ struct ifnet ifnet;
|
|
||||||
+ kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
|
||||||
+ old_packets = packets;
|
|
||||||
+ packets.input = packets.output = packets.collisions = 0;
|
|
||||||
+ while (ifnetaddr) {
|
|
||||||
+ kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
|
|
||||||
+ packets.input += ifnet.if_ipackets;
|
|
||||||
+ packets.output += ifnet.if_opackets;
|
|
||||||
+ packets.collisions += ifnet.if_collisions;
|
|
||||||
+ ifnetaddr = (u_long) ifnet.if_next;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the NFS and RPC Calls
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ size = sizeof(nfsstats);
|
|
||||||
+ mib[0] = CTL_FS;
|
|
||||||
+ mib[1] = MOUNT_NFS;
|
|
||||||
+ mib[2] = NFS_NFSSTATS;
|
|
||||||
+
|
|
||||||
+ if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
|
|
||||||
+ return;
|
|
||||||
+ else {
|
|
||||||
+ old_nfsStats = nfsStats;
|
|
||||||
+
|
|
||||||
+ nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_SETATTR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_LOOKUP] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READLINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READ] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_WRITE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_CREATE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_REMOVE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_RENAME] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_LINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_SYMLINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_MKDIR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_RMDIR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READDIR] +
|
|
||||||
+ #ifndef HAS_NFS_V3
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_STATFS] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
|
|
||||||
+ #else /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_FSSTAT] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_FSINFO] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_PATHCONF] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_COMMIT] +
|
|
||||||
+ #endif /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_VACATED] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_EVICTED];
|
|
||||||
+
|
|
||||||
+ nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_SETATTR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READLINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READ] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_WRITE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_CREATE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_REMOVE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_RENAME] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_LINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_MKDIR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_RMDIR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READDIR] +
|
|
||||||
+ #ifndef HAS_NFS_V3
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_STATFS] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
|
|
||||||
+ #else /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_FSINFO] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_COMMIT] +
|
|
||||||
+ #endif /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Reads the nlist from the kernel
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ get_namelist(kernel_name, memory_name)
|
|
||||||
+ const char *kernel_name, *memory_name;
|
|
||||||
+ {
|
|
||||||
+ time_t now;
|
|
||||||
+ time_t boottime;
|
|
||||||
+ register int i, c;
|
|
||||||
+ int nintv;
|
|
||||||
+
|
|
||||||
+ kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
|
|
||||||
+ if (kd == 0) {
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ((c = kvm_nlist(kd, nl)) != 0) {
|
|
||||||
+ if (c > 0) {
|
|
||||||
+ (void)fprintf(stderr,"xperfmon++: undefined symbols:");
|
|
||||||
+ for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
|
|
||||||
+ if (nl[c].n_type == 0)
|
|
||||||
+ fprintf(stderr, " %s", nl[c].n_name);
|
|
||||||
+ (void)fputc('\n', stderr);
|
|
||||||
+ } else
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ kread(X_BOOTTIME, &boottime, sizeof(boottime));
|
|
||||||
+ kread(X_HZ, &hz, sizeof(hz));
|
|
||||||
+ for (i = 0; i < DK_NDRIVE; i++) {
|
|
||||||
+ strcpy(dr_name[i], "xx");
|
|
||||||
+ }
|
|
||||||
+ time(&now);
|
|
||||||
+ nintv = now - boottime;
|
|
||||||
+ if (nintv <= 0 || nintv > 60*60*24*365*10) {
|
|
||||||
+ fprintf(stderr,
|
|
||||||
+ "Time makes no sense... namelist must be wrong.\n");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ return(nintv);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Kread reads something from the kernel, given its nlist index.
|
|
||||||
+ */
|
|
||||||
+ static void
|
|
||||||
+ kread(nlx, addr, size)
|
|
||||||
+ int nlx;
|
|
||||||
+ void *addr;
|
|
||||||
+ size_t size;
|
|
||||||
+ {
|
|
||||||
+ char *sym;
|
|
||||||
+
|
|
||||||
+ if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
|
|
||||||
+ sym = nl[nlx].n_name;
|
|
||||||
+ if (*sym == '_')
|
|
||||||
+ ++sym;
|
|
||||||
+ (void)fprintf(stderr,
|
|
||||||
+ "xpermon++: symbol %s not defined\n", sym);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
|
|
||||||
+ sym = nl[nlx].n_name;
|
|
||||||
+ if (*sym == '_')
|
|
||||||
+ ++sym;
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * get_swapspace is based on a program called swapinfo written
|
|
||||||
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ get_swapspace()
|
|
||||||
+ {
|
|
||||||
+ char *header;
|
|
||||||
+ int hlen, nswap, nswdev, dmmax;
|
|
||||||
+ int i, div, avail, nfree, npfree, used;
|
|
||||||
+ struct swdevt *sw;
|
|
||||||
+ long blocksize, *perdev;
|
|
||||||
+ struct rlist head;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ struct rlisthdr swaplist;
|
|
||||||
+ struct rlist *swapptr;
|
|
||||||
+ #else
|
|
||||||
+ struct rlist *swaplist;
|
|
||||||
+ #endif
|
|
||||||
+ u_long ptr;
|
|
||||||
+ kread(VM_NSWAP, &nswap, sizeof(nswap));
|
|
||||||
+ kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
|
|
||||||
+ kread(VM_DMMAX, &dmmax, sizeof(dmmax));
|
|
||||||
+ kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
|
|
||||||
+ if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
|
|
||||||
+ (perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
|
|
||||||
+ err(1, "xperfmon++ malloc in get_swapspace");
|
|
||||||
+ kread(VM_SWDEVT, &ptr, sizeof(ptr));
|
|
||||||
+ kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
|
|
||||||
+ /* Count up swap space. */
|
|
||||||
+ nfree = 0;
|
|
||||||
+ memset(perdev, 0, nswdev * sizeof(*perdev));
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ swapptr = swaplist.rlh_list;
|
|
||||||
+ while (swapptr) {
|
|
||||||
+ #else
|
|
||||||
+ while (swaplist) {
|
|
||||||
+ #endif
|
|
||||||
+ int top, bottom, next_block;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ kvm_read(kd, (u_long)swapptr, &head, sizeof(struct rlist));
|
|
||||||
+ #else
|
|
||||||
+ kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
|
|
||||||
+ #endif
|
|
||||||
+ top = head.rl_end;
|
|
||||||
+ bottom = head.rl_start;
|
|
||||||
+
|
|
||||||
+ nfree += top - bottom + 1;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Swap space is split up among the configured disks.
|
|
||||||
+ *
|
|
||||||
+ * For interleaved swap devices, the first dmmax blocks
|
|
||||||
+ * of swap space some from the first disk, the next dmmax
|
|
||||||
+ * blocks from the next, and so on up to nswap blocks.
|
|
||||||
+ *
|
|
||||||
+ * The list of free space joins adjacent free blocks,
|
|
||||||
+ * ignoring device boundries. If we want to keep track
|
|
||||||
+ * of this information per device, we'll just have to
|
|
||||||
+ * extract it ourselves.
|
|
||||||
+ */
|
|
||||||
+ while (top / dmmax != bottom / dmmax) {
|
|
||||||
+ next_block = ((bottom + dmmax) / dmmax);
|
|
||||||
+ perdev[(bottom / dmmax) % nswdev] +=
|
|
||||||
+ next_block * dmmax - bottom;
|
|
||||||
+ bottom = next_block * dmmax;
|
|
||||||
+ }
|
|
||||||
+ perdev[(bottom / dmmax) % nswdev] +=
|
|
||||||
+ top - bottom + 1;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ swapptr = head.rl_next;
|
|
||||||
+ #else
|
|
||||||
+ swaplist = head.rl_next;
|
|
||||||
+ #endif
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ header = getbsize(&hlen, &blocksize);
|
|
||||||
+ div = blocksize / 512;
|
|
||||||
+ avail = npfree = 0;
|
|
||||||
+ for (i = 0; i < nswdev; i++) {
|
|
||||||
+ int xsize, xfree;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Don't report statistics for partitions which have not
|
|
||||||
+ * yet been activated via swapon(8).
|
|
||||||
+ */
|
|
||||||
+ if (!(sw[i].sw_flags & SW_FREED))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ /* The first dmmax is never allocated to avoid trashing of
|
|
||||||
+ * disklabels
|
|
||||||
+ */
|
|
||||||
+ xsize = sw[i].sw_nblks - dmmax;
|
|
||||||
+ xfree = perdev[i];
|
|
||||||
+ used = xsize - xfree;
|
|
||||||
+ npfree++;
|
|
||||||
+ avail += xsize;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * If only one partition has been set up via swapon(8), we don't
|
|
||||||
+ * need to bother with totals.
|
|
||||||
+ */
|
|
||||||
+ used = avail - nfree;
|
|
||||||
+
|
|
||||||
+ free(perdev);
|
|
||||||
+ free(sw);
|
|
||||||
+ return((100*nfree)/avail); /* return free swap in percent */
|
|
||||||
+ }
|
|
||||||
diff -cd ../xperfmon++/StripCharP.h ./StripCharP.h
|
|
||||||
*** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
|
||||||
--- ./StripCharP.h Tue Dec 5 09:31:56 1995
|
--- ./StripCharP.h Tue Dec 5 09:31:56 1995
|
||||||
***************
|
***************
|
||||||
|
@ -604,9 +26,9 @@ diff -cd ../xperfmon++/StripCharP.h ./StripCharP.h
|
||||||
Pixel fgpixel; /* color index for graph */
|
Pixel fgpixel; /* color index for graph */
|
||||||
Pixel hipixel; /* color index for lines */
|
Pixel hipixel; /* color index for lines */
|
||||||
Pixel warnColor;
|
Pixel warnColor;
|
||||||
diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
diff -c -N ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
*** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
|
||||||
--- ./StripChart.c Mon May 6 18:26:41 1996
|
--- ./StripChart.c Fri Mar 14 13:31:42 1997
|
||||||
***************
|
***************
|
||||||
*** 53,58 ****
|
*** 53,58 ****
|
||||||
--- 53,70 ----
|
--- 53,70 ----
|
||||||
|
@ -614,17 +36,17 @@ diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
#include <X11/Xaw/XawInit.h>
|
#include <X11/Xaw/XawInit.h>
|
||||||
#include "StripCharP.h"
|
#include "StripCharP.h"
|
||||||
+
|
+
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
+ #if (defined(BSD) && (BSD >= 199306))
|
+ #if (defined(BSD) && (BSD >= 199306))
|
||||||
+ # include <osreldate.h>
|
+ # include <osreldate.h>
|
||||||
+ # include "system.h"
|
|
||||||
+ #else
|
+ #else
|
||||||
+ # error You have to use at least a FreeBSD 2.X system
|
+ # error You have to use at least a FreeBSD 2.X system
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
+ # include "system.h"
|
||||||
#include <X11/Xfuncs.h>
|
#include <X11/Xfuncs.h>
|
||||||
|
|
||||||
#define MS_PER_SEC 100
|
#define MS_PER_SEC 100
|
||||||
|
@ -829,16 +251,16 @@ diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
x = 4;
|
x = 4;
|
||||||
XDS(w->strip_chart.botLabel);
|
XDS(w->strip_chart.botLabel);
|
||||||
}
|
}
|
||||||
diff -cd ../xperfmon++/TimeChart.c ./TimeChart.c
|
diff -c -N ../xperfmon++/TimeChart.c ./TimeChart.c
|
||||||
*** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994
|
*** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994
|
||||||
--- ./TimeChart.c Mon May 6 18:31:06 1996
|
--- ./TimeChart.c Fri Mar 14 13:30:16 1997
|
||||||
***************
|
***************
|
||||||
*** 47,52 ****
|
*** 47,52 ****
|
||||||
--- 47,62 ----
|
--- 47,62 ----
|
||||||
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -851,7 +273,7 @@ diff -cd ../xperfmon++/TimeChart.c ./TimeChart.c
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <X11/IntrinsicP.h>
|
#include <X11/IntrinsicP.h>
|
||||||
#include <X11/StringDefs.h>
|
#include <X11/StringDefs.h>
|
||||||
diff -cd ../xperfmon++/TimeChart.h ./TimeChart.h
|
diff -c -N ../xperfmon++/TimeChart.h ./TimeChart.h
|
||||||
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
|
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
|
||||||
--- ./TimeChart.h Mon Oct 30 12:53:59 1995
|
--- ./TimeChart.h Mon Oct 30 12:53:59 1995
|
||||||
***************
|
***************
|
||||||
|
@ -881,9 +303,9 @@ diff -cd ../xperfmon++/TimeChart.h ./TimeChart.h
|
||||||
#define XtNvmunix "vmunix"
|
#define XtNvmunix "vmunix"
|
||||||
|
|
||||||
typedef struct _TimeChartRec *TimeChartWidget;
|
typedef struct _TimeChartRec *TimeChartWidget;
|
||||||
diff -cd ../xperfmon++/misc.c ./misc.c
|
diff -c -N ../xperfmon++/misc.c ./misc.c
|
||||||
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
|
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
|
||||||
--- ./misc.c Mon May 6 18:31:27 1996
|
--- ./misc.c Fri Mar 14 13:31:48 1997
|
||||||
***************
|
***************
|
||||||
*** 22,27 ****
|
*** 22,27 ****
|
||||||
--- 22,38 ----
|
--- 22,38 ----
|
||||||
|
@ -891,7 +313,7 @@ diff -cd ../xperfmon++/misc.c ./misc.c
|
||||||
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
*/
|
*/
|
||||||
+
|
+
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -921,10 +343,9 @@ diff -cd ../xperfmon++/misc.c ./misc.c
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'q':
|
case 'q':
|
||||||
Only in ../xperfmon++: nfs.c.old
|
diff -c -N ../xperfmon++/system.h ./system.h
|
||||||
diff -cd ../xperfmon++/system.h ./system.h
|
|
||||||
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
|
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
|
||||||
--- ./system.h Mon May 6 18:28:27 1996
|
--- ./system.h Fri Mar 14 13:16:19 1997
|
||||||
***************
|
***************
|
||||||
*** 151,168 ****
|
*** 151,168 ****
|
||||||
--- 151,182 ----
|
--- 151,182 ----
|
||||||
|
@ -992,16 +413,16 @@ diff -cd ../xperfmon++/system.h ./system.h
|
||||||
"Calls",
|
"Calls",
|
||||||
+ #endif
|
+ #endif
|
||||||
};
|
};
|
||||||
diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
diff -c -N ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
|
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
|
||||||
--- ./xperfmon.c Mon May 6 18:27:07 1996
|
--- ./xperfmon.c Fri Mar 14 13:30:50 1997
|
||||||
***************
|
***************
|
||||||
*** 58,63 ****
|
*** 58,63 ****
|
||||||
--- 58,73 ----
|
--- 58,73 ----
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -1250,18 +671,18 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
! newh = MIN_HEIGHT;
|
! newh = MIN_HEIGHT;
|
||||||
! w->core.height = MIN_HEIGHT;
|
! w->core.height = MIN_HEIGHT;
|
||||||
! window_size_changed = TRUE;
|
! 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;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ /* 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 )
|
+ if( neww != oldWidth || newh != oldHeight || window_size_changed == TRUE )
|
||||||
+ XtResizeWindow(w);
|
+ XtResizeWindow(w);
|
||||||
+
|
+
|
||||||
|
@ -1339,6 +760,19 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
char *progname = argv[0];
|
char *progname = argv[0];
|
||||||
Bool foundAnAdd = FALSE;
|
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 ****
|
*** 540,561 ****
|
||||||
xperfmon_width, xperfmon_height));
|
xperfmon_width, xperfmon_height));
|
||||||
XtSetValues(appData.toplevel, &arg, 1);
|
XtSetValues(appData.toplevel, &arg, 1);
|
||||||
|
@ -1362,7 +796,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
XtNjustify, XtJustifyLeft,
|
XtNjustify, XtJustifyLeft,
|
||||||
XtNinternalHeight, 0,
|
XtNinternalHeight, 0,
|
||||||
XtNtop, XtChainTop,
|
XtNtop, XtChainTop,
|
||||||
--- 601,652 ----
|
--- 605,656 ----
|
||||||
xperfmon_width, xperfmon_height));
|
xperfmon_width, xperfmon_height));
|
||||||
XtSetValues(appData.toplevel, &arg, 1);
|
XtSetValues(appData.toplevel, &arg, 1);
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +859,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
XtNupdate, appData.interval*appData.ms_per_sec,
|
XtNupdate, appData.interval*appData.ms_per_sec,
|
||||||
XtNfillRect, (int)appData.fill,
|
XtNfillRect, (int)appData.fill,
|
||||||
XtNjumpScroll, 1,
|
XtNjumpScroll, 1,
|
||||||
--- 661,668 ----
|
--- 665,672 ----
|
||||||
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
|
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
|
||||||
XtNtopLabel, topNames[i],
|
XtNtopLabel, topNames[i],
|
||||||
XtNbotLabel, botNames[i],
|
XtNbotLabel, botNames[i],
|
||||||
|
@ -1457,7 +891,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
- XtRealizeWidget(appData.toplevel);
|
- XtRealizeWidget(appData.toplevel);
|
||||||
XtAppMainLoop(appData.app_context);
|
XtAppMainLoop(appData.app_context);
|
||||||
}
|
}
|
||||||
--- 671,692 ----
|
--- 675,696 ----
|
||||||
}
|
}
|
||||||
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
|
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
|
||||||
XtNfromVert, perfmon[1],
|
XtNfromVert, perfmon[1],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
diff -cd ../xperfmon++/Imakefile ./Imakefile
|
diff -c -N ../xperfmon++/Imakefile ./Imakefile
|
||||||
*** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994
|
*** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994
|
||||||
--- ./Imakefile Mon May 6 18:19:34 1996
|
--- ./Imakefile Fri Mar 14 13:29:51 1997
|
||||||
***************
|
***************
|
||||||
*** 17,31 ****
|
*** 17,31 ****
|
||||||
SYS_MODULE= sgi_system
|
SYS_MODULE= sgi_system
|
||||||
|
@ -26,7 +26,7 @@ diff -cd ../xperfmon++/Imakefile ./Imakefile
|
||||||
! FreeBSDFLAGS= -lkvm
|
! FreeBSDFLAGS= -lkvm
|
||||||
! SYS_MODULE= freebsd_system
|
! SYS_MODULE= freebsd_system
|
||||||
! CC= gcc
|
! CC= gcc
|
||||||
! EXTRA_DEFINES= -D_HAVE_PARAM_H
|
! EXTRA_DEFINES= -DHAVE_SYS_PARAM_H
|
||||||
! #endif
|
! #endif
|
||||||
!
|
!
|
||||||
! EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(FreeBSDFLAGS)
|
! EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(FreeBSDFLAGS)
|
||||||
|
@ -41,31 +41,30 @@ diff -cd ../xperfmon++/Imakefile ./Imakefile
|
||||||
|
|
||||||
ComplexProgramTarget(xperfmon++)
|
ComplexProgramTarget(xperfmon++)
|
||||||
|
|
||||||
diff -cd ../xperfmon++/README ./README
|
diff -c -N ../xperfmon++/README ./README
|
||||||
*** ../xperfmon++/README Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/README Wed Jul 27 22:29:30 1994
|
||||||
--- ./README Sat May 4 10:46:36 1996
|
--- ./README Fri Mar 14 13:59:13 1997
|
||||||
***************
|
***************
|
||||||
*** 18,20 ****
|
*** 18,20 ****
|
||||||
--- 18,52 ----
|
--- 18,61 ----
|
||||||
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 (freebsd_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$B(Bler @University of Rostock, Germany.
|
|
||||||
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 8-16-95 Quick and dirty workaround of -geometry option bug.
|
+ 8-16-95 Quick and dirty workaround of -geometry option bug.
|
||||||
+ But there are still some side effects when changing the geometry.
|
+ But there are still some side effects when changing the geometry.
|
||||||
+ Fix memory leak in bsd_system.c
|
+ Fix memory leak in freebsd_system.c
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system
|
+ 30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system
|
||||||
+ tries to minimize the free unused amount of memory.
|
+ tries to minimize the free unused amount of memory.
|
||||||
+ Include basic support for FreeBSD > 2.1.
|
+ Include basic support for FreeBSD > 2.1.
|
||||||
+ Number of interrupts now independent from 'Update Intervall'
|
+ Number of interrupts now independent from 'Update Intervall'
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 11-12-95 Fix -geometry bug! Now there is only a MIN_WIDTH of 185 pixels, and the
|
+ 11-12-95 Fix -geometry bug! Now there is only a MIN_WIDTH of 185 pixels, and the
|
||||||
|
@ -74,15 +73,25 @@ diff -cd ../xperfmon++/README ./README
|
||||||
+ Change 'Free Swap' graph from absolut into percent values.
|
+ Change 'Free Swap' graph from absolut into percent values.
|
||||||
+ All graphs shoud be independent of the 'Update Intervall'.
|
+ All graphs shoud be independent of the 'Update Intervall'.
|
||||||
+ Modify graph labels and add unit of each graph.
|
+ Modify graph labels and add unit of each graph.
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 5-4-96 Fix some event problems that consumes a lot of cpu power after resizing
|
+ 5-4-96 Fix some event problems that consumes a lot of cpu power after resizing
|
||||||
+ (mwm) or restart of an window manager. Make xperfmon compile with
|
+ (mwm) or restart of an window manager. Make xperfmon compile with
|
||||||
+ FreeBSD-current (2.2, changes in get_swapspace)
|
+ FreeBSD-current (2.2, changes in get_swapspace)
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
diff -cd ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
+
|
||||||
|
+ 3-14-97 Fix some problems with changed structures in 3.0,
|
||||||
|
+ clean up the FreeBSD version numbers #if's.
|
||||||
|
+ Now xperfmon++ should compile from FreeBSD-2.0 up to 3.0-current
|
||||||
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
|
+ Jörg Wunsch, FreeBSD core team menber, Germany
|
||||||
|
+ E-Mail: <joerg_wunsch@uriah.heep.sax.de>
|
||||||
|
+ <joerg@FreeBSD.ORG>
|
||||||
|
+
|
||||||
|
diff -c -N ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
||||||
*** ../xperfmon++/XPerfmon++.ad Wed Jul 27 22:29:32 1994
|
*** ../xperfmon++/XPerfmon++.ad Wed Jul 27 22:29:32 1994
|
||||||
--- ./XPerfmon++.ad Tue Dec 5 09:32:54 1995
|
--- ./XPerfmon++.ad Tue Dec 5 09:32:54 1995
|
||||||
***************
|
***************
|
||||||
|
@ -149,10 +158,9 @@ diff -cd ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
||||||
! *perfChartNFSServer.highAlarm: 200
|
! *perfChartNFSServer.highAlarm: 200
|
||||||
*font: 6x13
|
*font: 6x13
|
||||||
+
|
+
|
||||||
Only in ./: freebsd_system.c
|
diff -c -N ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
|
||||||
*** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994
|
*** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994
|
||||||
--- ./xperfmon++.man Sat May 4 12:00:28 1996
|
--- ./xperfmon++.man Fri Mar 14 14:02:29 1997
|
||||||
***************
|
***************
|
||||||
*** 94,101 ****
|
*** 94,101 ****
|
||||||
.B \-idlecpu | \+idlecpu
|
.B \-idlecpu | \+idlecpu
|
||||||
|
@ -212,7 +220,7 @@ diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
Set Disk Transfer count resource.
|
Set Disk Transfer count resource.
|
||||||
***************
|
***************
|
||||||
*** 395,398 ****
|
*** 395,398 ****
|
||||||
--- 395,413 ----
|
--- 395,421 ----
|
||||||
glad to incorporate the modifications into this master copy. Send me your changes via E-Mail at the
|
glad to incorporate the modifications into this master copy. Send me your changes via E-Mail at the
|
||||||
above address.
|
above address.
|
||||||
.PP
|
.PP
|
||||||
|
@ -226,6 +234,14 @@ diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
+ .I xperfmon++ V1.33 for FreeBSD
|
+ .I xperfmon++ V1.33 for FreeBSD
|
||||||
+ contains some fixes due to event problems and compiles fine under
|
+ contains some fixes due to event problems and compiles fine under
|
||||||
+ FreeBSD 2.2 (changes in get_swapspace).
|
+ FreeBSD 2.2 (changes in get_swapspace).
|
||||||
|
+ Now the -geometry switch works well!
|
||||||
|
+ Please E-Mail any bugs or comments with the subject
|
||||||
|
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
||||||
|
+ .PP
|
||||||
|
+ .I xperfmon++ V1.40 for FreeBSD
|
||||||
|
+ contains some fixes due to changes in the networking structs and
|
||||||
|
+ cleans up the FreeBSD version number #if's. Now it should compile fine
|
||||||
|
+ from FreeBSD 2.0 up to FreeBSD-3.0-current.
|
||||||
+ Please E-Mail any bugs or comments with the subject
|
+ Please E-Mail any bugs or comments with the subject
|
||||||
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
||||||
+ .PP
|
+ .PP
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
--- freebsd_system.c.orig Sun Jan 19 18:43:41 1997
|
|
||||||
+++ freebsd_system.c Sun Jan 19 18:42:59 1997
|
|
||||||
@@ -75,6 +75,7 @@
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#include <sys/buf.h>
|
|
||||||
+#include <sys/time.h>
|
|
||||||
#include <sys/vmmeter.h>
|
|
||||||
#include <vm/vm.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
@@ -310,7 +311,8 @@
|
|
||||||
Collect the Network-Traffic
|
|
||||||
*/
|
|
||||||
|
|
||||||
- if (nl[N_IFNET].n_value != 0) {
|
|
||||||
+ if ((ifnetaddr = nl[N_IFNET].n_value) != 0) {
|
|
||||||
+#if __FreeBSD_version < 300000
|
|
||||||
struct ifnet ifnet;
|
|
||||||
kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
|
||||||
old_packets = packets;
|
|
||||||
@@ -322,6 +324,41 @@
|
|
||||||
packets.collisions += ifnet.if_collisions;
|
|
||||||
ifnetaddr = (u_long) ifnet.if_next;
|
|
||||||
}
|
|
||||||
+#else /* 3.0-* */
|
|
||||||
+ /* Stolen from netstat/if.c */
|
|
||||||
+ struct ifnet ifnet;
|
|
||||||
+ struct ifnethead ifnethead;
|
|
||||||
+ u_long ifaddraddr, ifnetfound;
|
|
||||||
+ struct ifaddr ifa;
|
|
||||||
+
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnethead, sizeof ifnethead) == -1)
|
|
||||||
+ return;
|
|
||||||
+ ifnetaddr = (u_long)ifnethead.tqh_first;
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ old_packets = packets;
|
|
||||||
+ packets.input = packets.output = packets.collisions = 0;
|
|
||||||
+ ifaddraddr = 0;
|
|
||||||
+ while (ifnetaddr || ifaddraddr) {
|
|
||||||
+ if (ifaddraddr == 0) {
|
|
||||||
+ ifnetfound = ifnetaddr;
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
|
||||||
+ return;
|
|
||||||
+ ifnetaddr = (u_long)ifnet.if_link.tqe_next;
|
|
||||||
+ ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first;
|
|
||||||
+ }
|
|
||||||
+ if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) {
|
|
||||||
+ ifaddraddr = 0;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ ifaddraddr = (u_long)ifa.ifa_link.tqe_next;
|
|
||||||
+
|
|
||||||
+ packets.input += ifnet.if_ipackets;
|
|
||||||
+ packets.output += ifnet.if_opackets;
|
|
||||||
+ packets.collisions += ifnet.if_collisions;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
|
@ -1,4 +1,4 @@
|
||||||
This package contains the binary release of xperfmon++ V1.33 a X based
|
This package contains the binary release of xperfmon++ V1.40 a X based
|
||||||
system performance meter for several systems, ported to FreeBSD 2.X.
|
system performance meter for several systems, ported to FreeBSD 2.X.
|
||||||
|
|
||||||
The program monitors user-, system-, idle-cputime, free swap, disk io,
|
The program monitors user-, system-, idle-cputime, free swap, disk io,
|
||||||
|
@ -21,3 +21,10 @@ Changes from xperfmon++ V1.3 to xperfmon++ V1.33:
|
||||||
- Fix event bug when resizing or moving the window.
|
- Fix event bug when resizing or moving the window.
|
||||||
(High cpu consumption when running xperfmon++ with mwm)
|
(High cpu consumption when running xperfmon++ with mwm)
|
||||||
- Changes in get_swapspace to compile with FreeBSD 2.2 (-current)
|
- Changes in get_swapspace to compile with FreeBSD 2.2 (-current)
|
||||||
|
|
||||||
|
Changes from xperfmon++ V1.33 to xperfmon++ V1.40:
|
||||||
|
|
||||||
|
- Fix -geometry option. Changing the size of the window now wokes
|
||||||
|
well. The start frame of the window has the correct size.
|
||||||
|
- Changes in freebsd_system.c to compile with FreeBSD 30-current.
|
||||||
|
- Clean the FreeBSD version number #if's
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
@cwd /usr/X11R6
|
||||||
|
@group kmem
|
||||||
|
@owner bin
|
||||||
|
@mode 2555
|
||||||
bin/xperfmon++
|
bin/xperfmon++
|
||||||
|
@group bin
|
||||||
|
@mode 444
|
||||||
lib/X11/app-defaults/XPerfmon++
|
lib/X11/app-defaults/XPerfmon++
|
||||||
man/man1/xperfmon++.1.gz
|
man/man1/xperfmon++.1.gz
|
||||||
|
|
3
sysutils/xperfmon/scripts/configure
vendored
Normal file
3
sysutils/xperfmon/scripts/configure
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
cp ${FILESDIR}/freebsd_system.c ${WRKSRC}/freebsd_system.c
|
|
@ -1,22 +1,24 @@
|
||||||
# New ports collection makefile for: xperfmon++ V1.3
|
# New ports collection makefile for: xperfmon++ V1.40
|
||||||
# Version required: 1.1
|
# Version required: 1.1
|
||||||
# Date created: 15 December 95
|
# Date created: 14 March 97
|
||||||
# Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
|
# Whom: Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
#
|
#
|
||||||
# $Id: Makefile,v 1.9 1996/05/20 07:32:45 asami Exp $
|
# $Id: Makefile,v 1.6 1995/12/15 11:16:54 Lars Koeller Exp $
|
||||||
#
|
#
|
||||||
|
PREFIX= /usr/X11R6
|
||||||
DISTNAME= xperfmon++
|
DISTNAME= xperfmon++
|
||||||
PKGNAME= xperfmon++-1.33
|
PKGNAME= xperfmon++v1.40
|
||||||
CATEGORIES= sysutils x11
|
USE_IMAKE= yes
|
||||||
|
CATEGORIES+= sysutils x11
|
||||||
|
|
||||||
# In Germany try this
|
# In Germany try this
|
||||||
#MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
|
#MASTER_SITES= ftp://odie.physik2.uni-rostock.de/pub/
|
||||||
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
|
MASTER_SITES= ftp://proteus.arc.nasa.gov/pub/
|
||||||
|
|
||||||
DISTFILES= xperfmon++v1.1.tar.Z
|
DISTFILES= xperfmon++v1.1.tar.Z
|
||||||
|
EXTRACT_ONLY= xperfmon++v1.1.tar.Z
|
||||||
|
|
||||||
MAINTAINER= Lars_Koeller@odie.physik2.uni-rostock.de
|
MAINTAINER= Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
|
||||||
EXTRACT_ONLY= xperfmon++v1.1.tar.Z
|
|
||||||
USE_IMAKE= yes
|
|
||||||
|
|
||||||
.include <bsd.port.mk>
|
.include <bsd.port.mk>
|
||||||
|
|
||||||
|
|
633
sysutils/xperfmon3/files/freebsd_system.c
Normal file
633
sysutils/xperfmon3/files/freebsd_system.c
Normal file
|
@ -0,0 +1,633 @@
|
||||||
|
/*
|
||||||
|
* Perfmon Performance Monitor
|
||||||
|
*
|
||||||
|
* Copyright 1985, Massachusetts Institute of Technology
|
||||||
|
* Copyright 1989, PCS Computer Systeme GmbH, West Germany
|
||||||
|
* Copyright 1994, Sterling Software @ NASA-Ames Research Center
|
||||||
|
* Copyright 1995, Regents of the University of California,
|
||||||
|
* Lars Köller <Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
* documentation for any purpose is hereby granted without fee, 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 PCS and Sterling Software not be used in advertising or
|
||||||
|
* publicity pertaining to distribution of the software without specific,
|
||||||
|
* written prior permission. PCS and Sterling Software makes no representations about the
|
||||||
|
* suitability of this software for any purpose. It is provided "as is"
|
||||||
|
* without express or implied warranty.
|
||||||
|
*
|
||||||
|
* PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & 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.
|
||||||
|
*
|
||||||
|
* Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
|
||||||
|
* Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
|
||||||
|
* tom@meepmeep.pcs.com
|
||||||
|
* 1994 Revision
|
||||||
|
* Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
||||||
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
|
* 1995 FreeBSD 2.x Version
|
||||||
|
* Author: Lars Koeller, Univerity of Rostock, Germany
|
||||||
|
* Lars_Koeller@odie.physik2.uni-rostock.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This file contains only system functions - that is the functions that
|
||||||
|
* get the information the performance monitor is monitoring. No calls
|
||||||
|
* to any X routines should be made here. The reason for doing this is
|
||||||
|
* so that as the X toolkit becomes available and the X window system
|
||||||
|
* improves no changes will have to be made to this file, and as this
|
||||||
|
* program is made available for a new type of machine, only this file
|
||||||
|
* will need to be changed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <X11/IntrinsicP.h>
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <paths.h>
|
||||||
|
#include <kvm.h>
|
||||||
|
#include <nlist.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <sys/dkstat.h>
|
||||||
|
#include <sys/buf.h>
|
||||||
|
#include <sys/vmmeter.h>
|
||||||
|
#include <vm/vm.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#if __FreeBSD_version >= 300000
|
||||||
|
# include <net/if_var.h>
|
||||||
|
#endif
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/conf.h>
|
||||||
|
#include <sys/rlist.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
#include <nfs/nfsv2.h>
|
||||||
|
#include <nfs/rpcv2.h>
|
||||||
|
#include <nfs/nfs.h>
|
||||||
|
|
||||||
|
#ifndef CTL_FS
|
||||||
|
#define CTL_FS CTL_VFS /* compatibility w/ Lite1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It's a mess with all these version numbers:
|
||||||
|
*
|
||||||
|
* 2.0-RELEASE: 199411
|
||||||
|
* 2.1-current's: 199501, 199503
|
||||||
|
* 2.0.5-RELEASE: 199504
|
||||||
|
* 2.2-current before 2.1: 199508
|
||||||
|
* 2.1.0-RELEASE: 199511
|
||||||
|
* 2.2-current before 2.1.5: 199512
|
||||||
|
* 2.1.5-RELEASE: 199607
|
||||||
|
* 2.2-current before 2.1.6: 199608
|
||||||
|
* 2.1.6-RELEASE: 199612
|
||||||
|
* 2.1.7-RELEASE: 199612
|
||||||
|
* 2.2-RELEASE: 220000 (ahhhhh)
|
||||||
|
* 3.0-current as of Feb 1997: 300000 (ohhhhh)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FreeBSD version 2.2 and greater have NFSv3
|
||||||
|
*/
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
# define HAS_NFS_V3
|
||||||
|
#endif /* FreeBSD_version */
|
||||||
|
|
||||||
|
#include "is.h"
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function Prototypes
|
||||||
|
*/
|
||||||
|
static int get_namelist(const char *kernel_name, const char *memory_name);
|
||||||
|
static void kread(int nlx, void *addr, size_t size);
|
||||||
|
static void collect_stats(void);
|
||||||
|
static int total_disk_transfers(void);
|
||||||
|
static int get_swapspace(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Variables & Structs
|
||||||
|
*/
|
||||||
|
static unsigned long *intrcnt;
|
||||||
|
static int nintr, hz;
|
||||||
|
static kvm_t *kd;
|
||||||
|
static char errbuf[_POSIX2_LINE_MAX];
|
||||||
|
static char dr_name[DK_NDRIVE][DK_NAMELEN];
|
||||||
|
static double etime;
|
||||||
|
|
||||||
|
int current_values[NUM_GRAPHS];
|
||||||
|
stat_type stats;
|
||||||
|
|
||||||
|
extern Widget perfmon[NUM_GRAPHS];
|
||||||
|
|
||||||
|
static struct packet {
|
||||||
|
int input, output, collisions;
|
||||||
|
} packets, old_packets;
|
||||||
|
|
||||||
|
static struct nfsstats nfsstats;
|
||||||
|
static struct _nfsStats {
|
||||||
|
int nfsServer, nfsClient;
|
||||||
|
} nfsStats, old_nfsStats;
|
||||||
|
|
||||||
|
struct nlist nl[] = {
|
||||||
|
#define X_CPTIME 0
|
||||||
|
{ "_cp_time" },
|
||||||
|
#define X_SUM 1
|
||||||
|
{ "_cnt" },
|
||||||
|
#define X_BOOTTIME 2
|
||||||
|
{ "_boottime" },
|
||||||
|
#define X_DKXFER 3
|
||||||
|
{ "_dk_xfer" },
|
||||||
|
#define X_HZ 4
|
||||||
|
{ "_hz" },
|
||||||
|
#define N_IFNET 5
|
||||||
|
{ "_ifnet" },
|
||||||
|
#define X_INTRCNT 6
|
||||||
|
{ "_intrcnt" },
|
||||||
|
#define X_EINTRCNT 7
|
||||||
|
{ "_eintrcnt" },
|
||||||
|
#define VM_NSWAP 8
|
||||||
|
{ "_nswap" }, /* size of largest swap device */
|
||||||
|
#define VM_NSWDEV 9
|
||||||
|
{ "_nswdev" }, /* number of swap devices */
|
||||||
|
#define VM_DMMAX 10
|
||||||
|
{ "_dmmax" }, /* maximum size of a swap block */
|
||||||
|
#define VM_SWAPLIST 11
|
||||||
|
{ "_swaplist" },/* list of free swap areas */
|
||||||
|
#define VM_SWDEVT 12
|
||||||
|
{ "_swdevt" }, /* list of swap devices and sizes */
|
||||||
|
{ "" },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
long time[CPUSTATES];
|
||||||
|
long xfer[DK_NDRIVE];
|
||||||
|
struct vmmeter Sum;
|
||||||
|
struct vmmeter Rate;
|
||||||
|
int interrupts;
|
||||||
|
} s, s1;
|
||||||
|
|
||||||
|
int first_time_getswap;
|
||||||
|
|
||||||
|
#define rate s.Rate
|
||||||
|
#define sum s.Sum
|
||||||
|
|
||||||
|
/*
|
||||||
|
This routine does all necessary setting up of structures
|
||||||
|
that will handle system calls.
|
||||||
|
*/
|
||||||
|
void sys_setup()
|
||||||
|
{
|
||||||
|
get_namelist(getbootfile(), _PATH_KMEM);
|
||||||
|
collect_stats();
|
||||||
|
/* hack to enforce a resize of the 'Free Swap' graph
|
||||||
|
without this the left border always displays the first drawn line
|
||||||
|
cause this field isn't resized very often due to slow change of
|
||||||
|
the free swapspace! */
|
||||||
|
first_time_getswap = 1;
|
||||||
|
etime = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Update the data structures
|
||||||
|
*/
|
||||||
|
void update_stats()
|
||||||
|
{
|
||||||
|
int state;
|
||||||
|
double pct, tot;;
|
||||||
|
|
||||||
|
collect_stats();
|
||||||
|
|
||||||
|
tot = 0;
|
||||||
|
for (state = 0; state < CPUSTATES; ++state)
|
||||||
|
tot += s.time[state];
|
||||||
|
if (tot)
|
||||||
|
pct = 100 / tot;
|
||||||
|
else
|
||||||
|
pct = 0;
|
||||||
|
current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
|
||||||
|
current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
|
||||||
|
current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
|
||||||
|
|
||||||
|
if (perfmon[FREE_MEM]) {
|
||||||
|
if(!first_time_getswap)
|
||||||
|
current_values[FREE_MEM] = get_swapspace();
|
||||||
|
else {
|
||||||
|
current_values[FREE_MEM] = 100;
|
||||||
|
first_time_getswap = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (perfmon[DISK_TRANSFERS])
|
||||||
|
current_values[DISK_TRANSFERS] = total_disk_transfers();
|
||||||
|
if (perfmon[INTERRUPTS])
|
||||||
|
current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
|
||||||
|
if (perfmon[INPUT_PACKETS])
|
||||||
|
current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
|
||||||
|
if (perfmon[OUTPUT_PACKETS])
|
||||||
|
current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
|
||||||
|
if (perfmon[COLLISION_PACKETS])
|
||||||
|
current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
|
||||||
|
if (perfmon[NFS_CLIENT_CALLS])
|
||||||
|
current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
|
||||||
|
if (perfmon[NFS_SERVER_CALLS])
|
||||||
|
current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the overall disk transfer rates
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
total_disk_transfers()
|
||||||
|
{
|
||||||
|
register int i, total_xfers = 0;
|
||||||
|
|
||||||
|
for(i=0; i < DK_NDRIVE; i++)
|
||||||
|
total_xfers += s.xfer[i];
|
||||||
|
return(total_xfers/etime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect all the data
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
collect_stats()
|
||||||
|
{
|
||||||
|
off_t ifnetaddr;
|
||||||
|
register int i, tmp;
|
||||||
|
int mib[3], size;
|
||||||
|
|
||||||
|
kread(X_CPTIME, s.time, sizeof(s.time));
|
||||||
|
kread(X_DKXFER, s.xfer, sizeof(s.xfer));
|
||||||
|
kread(X_SUM, &sum, sizeof(sum) );
|
||||||
|
|
||||||
|
nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
|
||||||
|
if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
|
||||||
|
err(1, "xperfmon++ malloc in collect_stats");
|
||||||
|
nintr /= sizeof(long);
|
||||||
|
kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
|
||||||
|
s1.interrupts = s.interrupts;
|
||||||
|
s.interrupts = 0;
|
||||||
|
for (i = 0; i < nintr; i++)
|
||||||
|
s.interrupts += *(intrcnt + i);
|
||||||
|
|
||||||
|
free(intrcnt);
|
||||||
|
etime = 0;
|
||||||
|
for (i=0; i < DK_NDRIVE; i++) {
|
||||||
|
tmp = s.xfer[i];
|
||||||
|
s.xfer[i] -= s1.xfer[i];
|
||||||
|
s1.xfer[i] = tmp;
|
||||||
|
}
|
||||||
|
for (i=0; i < CPUSTATES; i++) {
|
||||||
|
tmp = s.time[i];
|
||||||
|
s.time[i] -= s1.time[i];
|
||||||
|
s1.time[i] = tmp;
|
||||||
|
etime += s.time[i];
|
||||||
|
}
|
||||||
|
if(etime == 0.)
|
||||||
|
etime = 1.;
|
||||||
|
etime /= hz;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the Network-Traffic
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ifnetaddr = nl[N_IFNET].n_value) != 0) {
|
||||||
|
#if __FreeBSD_version < 300000
|
||||||
|
struct ifnet ifnet;
|
||||||
|
kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
||||||
|
old_packets = packets;
|
||||||
|
packets.input = packets.output = packets.collisions = 0;
|
||||||
|
while (ifnetaddr) {
|
||||||
|
kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
|
||||||
|
packets.input += ifnet.if_ipackets;
|
||||||
|
packets.output += ifnet.if_opackets;
|
||||||
|
packets.collisions += ifnet.if_collisions;
|
||||||
|
ifnetaddr = (u_long) ifnet.if_next;
|
||||||
|
}
|
||||||
|
#else /* 3.0-current, Jan 1997 */
|
||||||
|
/* Stolen from netstat/if.c */
|
||||||
|
struct ifnet ifnet;
|
||||||
|
struct ifnethead ifnethead;
|
||||||
|
u_long ifaddraddr, ifnetfound;
|
||||||
|
struct ifaddr ifa;
|
||||||
|
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnethead, sizeof ifnethead) == -1)
|
||||||
|
return;
|
||||||
|
ifnetaddr = (u_long)ifnethead.tqh_first;
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
old_packets = packets;
|
||||||
|
packets.input = packets.output = packets.collisions = 0;
|
||||||
|
ifaddraddr = 0;
|
||||||
|
while (ifnetaddr || ifaddraddr) {
|
||||||
|
if (ifaddraddr == 0) {
|
||||||
|
ifnetfound = ifnetaddr;
|
||||||
|
if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
||||||
|
return;
|
||||||
|
ifnetaddr = (u_long)ifnet.if_link.tqe_next;
|
||||||
|
ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first;
|
||||||
|
}
|
||||||
|
if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) {
|
||||||
|
ifaddraddr = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ifaddraddr = (u_long)ifa.ifa_link.tqe_next;
|
||||||
|
|
||||||
|
packets.input += ifnet.if_ipackets;
|
||||||
|
packets.output += ifnet.if_opackets;
|
||||||
|
packets.collisions += ifnet.if_collisions;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Collect the NFS and RPC Calls
|
||||||
|
*/
|
||||||
|
|
||||||
|
size = sizeof(nfsstats);
|
||||||
|
mib[0] = CTL_FS;
|
||||||
|
mib[1] = MOUNT_NFS;
|
||||||
|
mib[2] = NFS_NFSSTATS;
|
||||||
|
|
||||||
|
if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
old_nfsStats = nfsStats;
|
||||||
|
|
||||||
|
nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_SETATTR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_LOOKUP] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READLINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READ] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_WRITE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_CREATE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_REMOVE] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_RENAME] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_LINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_SYMLINK] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_MKDIR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_RMDIR] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_READDIR] +
|
||||||
|
#ifndef HAS_NFS_V3
|
||||||
|
nfsstats.rpccnt[NFSPROC_STATFS] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
|
||||||
|
#else /* HAS_NFS_V3 */
|
||||||
|
nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_FSSTAT] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_FSINFO] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_PATHCONF] +
|
||||||
|
nfsstats.rpccnt[NFSPROC_COMMIT] +
|
||||||
|
#endif /* HAS_NFS_V3 */
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_VACATED] +
|
||||||
|
nfsstats.rpccnt[NQNFSPROC_EVICTED];
|
||||||
|
|
||||||
|
nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_SETATTR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READLINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READ] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_WRITE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_CREATE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_REMOVE] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_RENAME] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_LINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_MKDIR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_RMDIR] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READDIR] +
|
||||||
|
#ifndef HAS_NFS_V3
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_STATFS] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
|
||||||
|
#else /* HAS_NFS_V3 */
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_FSINFO] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
|
||||||
|
nfsstats.srvrpccnt[NFSPROC_COMMIT] +
|
||||||
|
#endif /* HAS_NFS_V3 */
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
|
||||||
|
nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reads the nlist from the kernel
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
get_namelist(kernel_name, memory_name)
|
||||||
|
const char *kernel_name, *memory_name;
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
time_t boottime;
|
||||||
|
register int i, c;
|
||||||
|
int nintv;
|
||||||
|
|
||||||
|
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
|
||||||
|
if (kd == 0) {
|
||||||
|
(void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((c = kvm_nlist(kd, nl)) != 0) {
|
||||||
|
if (c > 0) {
|
||||||
|
(void)fprintf(stderr,"xperfmon++: undefined symbols:");
|
||||||
|
for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
|
||||||
|
if (nl[c].n_type == 0)
|
||||||
|
fprintf(stderr, " %s", nl[c].n_name);
|
||||||
|
(void)fputc('\n', stderr);
|
||||||
|
} else
|
||||||
|
(void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
kread(X_BOOTTIME, &boottime, sizeof(boottime));
|
||||||
|
kread(X_HZ, &hz, sizeof(hz));
|
||||||
|
for (i = 0; i < DK_NDRIVE; i++) {
|
||||||
|
strcpy(dr_name[i], "xx");
|
||||||
|
}
|
||||||
|
time(&now);
|
||||||
|
nintv = now - boottime;
|
||||||
|
if (nintv <= 0 || nintv > 60*60*24*365*10) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Time makes no sense... namelist must be wrong.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return(nintv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Kread reads something from the kernel, given its nlist index.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
kread(nlx, addr, size)
|
||||||
|
int nlx;
|
||||||
|
void *addr;
|
||||||
|
size_t size;
|
||||||
|
{
|
||||||
|
char *sym;
|
||||||
|
|
||||||
|
if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
|
||||||
|
sym = nl[nlx].n_name;
|
||||||
|
if (*sym == '_')
|
||||||
|
++sym;
|
||||||
|
(void)fprintf(stderr,
|
||||||
|
"xpermon++: symbol %s not defined\n", sym);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
|
||||||
|
sym = nl[nlx].n_name;
|
||||||
|
if (*sym == '_')
|
||||||
|
++sym;
|
||||||
|
(void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get_swapspace is based on a program called swapinfo written
|
||||||
|
* by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
get_swapspace()
|
||||||
|
{
|
||||||
|
char *header;
|
||||||
|
int hlen, nswap, nswdev, dmmax;
|
||||||
|
int i, div, avail, nfree, npfree, used;
|
||||||
|
struct swdevt *sw;
|
||||||
|
long blocksize, *perdev;
|
||||||
|
struct rlist head;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
struct rlisthdr swaplist;
|
||||||
|
struct rlist *swapptr;
|
||||||
|
#else
|
||||||
|
struct rlist *swaplist;
|
||||||
|
#endif
|
||||||
|
u_long ptr;
|
||||||
|
kread(VM_NSWAP, &nswap, sizeof(nswap));
|
||||||
|
kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
|
||||||
|
kread(VM_DMMAX, &dmmax, sizeof(dmmax));
|
||||||
|
kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
|
||||||
|
if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
|
||||||
|
(perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
|
||||||
|
err(1, "xperfmon++ malloc in get_swapspace");
|
||||||
|
kread(VM_SWDEVT, &ptr, sizeof(ptr));
|
||||||
|
kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
|
||||||
|
/* Count up swap space. */
|
||||||
|
nfree = 0;
|
||||||
|
memset(perdev, 0, nswdev * sizeof(*perdev));
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
swapptr = swaplist.rlh_list;
|
||||||
|
while (swapptr) {
|
||||||
|
#else
|
||||||
|
while (swaplist) {
|
||||||
|
#endif
|
||||||
|
int top, bottom, next_block;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
kvm_read(kd, (u_long)swapptr, &head, sizeof(struct rlist));
|
||||||
|
#else
|
||||||
|
kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
|
||||||
|
#endif
|
||||||
|
top = head.rl_end;
|
||||||
|
bottom = head.rl_start;
|
||||||
|
|
||||||
|
nfree += top - bottom + 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Swap space is split up among the configured disks.
|
||||||
|
*
|
||||||
|
* For interleaved swap devices, the first dmmax blocks
|
||||||
|
* of swap space some from the first disk, the next dmmax
|
||||||
|
* blocks from the next, and so on up to nswap blocks.
|
||||||
|
*
|
||||||
|
* The list of free space joins adjacent free blocks,
|
||||||
|
* ignoring device boundries. If we want to keep track
|
||||||
|
* of this information per device, we'll just have to
|
||||||
|
* extract it ourselves.
|
||||||
|
*/
|
||||||
|
while (top / dmmax != bottom / dmmax) {
|
||||||
|
next_block = ((bottom + dmmax) / dmmax);
|
||||||
|
perdev[(bottom / dmmax) % nswdev] +=
|
||||||
|
next_block * dmmax - bottom;
|
||||||
|
bottom = next_block * dmmax;
|
||||||
|
}
|
||||||
|
perdev[(bottom / dmmax) % nswdev] +=
|
||||||
|
top - bottom + 1;
|
||||||
|
#if __FreeBSD_version >= 220000
|
||||||
|
swapptr = head.rl_next;
|
||||||
|
#else
|
||||||
|
swaplist = head.rl_next;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
header = getbsize(&hlen, &blocksize);
|
||||||
|
div = blocksize / 512;
|
||||||
|
avail = npfree = 0;
|
||||||
|
for (i = 0; i < nswdev; i++) {
|
||||||
|
int xsize, xfree;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't report statistics for partitions which have not
|
||||||
|
* yet been activated via swapon(8).
|
||||||
|
*/
|
||||||
|
if (!(sw[i].sw_flags & SW_FREED))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* The first dmmax is never allocated to avoid trashing of
|
||||||
|
* disklabels
|
||||||
|
*/
|
||||||
|
xsize = sw[i].sw_nblks - dmmax;
|
||||||
|
xfree = perdev[i];
|
||||||
|
used = xsize - xfree;
|
||||||
|
npfree++;
|
||||||
|
avail += xsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If only one partition has been set up via swapon(8), we don't
|
||||||
|
* need to bother with totals.
|
||||||
|
*/
|
||||||
|
used = avail - nfree;
|
||||||
|
|
||||||
|
free(perdev);
|
||||||
|
free(sw);
|
||||||
|
return((100*nfree)/avail); /* return free swap in percent */
|
||||||
|
}
|
|
@ -1,582 +1,4 @@
|
||||||
diff -c -N ../xperfmon++/freebsd_system.c ./freebsd_system.c
|
diff -c -N ../xperfmon++/StripCharP.h ./StripCharP.h
|
||||||
*** ../xperfmon++/freebsd_system.c Thu Jan 1 01:00:00 1970
|
|
||||||
--- ./freebsd_system.c Sun Sep 22 17:14:41 1996
|
|
||||||
***************
|
|
||||||
*** 0 ****
|
|
||||||
--- 1,572 ----
|
|
||||||
+ /*
|
|
||||||
+ * Perfmon Performance Monitor
|
|
||||||
+ *
|
|
||||||
+ * Copyright 1985, Massachusetts Institute of Technology
|
|
||||||
+ * Copyright 1989, PCS Computer Systeme GmbH, West Germany
|
|
||||||
+ * Copyright 1994, Sterling Software @ NASA-Ames Research Center
|
|
||||||
+ * Copyright 1995, Regents of the University of California,
|
|
||||||
+ * Lars Koeller <Lars_Koeller@odie.physik2.uni-rostock.de
|
|
||||||
+ *
|
|
||||||
+ * Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
+ * documentation for any purpose is hereby granted without fee, 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 PCS and Sterling Software not be used in advertising or
|
|
||||||
+ * publicity pertaining to distribution of the software without specific,
|
|
||||||
+ * written prior permission. PCS and Sterling Software makes no representations about the
|
|
||||||
+ * suitability of this software for any purpose. It is provided "as is"
|
|
||||||
+ * without express or implied warranty.
|
|
||||||
+ *
|
|
||||||
+ * PCS & STERLING SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
||||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PCS & 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.
|
|
||||||
+ *
|
|
||||||
+ * Original Author: Emanuel Jay Berkenbilt, MIT Project Athena
|
|
||||||
+ * Author: Thomas A. Baghli, PCS Computer Systeme GmbH, West Germany
|
|
||||||
+ * tom@meepmeep.pcs.com
|
|
||||||
+ * 1994 Revision
|
|
||||||
+ * Author: Roger Smith, Sterling Software @ NASA-Ames Research Center
|
|
||||||
+ * Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
|
||||||
+ * 1995 FreeBSD 2.x Version
|
|
||||||
+ * Author: Lars Koeller, Univerity of Rostock, Germany
|
|
||||||
+ * Lars_Koeller@odie.physik2.uni-rostock.de
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ /* This file contains only system functions - that is the functions that
|
|
||||||
+ * get the information the performance monitor is monitoring. No calls
|
|
||||||
+ * to any X routines should be made here. The reason for doing this is
|
|
||||||
+ * so that as the X toolkit becomes available and the X window system
|
|
||||||
+ * improves no changes will have to be made to this file, and as this
|
|
||||||
+ * program is made available for a new type of machine, only this file
|
|
||||||
+ * will need to be changed.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ #ifdef _HAVE_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 <X11/IntrinsicP.h>
|
|
||||||
+
|
|
||||||
+ #include "system.h"
|
|
||||||
+
|
|
||||||
+ #include <stdio.h>
|
|
||||||
+ #include <stdlib.h>
|
|
||||||
+ #include <strings.h>
|
|
||||||
+ #include <unistd.h>
|
|
||||||
+ #include <paths.h>
|
|
||||||
+ #include <kvm.h>
|
|
||||||
+ #include <nlist.h>
|
|
||||||
+ #include <limits.h>
|
|
||||||
+ #include <errno.h>
|
|
||||||
+ #include <err.h>
|
|
||||||
+
|
|
||||||
+ #include <sys/file.h>
|
|
||||||
+ #include <sys/param.h>
|
|
||||||
+ #include <sys/socket.h>
|
|
||||||
+ #include <sys/sysctl.h>
|
|
||||||
+ #include <sys/dkstat.h>
|
|
||||||
+ #include <sys/buf.h>
|
|
||||||
+ #include <sys/vmmeter.h>
|
|
||||||
+ #include <vm/vm.h>
|
|
||||||
+ #include <net/if.h>
|
|
||||||
+ #include <netinet/in.h>
|
|
||||||
+ #include <sys/stat.h>
|
|
||||||
+ #include <sys/conf.h>
|
|
||||||
+ #include <sys/rlist.h>
|
|
||||||
+ #include <sys/mount.h>
|
|
||||||
+ #include <nfs/nfsv2.h>
|
|
||||||
+ #include <nfs/nfs.h>
|
|
||||||
+
|
|
||||||
+ #ifndef CTL_FS
|
|
||||||
+ #define CTL_FS CTL_VFS /* compatibility w/ Lite1 */
|
|
||||||
+ #endif
|
|
||||||
+
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ # define HAS_NFS_V3
|
|
||||||
+ #endif /* FreeBSD_version */
|
|
||||||
+
|
|
||||||
+ #include "is.h"
|
|
||||||
+
|
|
||||||
+ #ifndef TRUE
|
|
||||||
+ #define TRUE 1
|
|
||||||
+ #define FALSE 0
|
|
||||||
+ #endif
|
|
||||||
+
|
|
||||||
+ #define WANT_STAT(x) (poss_stats[(x)] != NO_STAT)
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Function Prototypes
|
|
||||||
+ */
|
|
||||||
+ static int get_namelist(const char *kernel_name, const char *memory_name);
|
|
||||||
+ static void kread(int nlx, void *addr, size_t size);
|
|
||||||
+ static void collect_stats(void);
|
|
||||||
+ static int total_disk_transfers(void);
|
|
||||||
+ static int get_swapspace(void);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Variables & Structs
|
|
||||||
+ */
|
|
||||||
+ static unsigned long *intrcnt;
|
|
||||||
+ static int nintr, hz;
|
|
||||||
+ static kvm_t *kd;
|
|
||||||
+ static char errbuf[_POSIX2_LINE_MAX];
|
|
||||||
+ static char dr_name[DK_NDRIVE][DK_NAMELEN];
|
|
||||||
+ static double etime;
|
|
||||||
+
|
|
||||||
+ int current_values[NUM_GRAPHS];
|
|
||||||
+ stat_type stats;
|
|
||||||
+
|
|
||||||
+ extern Widget perfmon[NUM_GRAPHS];
|
|
||||||
+
|
|
||||||
+ static struct packet {
|
|
||||||
+ int input, output, collisions;
|
|
||||||
+ } packets, old_packets;
|
|
||||||
+
|
|
||||||
+ static struct nfsstats nfsstats;
|
|
||||||
+ static struct _nfsStats {
|
|
||||||
+ int nfsServer, nfsClient;
|
|
||||||
+ } nfsStats, old_nfsStats;
|
|
||||||
+
|
|
||||||
+ struct nlist nl[] = {
|
|
||||||
+ #define X_CPTIME 0
|
|
||||||
+ { "_cp_time" },
|
|
||||||
+ #define X_SUM 1
|
|
||||||
+ { "_cnt" },
|
|
||||||
+ #define X_BOOTTIME 2
|
|
||||||
+ { "_boottime" },
|
|
||||||
+ #define X_DKXFER 3
|
|
||||||
+ { "_dk_xfer" },
|
|
||||||
+ #define X_HZ 4
|
|
||||||
+ { "_hz" },
|
|
||||||
+ #define N_IFNET 5
|
|
||||||
+ { "_ifnet" },
|
|
||||||
+ #define X_INTRCNT 6
|
|
||||||
+ { "_intrcnt" },
|
|
||||||
+ #define X_EINTRCNT 7
|
|
||||||
+ { "_eintrcnt" },
|
|
||||||
+ #define VM_NSWAP 8
|
|
||||||
+ { "_nswap" }, /* size of largest swap device */
|
|
||||||
+ #define VM_NSWDEV 9
|
|
||||||
+ { "_nswdev" }, /* number of swap devices */
|
|
||||||
+ #define VM_DMMAX 10
|
|
||||||
+ { "_dmmax" }, /* maximum size of a swap block */
|
|
||||||
+ #define VM_SWAPLIST 11
|
|
||||||
+ { "_swaplist" },/* list of free swap areas */
|
|
||||||
+ #define VM_SWDEVT 12
|
|
||||||
+ { "_swdevt" }, /* list of swap devices and sizes */
|
|
||||||
+ { "" },
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ struct {
|
|
||||||
+ long time[CPUSTATES];
|
|
||||||
+ long xfer[DK_NDRIVE];
|
|
||||||
+ struct vmmeter Sum;
|
|
||||||
+ struct vmmeter Rate;
|
|
||||||
+ int interrupts;
|
|
||||||
+ } s, s1;
|
|
||||||
+
|
|
||||||
+ int first_time_getswap;
|
|
||||||
+
|
|
||||||
+ #define rate s.Rate
|
|
||||||
+ #define sum s.Sum
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ This routine does all necessary setting up of structures
|
|
||||||
+ that will handle system calls.
|
|
||||||
+ */
|
|
||||||
+ void sys_setup()
|
|
||||||
+ {
|
|
||||||
+ get_namelist(getbootfile(), _PATH_KMEM);
|
|
||||||
+ collect_stats();
|
|
||||||
+ /* hack to enforce a resize of the 'Free Swap' graph
|
|
||||||
+ without this the left border always displays the first drawn line
|
|
||||||
+ cause this field isn't resized very often due to slow change of
|
|
||||||
+ the free swapspace! */
|
|
||||||
+ first_time_getswap = 1;
|
|
||||||
+ etime = 1.0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Update the data structures
|
|
||||||
+ */
|
|
||||||
+ void update_stats()
|
|
||||||
+ {
|
|
||||||
+ int state;
|
|
||||||
+ double pct, tot;;
|
|
||||||
+
|
|
||||||
+ collect_stats();
|
|
||||||
+
|
|
||||||
+ tot = 0;
|
|
||||||
+ for (state = 0; state < CPUSTATES; ++state)
|
|
||||||
+ tot += s.time[state];
|
|
||||||
+ if (tot)
|
|
||||||
+ pct = 100 / tot;
|
|
||||||
+ else
|
|
||||||
+ pct = 0;
|
|
||||||
+ current_values[USER_CPU_PERCENTAGE] = (s.time[CP_USER] + s.time[CP_NICE]) * pct;
|
|
||||||
+ current_values[SYSTEM_CPU_PERCENTAGE] = (s.time[CP_SYS] + s.time[CP_INTR]) * pct;;
|
|
||||||
+ current_values[IDLE_CPU_PERCENTAGE] = s.time[CP_IDLE] * pct;
|
|
||||||
+
|
|
||||||
+ if (perfmon[FREE_MEM]) {
|
|
||||||
+ if(!first_time_getswap)
|
|
||||||
+ current_values[FREE_MEM] = get_swapspace();
|
|
||||||
+ else {
|
|
||||||
+ current_values[FREE_MEM] = 100;
|
|
||||||
+ first_time_getswap = 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (perfmon[DISK_TRANSFERS])
|
|
||||||
+ current_values[DISK_TRANSFERS] = total_disk_transfers();
|
|
||||||
+ if (perfmon[INTERRUPTS])
|
|
||||||
+ current_values[INTERRUPTS] = (s.interrupts - s1.interrupts)/etime;
|
|
||||||
+ if (perfmon[INPUT_PACKETS])
|
|
||||||
+ current_values[INPUT_PACKETS] = (packets.input - old_packets.input)/etime;
|
|
||||||
+ if (perfmon[OUTPUT_PACKETS])
|
|
||||||
+ current_values[OUTPUT_PACKETS] = (packets.output - old_packets.output)/etime;
|
|
||||||
+ if (perfmon[COLLISION_PACKETS])
|
|
||||||
+ current_values[COLLISION_PACKETS] = (packets.collisions - old_packets.collisions)/etime;
|
|
||||||
+ if (perfmon[NFS_CLIENT_CALLS])
|
|
||||||
+ current_values[NFS_CLIENT_CALLS] = (nfsStats.nfsClient - old_nfsStats.nfsClient)/etime;
|
|
||||||
+ if (perfmon[NFS_SERVER_CALLS])
|
|
||||||
+ current_values[NFS_SERVER_CALLS] = (nfsStats.nfsServer - old_nfsStats.nfsServer)/etime;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the overall disk transfer rates
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ total_disk_transfers()
|
|
||||||
+ {
|
|
||||||
+ register int i, total_xfers = 0;
|
|
||||||
+
|
|
||||||
+ for(i=0; i < DK_NDRIVE; i++)
|
|
||||||
+ total_xfers += s.xfer[i];
|
|
||||||
+ return(total_xfers/etime);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect all the data
|
|
||||||
+ */
|
|
||||||
+ void
|
|
||||||
+ collect_stats()
|
|
||||||
+ {
|
|
||||||
+ off_t ifnetaddr;
|
|
||||||
+ register int i, tmp;
|
|
||||||
+ int mib[3], size;
|
|
||||||
+
|
|
||||||
+ kread(X_CPTIME, s.time, sizeof(s.time));
|
|
||||||
+ kread(X_DKXFER, s.xfer, sizeof(s.xfer));
|
|
||||||
+ kread(X_SUM, &sum, sizeof(sum) );
|
|
||||||
+
|
|
||||||
+ nintr = nl[X_EINTRCNT].n_value - nl[X_INTRCNT].n_value;
|
|
||||||
+ if ((intrcnt = (unsigned long *) malloc((size_t) nintr)) == NULL)
|
|
||||||
+ err(1, "xperfmon++ malloc in collect_stats");
|
|
||||||
+ nintr /= sizeof(long);
|
|
||||||
+ kread(X_INTRCNT, intrcnt, (size_t) nintr*sizeof(long));
|
|
||||||
+ s1.interrupts = s.interrupts;
|
|
||||||
+ s.interrupts = 0;
|
|
||||||
+ for (i = 0; i < nintr; i++)
|
|
||||||
+ s.interrupts += *(intrcnt + i);
|
|
||||||
+
|
|
||||||
+ free(intrcnt);
|
|
||||||
+ etime = 0;
|
|
||||||
+ for (i=0; i < DK_NDRIVE; i++) {
|
|
||||||
+ tmp = s.xfer[i];
|
|
||||||
+ s.xfer[i] -= s1.xfer[i];
|
|
||||||
+ s1.xfer[i] = tmp;
|
|
||||||
+ }
|
|
||||||
+ for (i=0; i < CPUSTATES; i++) {
|
|
||||||
+ tmp = s.time[i];
|
|
||||||
+ s.time[i] -= s1.time[i];
|
|
||||||
+ s1.time[i] = tmp;
|
|
||||||
+ etime += s.time[i];
|
|
||||||
+ }
|
|
||||||
+ if(etime == 0.)
|
|
||||||
+ etime = 1.;
|
|
||||||
+ etime /= hz;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the Network-Traffic
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if (nl[N_IFNET].n_value != 0) {
|
|
||||||
+ struct ifnet ifnet;
|
|
||||||
+ kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
|
||||||
+ old_packets = packets;
|
|
||||||
+ packets.input = packets.output = packets.collisions = 0;
|
|
||||||
+ while (ifnetaddr) {
|
|
||||||
+ kvm_read(kd, ifnetaddr, &ifnet, sizeof ifnet );
|
|
||||||
+ packets.input += ifnet.if_ipackets;
|
|
||||||
+ packets.output += ifnet.if_opackets;
|
|
||||||
+ packets.collisions += ifnet.if_collisions;
|
|
||||||
+ ifnetaddr = (u_long) ifnet.if_next;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Collect the NFS and RPC Calls
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ size = sizeof(nfsstats);
|
|
||||||
+ mib[0] = CTL_FS;
|
|
||||||
+ mib[1] = MOUNT_NFS;
|
|
||||||
+ mib[2] = NFS_NFSSTATS;
|
|
||||||
+
|
|
||||||
+ if (sysctl( mib, 3, &nfsstats, &size, NULL, 0) < 0)
|
|
||||||
+ return;
|
|
||||||
+ else {
|
|
||||||
+ old_nfsStats = nfsStats;
|
|
||||||
+
|
|
||||||
+ nfsStats.nfsClient = nfsstats.rpccnt[NFSPROC_GETATTR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_SETATTR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_LOOKUP] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READLINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READ] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_WRITE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_CREATE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_REMOVE] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_RENAME] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_LINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_SYMLINK] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_MKDIR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_RMDIR] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READDIR] +
|
|
||||||
+ #ifndef HAS_NFS_V3
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_STATFS] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_READDIRLOOK] +
|
|
||||||
+ #else /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_READDIRPLUS] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_FSSTAT] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_FSINFO] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_PATHCONF] +
|
|
||||||
+ nfsstats.rpccnt[NFSPROC_COMMIT] +
|
|
||||||
+ #endif /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_GETLEASE] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_VACATED] +
|
|
||||||
+ nfsstats.rpccnt[NQNFSPROC_EVICTED];
|
|
||||||
+
|
|
||||||
+ nfsStats.nfsServer = nfsstats.srvrpccnt[NFSPROC_GETATTR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_SETATTR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_LOOKUP] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READLINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READ] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_WRITE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_CREATE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_REMOVE] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_RENAME] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_LINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_SYMLINK] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_MKDIR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_RMDIR] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READDIR] +
|
|
||||||
+ #ifndef HAS_NFS_V3
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_STATFS] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_READDIRLOOK] +
|
|
||||||
+ #else /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_FSSTAT] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_FSINFO] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_PATHCONF] +
|
|
||||||
+ nfsstats.srvrpccnt[NFSPROC_COMMIT] +
|
|
||||||
+ #endif /* HAS_NFS_V3 */
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_GETLEASE] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_VACATED] +
|
|
||||||
+ nfsstats.srvrpccnt[NQNFSPROC_EVICTED];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Reads the nlist from the kernel
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ get_namelist(kernel_name, memory_name)
|
|
||||||
+ const char *kernel_name, *memory_name;
|
|
||||||
+ {
|
|
||||||
+ time_t now;
|
|
||||||
+ time_t boottime;
|
|
||||||
+ register int i, c;
|
|
||||||
+ int nintv;
|
|
||||||
+
|
|
||||||
+ kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
|
|
||||||
+ if (kd == 0) {
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: kvm_openfiles: %s\n", errbuf);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ((c = kvm_nlist(kd, nl)) != 0) {
|
|
||||||
+ if (c > 0) {
|
|
||||||
+ (void)fprintf(stderr,"xperfmon++: undefined symbols:");
|
|
||||||
+ for (c = 0; c < sizeof(nl)/sizeof(nl[0]); c++)
|
|
||||||
+ if (nl[c].n_type == 0)
|
|
||||||
+ fprintf(stderr, " %s", nl[c].n_name);
|
|
||||||
+ (void)fputc('\n', stderr);
|
|
||||||
+ } else
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: kvm_nlist: %s\n", kvm_geterr(kd)); exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ kread(X_BOOTTIME, &boottime, sizeof(boottime));
|
|
||||||
+ kread(X_HZ, &hz, sizeof(hz));
|
|
||||||
+ for (i = 0; i < DK_NDRIVE; i++) {
|
|
||||||
+ strcpy(dr_name[i], "xx");
|
|
||||||
+ }
|
|
||||||
+ time(&now);
|
|
||||||
+ nintv = now - boottime;
|
|
||||||
+ if (nintv <= 0 || nintv > 60*60*24*365*10) {
|
|
||||||
+ fprintf(stderr,
|
|
||||||
+ "Time makes no sense... namelist must be wrong.\n");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ return(nintv);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ Kread reads something from the kernel, given its nlist index.
|
|
||||||
+ */
|
|
||||||
+ static void
|
|
||||||
+ kread(nlx, addr, size)
|
|
||||||
+ int nlx;
|
|
||||||
+ void *addr;
|
|
||||||
+ size_t size;
|
|
||||||
+ {
|
|
||||||
+ char *sym;
|
|
||||||
+
|
|
||||||
+ if (nl[nlx].n_type == 0 || nl[nlx].n_value == 0) {
|
|
||||||
+ sym = nl[nlx].n_name;
|
|
||||||
+ if (*sym == '_')
|
|
||||||
+ ++sym;
|
|
||||||
+ (void)fprintf(stderr,
|
|
||||||
+ "xpermon++: symbol %s not defined\n", sym);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ if (kvm_read(kd, nl[nlx].n_value, addr, size) != size) {
|
|
||||||
+ sym = nl[nlx].n_name;
|
|
||||||
+ if (*sym == '_')
|
|
||||||
+ ++sym;
|
|
||||||
+ (void)fprintf(stderr, "xperfmon++: %s: %s\n", sym, kvm_geterr(kd));
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * get_swapspace is based on a program called swapinfo written
|
|
||||||
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
|
|
||||||
+ */
|
|
||||||
+ int
|
|
||||||
+ get_swapspace()
|
|
||||||
+ {
|
|
||||||
+ char *header;
|
|
||||||
+ int hlen, nswap, nswdev, dmmax;
|
|
||||||
+ int i, div, avail, nfree, npfree, used;
|
|
||||||
+ struct swdevt *sw;
|
|
||||||
+ long blocksize, *perdev;
|
|
||||||
+ struct rlist head;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ struct rlisthdr swaplist;
|
|
||||||
+ struct rlist *swapptr;
|
|
||||||
+ #else
|
|
||||||
+ struct rlist *swaplist;
|
|
||||||
+ #endif
|
|
||||||
+ u_long ptr;
|
|
||||||
+ kread(VM_NSWAP, &nswap, sizeof(nswap));
|
|
||||||
+ kread(VM_NSWDEV, &nswdev, sizeof(nswdev));
|
|
||||||
+ kread(VM_DMMAX, &dmmax, sizeof(dmmax));
|
|
||||||
+ kread(VM_SWAPLIST, &swaplist, sizeof(swaplist));
|
|
||||||
+ if ((sw = malloc(nswdev * sizeof(*sw))) == NULL ||
|
|
||||||
+ (perdev = malloc(nswdev * sizeof(*perdev))) == NULL)
|
|
||||||
+ err(1, "xperfmon++ malloc in get_swapspace");
|
|
||||||
+ kread(VM_SWDEVT, &ptr, sizeof(ptr));
|
|
||||||
+ kvm_read(kd, ptr, sw, nswdev * sizeof(*sw));
|
|
||||||
+ /* Count up swap space. */
|
|
||||||
+ nfree = 0;
|
|
||||||
+ memset(perdev, 0, nswdev * sizeof(*perdev));
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ swapptr = swaplist.rlh_list;
|
|
||||||
+ while (swapptr) {
|
|
||||||
+ #else
|
|
||||||
+ while (swaplist) {
|
|
||||||
+ #endif
|
|
||||||
+ int top, bottom, next_block;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ kvm_read(kd, (u_long)swapptr, &head, sizeof(struct rlist));
|
|
||||||
+ #else
|
|
||||||
+ kvm_read(kd, (u_long)swaplist, &head, sizeof(struct rlist));
|
|
||||||
+ #endif
|
|
||||||
+ top = head.rl_end;
|
|
||||||
+ bottom = head.rl_start;
|
|
||||||
+
|
|
||||||
+ nfree += top - bottom + 1;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Swap space is split up among the configured disks.
|
|
||||||
+ *
|
|
||||||
+ * For interleaved swap devices, the first dmmax blocks
|
|
||||||
+ * of swap space some from the first disk, the next dmmax
|
|
||||||
+ * blocks from the next, and so on up to nswap blocks.
|
|
||||||
+ *
|
|
||||||
+ * The list of free space joins adjacent free blocks,
|
|
||||||
+ * ignoring device boundries. If we want to keep track
|
|
||||||
+ * of this information per device, we'll just have to
|
|
||||||
+ * extract it ourselves.
|
|
||||||
+ */
|
|
||||||
+ while (top / dmmax != bottom / dmmax) {
|
|
||||||
+ next_block = ((bottom + dmmax) / dmmax);
|
|
||||||
+ perdev[(bottom / dmmax) % nswdev] +=
|
|
||||||
+ next_block * dmmax - bottom;
|
|
||||||
+ bottom = next_block * dmmax;
|
|
||||||
+ }
|
|
||||||
+ perdev[(bottom / dmmax) % nswdev] +=
|
|
||||||
+ top - bottom + 1;
|
|
||||||
+ #if __FreeBSD_version >= 220000
|
|
||||||
+ swapptr = head.rl_next;
|
|
||||||
+ #else
|
|
||||||
+ swaplist = head.rl_next;
|
|
||||||
+ #endif
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ header = getbsize(&hlen, &blocksize);
|
|
||||||
+ div = blocksize / 512;
|
|
||||||
+ avail = npfree = 0;
|
|
||||||
+ for (i = 0; i < nswdev; i++) {
|
|
||||||
+ int xsize, xfree;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Don't report statistics for partitions which have not
|
|
||||||
+ * yet been activated via swapon(8).
|
|
||||||
+ */
|
|
||||||
+ if (!(sw[i].sw_flags & SW_FREED))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ /* The first dmmax is never allocated to avoid trashing of
|
|
||||||
+ * disklabels
|
|
||||||
+ */
|
|
||||||
+ xsize = sw[i].sw_nblks - dmmax;
|
|
||||||
+ xfree = perdev[i];
|
|
||||||
+ used = xsize - xfree;
|
|
||||||
+ npfree++;
|
|
||||||
+ avail += xsize;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * If only one partition has been set up via swapon(8), we don't
|
|
||||||
+ * need to bother with totals.
|
|
||||||
+ */
|
|
||||||
+ used = avail - nfree;
|
|
||||||
+
|
|
||||||
+ free(perdev);
|
|
||||||
+ free(sw);
|
|
||||||
+ return((100*nfree)/avail); /* return free swap in percent */
|
|
||||||
+ }
|
|
||||||
diff -cd ../xperfmon++/StripCharP.h ./StripCharP.h
|
|
||||||
*** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/StripCharP.h Wed Jul 27 22:29:30 1994
|
||||||
--- ./StripCharP.h Tue Dec 5 09:31:56 1995
|
--- ./StripCharP.h Tue Dec 5 09:31:56 1995
|
||||||
***************
|
***************
|
||||||
|
@ -604,9 +26,9 @@ diff -cd ../xperfmon++/StripCharP.h ./StripCharP.h
|
||||||
Pixel fgpixel; /* color index for graph */
|
Pixel fgpixel; /* color index for graph */
|
||||||
Pixel hipixel; /* color index for lines */
|
Pixel hipixel; /* color index for lines */
|
||||||
Pixel warnColor;
|
Pixel warnColor;
|
||||||
diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
diff -c -N ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
*** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/StripChart.c Wed Jul 27 22:29:30 1994
|
||||||
--- ./StripChart.c Mon May 6 18:26:41 1996
|
--- ./StripChart.c Fri Mar 14 13:31:42 1997
|
||||||
***************
|
***************
|
||||||
*** 53,58 ****
|
*** 53,58 ****
|
||||||
--- 53,70 ----
|
--- 53,70 ----
|
||||||
|
@ -614,17 +36,17 @@ diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
#include <X11/Xaw/XawInit.h>
|
#include <X11/Xaw/XawInit.h>
|
||||||
#include "StripCharP.h"
|
#include "StripCharP.h"
|
||||||
+
|
+
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
+ #if (defined(BSD) && (BSD >= 199306))
|
+ #if (defined(BSD) && (BSD >= 199306))
|
||||||
+ # include <osreldate.h>
|
+ # include <osreldate.h>
|
||||||
+ # include "system.h"
|
|
||||||
+ #else
|
+ #else
|
||||||
+ # error You have to use at least a FreeBSD 2.X system
|
+ # error You have to use at least a FreeBSD 2.X system
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
+ # include "system.h"
|
||||||
#include <X11/Xfuncs.h>
|
#include <X11/Xfuncs.h>
|
||||||
|
|
||||||
#define MS_PER_SEC 100
|
#define MS_PER_SEC 100
|
||||||
|
@ -829,16 +251,16 @@ diff -cd ../xperfmon++/StripChart.c ./StripChart.c
|
||||||
x = 4;
|
x = 4;
|
||||||
XDS(w->strip_chart.botLabel);
|
XDS(w->strip_chart.botLabel);
|
||||||
}
|
}
|
||||||
diff -cd ../xperfmon++/TimeChart.c ./TimeChart.c
|
diff -c -N ../xperfmon++/TimeChart.c ./TimeChart.c
|
||||||
*** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994
|
*** ../xperfmon++/TimeChart.c Wed Jul 27 22:29:31 1994
|
||||||
--- ./TimeChart.c Mon May 6 18:31:06 1996
|
--- ./TimeChart.c Fri Mar 14 13:30:16 1997
|
||||||
***************
|
***************
|
||||||
*** 47,52 ****
|
*** 47,52 ****
|
||||||
--- 47,62 ----
|
--- 47,62 ----
|
||||||
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -851,7 +273,7 @@ diff -cd ../xperfmon++/TimeChart.c ./TimeChart.c
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <X11/IntrinsicP.h>
|
#include <X11/IntrinsicP.h>
|
||||||
#include <X11/StringDefs.h>
|
#include <X11/StringDefs.h>
|
||||||
diff -cd ../xperfmon++/TimeChart.h ./TimeChart.h
|
diff -c -N ../xperfmon++/TimeChart.h ./TimeChart.h
|
||||||
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
|
*** ../xperfmon++/TimeChart.h Wed Jul 27 22:29:31 1994
|
||||||
--- ./TimeChart.h Mon Oct 30 12:53:59 1995
|
--- ./TimeChart.h Mon Oct 30 12:53:59 1995
|
||||||
***************
|
***************
|
||||||
|
@ -881,9 +303,9 @@ diff -cd ../xperfmon++/TimeChart.h ./TimeChart.h
|
||||||
#define XtNvmunix "vmunix"
|
#define XtNvmunix "vmunix"
|
||||||
|
|
||||||
typedef struct _TimeChartRec *TimeChartWidget;
|
typedef struct _TimeChartRec *TimeChartWidget;
|
||||||
diff -cd ../xperfmon++/misc.c ./misc.c
|
diff -c -N ../xperfmon++/misc.c ./misc.c
|
||||||
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
|
*** ../xperfmon++/misc.c Wed Jul 27 22:29:33 1994
|
||||||
--- ./misc.c Mon May 6 18:31:27 1996
|
--- ./misc.c Fri Mar 14 13:31:48 1997
|
||||||
***************
|
***************
|
||||||
*** 22,27 ****
|
*** 22,27 ****
|
||||||
--- 22,38 ----
|
--- 22,38 ----
|
||||||
|
@ -891,7 +313,7 @@ diff -cd ../xperfmon++/misc.c ./misc.c
|
||||||
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
* Moffett Field, California, rsmith@proteus.arc.nasa.gov
|
||||||
*/
|
*/
|
||||||
+
|
+
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -921,10 +343,9 @@ diff -cd ../xperfmon++/misc.c ./misc.c
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case 'Q':
|
case 'Q':
|
||||||
case 'q':
|
case 'q':
|
||||||
Only in ../xperfmon++: nfs.c.old
|
diff -c -N ../xperfmon++/system.h ./system.h
|
||||||
diff -cd ../xperfmon++/system.h ./system.h
|
|
||||||
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
|
*** ../xperfmon++/system.h Wed Jul 27 22:29:34 1994
|
||||||
--- ./system.h Mon May 6 18:28:27 1996
|
--- ./system.h Fri Mar 14 13:16:19 1997
|
||||||
***************
|
***************
|
||||||
*** 151,168 ****
|
*** 151,168 ****
|
||||||
--- 151,182 ----
|
--- 151,182 ----
|
||||||
|
@ -992,16 +413,16 @@ diff -cd ../xperfmon++/system.h ./system.h
|
||||||
"Calls",
|
"Calls",
|
||||||
+ #endif
|
+ #endif
|
||||||
};
|
};
|
||||||
diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
diff -c -N ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
|
*** ../xperfmon++/xperfmon.c Wed Jul 27 22:29:39 1994
|
||||||
--- ./xperfmon.c Mon May 6 18:27:07 1996
|
--- ./xperfmon.c Fri Mar 14 13:30:50 1997
|
||||||
***************
|
***************
|
||||||
*** 58,63 ****
|
*** 58,63 ****
|
||||||
--- 58,73 ----
|
--- 58,73 ----
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
+ #ifdef _HAVE_PARAM_H
|
+ #ifdef HAVE_SYS_PARAM_H
|
||||||
+ #include <sys/param.h>
|
+ #include <sys/param.h>
|
||||||
+ #endif
|
+ #endif
|
||||||
+
|
+
|
||||||
|
@ -1250,18 +671,18 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
! newh = MIN_HEIGHT;
|
! newh = MIN_HEIGHT;
|
||||||
! w->core.height = MIN_HEIGHT;
|
! w->core.height = MIN_HEIGHT;
|
||||||
! window_size_changed = TRUE;
|
! 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;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ /* 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 )
|
+ if( neww != oldWidth || newh != oldHeight || window_size_changed == TRUE )
|
||||||
+ XtResizeWindow(w);
|
+ XtResizeWindow(w);
|
||||||
+
|
+
|
||||||
|
@ -1339,6 +760,19 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
char *progname = argv[0];
|
char *progname = argv[0];
|
||||||
Bool foundAnAdd = FALSE;
|
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 ****
|
*** 540,561 ****
|
||||||
xperfmon_width, xperfmon_height));
|
xperfmon_width, xperfmon_height));
|
||||||
XtSetValues(appData.toplevel, &arg, 1);
|
XtSetValues(appData.toplevel, &arg, 1);
|
||||||
|
@ -1362,7 +796,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
XtNjustify, XtJustifyLeft,
|
XtNjustify, XtJustifyLeft,
|
||||||
XtNinternalHeight, 0,
|
XtNinternalHeight, 0,
|
||||||
XtNtop, XtChainTop,
|
XtNtop, XtChainTop,
|
||||||
--- 601,652 ----
|
--- 605,656 ----
|
||||||
xperfmon_width, xperfmon_height));
|
xperfmon_width, xperfmon_height));
|
||||||
XtSetValues(appData.toplevel, &arg, 1);
|
XtSetValues(appData.toplevel, &arg, 1);
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +859,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
XtNupdate, appData.interval*appData.ms_per_sec,
|
XtNupdate, appData.interval*appData.ms_per_sec,
|
||||||
XtNfillRect, (int)appData.fill,
|
XtNfillRect, (int)appData.fill,
|
||||||
XtNjumpScroll, 1,
|
XtNjumpScroll, 1,
|
||||||
--- 661,668 ----
|
--- 665,672 ----
|
||||||
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
|
perfmon[i] = XtVaCreateManagedWidget(hostname, perfChartWidgetClass, pappaBox,
|
||||||
XtNtopLabel, topNames[i],
|
XtNtopLabel, topNames[i],
|
||||||
XtNbotLabel, botNames[i],
|
XtNbotLabel, botNames[i],
|
||||||
|
@ -1457,7 +891,7 @@ diff -cd ../xperfmon++/xperfmon.c ./xperfmon.c
|
||||||
- XtRealizeWidget(appData.toplevel);
|
- XtRealizeWidget(appData.toplevel);
|
||||||
XtAppMainLoop(appData.app_context);
|
XtAppMainLoop(appData.app_context);
|
||||||
}
|
}
|
||||||
--- 671,692 ----
|
--- 675,696 ----
|
||||||
}
|
}
|
||||||
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
|
timechart = XtVaCreateManagedWidget("timeChart", timeChartWidgetClass, pappaBox,
|
||||||
XtNfromVert, perfmon[1],
|
XtNfromVert, perfmon[1],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
diff -cd ../xperfmon++/Imakefile ./Imakefile
|
diff -c -N ../xperfmon++/Imakefile ./Imakefile
|
||||||
*** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994
|
*** ../xperfmon++/Imakefile Wed Jul 27 22:29:29 1994
|
||||||
--- ./Imakefile Mon May 6 18:19:34 1996
|
--- ./Imakefile Fri Mar 14 13:29:51 1997
|
||||||
***************
|
***************
|
||||||
*** 17,31 ****
|
*** 17,31 ****
|
||||||
SYS_MODULE= sgi_system
|
SYS_MODULE= sgi_system
|
||||||
|
@ -26,7 +26,7 @@ diff -cd ../xperfmon++/Imakefile ./Imakefile
|
||||||
! FreeBSDFLAGS= -lkvm
|
! FreeBSDFLAGS= -lkvm
|
||||||
! SYS_MODULE= freebsd_system
|
! SYS_MODULE= freebsd_system
|
||||||
! CC= gcc
|
! CC= gcc
|
||||||
! EXTRA_DEFINES= -D_HAVE_PARAM_H
|
! EXTRA_DEFINES= -DHAVE_SYS_PARAM_H
|
||||||
! #endif
|
! #endif
|
||||||
!
|
!
|
||||||
! EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(FreeBSDFLAGS)
|
! EXTRA_LIBRARIES = $(SUNFLAGS) $(MIPSFLAGS) $(SGIFLAGS) $(FreeBSDFLAGS)
|
||||||
|
@ -41,31 +41,30 @@ diff -cd ../xperfmon++/Imakefile ./Imakefile
|
||||||
|
|
||||||
ComplexProgramTarget(xperfmon++)
|
ComplexProgramTarget(xperfmon++)
|
||||||
|
|
||||||
diff -cd ../xperfmon++/README ./README
|
diff -c -N ../xperfmon++/README ./README
|
||||||
*** ../xperfmon++/README Wed Jul 27 22:29:30 1994
|
*** ../xperfmon++/README Wed Jul 27 22:29:30 1994
|
||||||
--- ./README Sat May 4 10:46:36 1996
|
--- ./README Fri Mar 14 13:59:13 1997
|
||||||
***************
|
***************
|
||||||
*** 18,20 ****
|
*** 18,20 ****
|
||||||
--- 18,52 ----
|
--- 18,61 ----
|
||||||
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 (freebsd_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$B(Bler @University of Rostock, Germany.
|
|
||||||
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 8-16-95 Quick and dirty workaround of -geometry option bug.
|
+ 8-16-95 Quick and dirty workaround of -geometry option bug.
|
||||||
+ But there are still some side effects when changing the geometry.
|
+ But there are still some side effects when changing the geometry.
|
||||||
+ Fix memory leak in bsd_system.c
|
+ Fix memory leak in freebsd_system.c
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <lars.koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system
|
+ 30-10-95 Change 'Free Mem' graph to 'Free Swap' cause the FreeBSD memory system
|
||||||
+ tries to minimize the free unused amount of memory.
|
+ tries to minimize the free unused amount of memory.
|
||||||
+ Include basic support for FreeBSD > 2.1.
|
+ Include basic support for FreeBSD > 2.1.
|
||||||
+ Number of interrupts now independent from 'Update Intervall'
|
+ Number of interrupts now independent from 'Update Intervall'
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 11-12-95 Fix -geometry bug! Now there is only a MIN_WIDTH of 185 pixels, and the
|
+ 11-12-95 Fix -geometry bug! Now there is only a MIN_WIDTH of 185 pixels, and the
|
||||||
|
@ -74,15 +73,25 @@ diff -cd ../xperfmon++/README ./README
|
||||||
+ Change 'Free Swap' graph from absolut into percent values.
|
+ Change 'Free Swap' graph from absolut into percent values.
|
||||||
+ All graphs shoud be independent of the 'Update Intervall'.
|
+ All graphs shoud be independent of the 'Update Intervall'.
|
||||||
+ Modify graph labels and add unit of each graph.
|
+ Modify graph labels and add unit of each graph.
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
+
|
+
|
||||||
+ 5-4-96 Fix some event problems that consumes a lot of cpu power after resizing
|
+ 5-4-96 Fix some event problems that consumes a lot of cpu power after resizing
|
||||||
+ (mwm) or restart of an window manager. Make xperfmon compile with
|
+ (mwm) or restart of an window manager. Make xperfmon compile with
|
||||||
+ FreeBSD-current (2.2, changes in get_swapspace)
|
+ FreeBSD-current (2.2, changes in get_swapspace)
|
||||||
+ by Lars K$B(Bler @University of Rostock, Germany.
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
diff -cd ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
+
|
||||||
|
+ 3-14-97 Fix some problems with changed structures in 3.0,
|
||||||
|
+ clean up the FreeBSD version numbers #if's.
|
||||||
|
+ Now xperfmon++ should compile from FreeBSD-2.0 up to 3.0-current
|
||||||
|
+ by Lars Köller @University of Rostock, Germany.
|
||||||
|
+ E-Mail: <Lars_Koeller@odie.physik2.uni-rostock.de>
|
||||||
|
+ Jörg Wunsch, FreeBSD core team menber, Germany
|
||||||
|
+ E-Mail: <joerg_wunsch@uriah.heep.sax.de>
|
||||||
|
+ <joerg@FreeBSD.ORG>
|
||||||
|
+
|
||||||
|
diff -c -N ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
||||||
*** ../xperfmon++/XPerfmon++.ad Wed Jul 27 22:29:32 1994
|
*** ../xperfmon++/XPerfmon++.ad Wed Jul 27 22:29:32 1994
|
||||||
--- ./XPerfmon++.ad Tue Dec 5 09:32:54 1995
|
--- ./XPerfmon++.ad Tue Dec 5 09:32:54 1995
|
||||||
***************
|
***************
|
||||||
|
@ -149,10 +158,9 @@ diff -cd ../xperfmon++/XPerfmon++.ad ./XPerfmon++.ad
|
||||||
! *perfChartNFSServer.highAlarm: 200
|
! *perfChartNFSServer.highAlarm: 200
|
||||||
*font: 6x13
|
*font: 6x13
|
||||||
+
|
+
|
||||||
Only in ./: freebsd_system.c
|
diff -c -N ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
|
||||||
*** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994
|
*** ../xperfmon++/xperfmon++.man Wed Jul 27 22:29:39 1994
|
||||||
--- ./xperfmon++.man Sat May 4 12:00:28 1996
|
--- ./xperfmon++.man Fri Mar 14 14:02:29 1997
|
||||||
***************
|
***************
|
||||||
*** 94,101 ****
|
*** 94,101 ****
|
||||||
.B \-idlecpu | \+idlecpu
|
.B \-idlecpu | \+idlecpu
|
||||||
|
@ -212,7 +220,7 @@ diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
Set Disk Transfer count resource.
|
Set Disk Transfer count resource.
|
||||||
***************
|
***************
|
||||||
*** 395,398 ****
|
*** 395,398 ****
|
||||||
--- 395,413 ----
|
--- 395,421 ----
|
||||||
glad to incorporate the modifications into this master copy. Send me your changes via E-Mail at the
|
glad to incorporate the modifications into this master copy. Send me your changes via E-Mail at the
|
||||||
above address.
|
above address.
|
||||||
.PP
|
.PP
|
||||||
|
@ -226,6 +234,14 @@ diff -cd ../xperfmon++/xperfmon++.man ./xperfmon++.man
|
||||||
+ .I xperfmon++ V1.33 for FreeBSD
|
+ .I xperfmon++ V1.33 for FreeBSD
|
||||||
+ contains some fixes due to event problems and compiles fine under
|
+ contains some fixes due to event problems and compiles fine under
|
||||||
+ FreeBSD 2.2 (changes in get_swapspace).
|
+ FreeBSD 2.2 (changes in get_swapspace).
|
||||||
|
+ Now the -geometry switch works well!
|
||||||
|
+ Please E-Mail any bugs or comments with the subject
|
||||||
|
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
||||||
|
+ .PP
|
||||||
|
+ .I xperfmon++ V1.40 for FreeBSD
|
||||||
|
+ contains some fixes due to changes in the networking structs and
|
||||||
|
+ cleans up the FreeBSD version number #if's. Now it should compile fine
|
||||||
|
+ from FreeBSD 2.0 up to FreeBSD-3.0-current.
|
||||||
+ Please E-Mail any bugs or comments with the subject
|
+ Please E-Mail any bugs or comments with the subject
|
||||||
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
+ "xperfmon++: ..." to Lars_Koeller@odie.physik2.uni-rostock.de.
|
||||||
+ .PP
|
+ .PP
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
--- freebsd_system.c.orig Sun Jan 19 18:43:41 1997
|
|
||||||
+++ freebsd_system.c Sun Jan 19 18:42:59 1997
|
|
||||||
@@ -75,6 +75,7 @@
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#include <sys/buf.h>
|
|
||||||
+#include <sys/time.h>
|
|
||||||
#include <sys/vmmeter.h>
|
|
||||||
#include <vm/vm.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
@@ -310,7 +311,8 @@
|
|
||||||
Collect the Network-Traffic
|
|
||||||
*/
|
|
||||||
|
|
||||||
- if (nl[N_IFNET].n_value != 0) {
|
|
||||||
+ if ((ifnetaddr = nl[N_IFNET].n_value) != 0) {
|
|
||||||
+#if __FreeBSD_version < 300000
|
|
||||||
struct ifnet ifnet;
|
|
||||||
kread(N_IFNET, &ifnetaddr, sizeof(ifnetaddr));
|
|
||||||
old_packets = packets;
|
|
||||||
@@ -322,6 +324,41 @@
|
|
||||||
packets.collisions += ifnet.if_collisions;
|
|
||||||
ifnetaddr = (u_long) ifnet.if_next;
|
|
||||||
}
|
|
||||||
+#else /* 3.0-* */
|
|
||||||
+ /* Stolen from netstat/if.c */
|
|
||||||
+ struct ifnet ifnet;
|
|
||||||
+ struct ifnethead ifnethead;
|
|
||||||
+ u_long ifaddraddr, ifnetfound;
|
|
||||||
+ struct ifaddr ifa;
|
|
||||||
+
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnethead, sizeof ifnethead) == -1)
|
|
||||||
+ return;
|
|
||||||
+ ifnetaddr = (u_long)ifnethead.tqh_first;
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ old_packets = packets;
|
|
||||||
+ packets.input = packets.output = packets.collisions = 0;
|
|
||||||
+ ifaddraddr = 0;
|
|
||||||
+ while (ifnetaddr || ifaddraddr) {
|
|
||||||
+ if (ifaddraddr == 0) {
|
|
||||||
+ ifnetfound = ifnetaddr;
|
|
||||||
+ if(kvm_read(kd, ifnetaddr, (char *)&ifnet, sizeof ifnet) == -1)
|
|
||||||
+ return;
|
|
||||||
+ ifnetaddr = (u_long)ifnet.if_link.tqe_next;
|
|
||||||
+ ifaddraddr = (u_long)ifnet.if_addrhead.tqh_first;
|
|
||||||
+ }
|
|
||||||
+ if (kvm_read(kd, ifaddraddr, (char *)&ifa, sizeof ifa) == -1) {
|
|
||||||
+ ifaddraddr = 0;
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ ifaddraddr = (u_long)ifa.ifa_link.tqe_next;
|
|
||||||
+
|
|
||||||
+ packets.input += ifnet.if_ipackets;
|
|
||||||
+ packets.output += ifnet.if_opackets;
|
|
||||||
+ packets.collisions += ifnet.if_collisions;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
|
@ -1,4 +1,4 @@
|
||||||
This package contains the binary release of xperfmon++ V1.33 a X based
|
This package contains the binary release of xperfmon++ V1.40 a X based
|
||||||
system performance meter for several systems, ported to FreeBSD 2.X.
|
system performance meter for several systems, ported to FreeBSD 2.X.
|
||||||
|
|
||||||
The program monitors user-, system-, idle-cputime, free swap, disk io,
|
The program monitors user-, system-, idle-cputime, free swap, disk io,
|
||||||
|
@ -21,3 +21,10 @@ Changes from xperfmon++ V1.3 to xperfmon++ V1.33:
|
||||||
- Fix event bug when resizing or moving the window.
|
- Fix event bug when resizing or moving the window.
|
||||||
(High cpu consumption when running xperfmon++ with mwm)
|
(High cpu consumption when running xperfmon++ with mwm)
|
||||||
- Changes in get_swapspace to compile with FreeBSD 2.2 (-current)
|
- Changes in get_swapspace to compile with FreeBSD 2.2 (-current)
|
||||||
|
|
||||||
|
Changes from xperfmon++ V1.33 to xperfmon++ V1.40:
|
||||||
|
|
||||||
|
- Fix -geometry option. Changing the size of the window now wokes
|
||||||
|
well. The start frame of the window has the correct size.
|
||||||
|
- Changes in freebsd_system.c to compile with FreeBSD 30-current.
|
||||||
|
- Clean the FreeBSD version number #if's
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
@cwd /usr/X11R6
|
||||||
|
@group kmem
|
||||||
|
@owner bin
|
||||||
|
@mode 2555
|
||||||
bin/xperfmon++
|
bin/xperfmon++
|
||||||
|
@group bin
|
||||||
|
@mode 444
|
||||||
lib/X11/app-defaults/XPerfmon++
|
lib/X11/app-defaults/XPerfmon++
|
||||||
man/man1/xperfmon++.1.gz
|
man/man1/xperfmon++.1.gz
|
||||||
|
|
3
sysutils/xperfmon3/scripts/configure
vendored
Normal file
3
sysutils/xperfmon3/scripts/configure
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
cp ${FILESDIR}/freebsd_system.c ${WRKSRC}/freebsd_system.c
|
Loading…
Add table
Reference in a new issue