openbsd-ports/sysutils/xosview/patches/patch-bsd_cpumeter_cc
2004-01-26 12:46:20 +00:00

70 lines
3.2 KiB
Plaintext

$OpenBSD: patch-bsd_cpumeter_cc,v 1.2 2004/01/26 12:46:20 naddy Exp $
--- bsd/cpumeter.cc.orig 2001-10-09 04:45:32.000000000 +0200
+++ bsd/cpumeter.cc 2004-01-26 13:29:06.000000000 +0100
@@ -32,11 +32,12 @@ CVSID_DOT_H(CPUMETER_H_CVSID);
CPUMeter::CPUMeter( XOSView *parent )
#if defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_BSDI) || \
- (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000))
-: FieldMeterGraph( parent, 5, "CPU", "USR/NICE/SYS/INT/FREE" ){
+ (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)) || \
+ defined(XOSVIEW_OPENBSD)
+: FieldMeterGraph( parent, 5, "CPU", "USR/NICE/SYS/INT/IDLE" ){
#define FREE_INDEX 4
#else
-: FieldMeterGraph( parent, 4, "CPU", "USR/NICE/SYS/FREE" ){
+: FieldMeterGraph( parent, 4, "CPU", "USR/NICE/SYS/IDLE" ){
#define FREE_INDEX 3
#endif
for ( int i = 0 ; i < 2 ; i++ )
@@ -59,7 +60,8 @@ void CPUMeter::checkResources( void ){
setfieldcolor( 1, parent_->getResource("cpuNiceColor") );
setfieldcolor( 2, parent_->getResource("cpuSystemColor") );
#if defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_BSDI) || \
- (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000))
+ (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)) || \
+ defined(XOSVIEW_OPENBSD)
setfieldcolor( 3, parent_->getResource("cpuInterruptColor") );
setfieldcolor( 4, parent_->getResource("cpuFreeColor") );
#else
@@ -81,7 +83,7 @@ void CPUMeter::getcputime( void ){
static double lastTotal = 0, lastLastTotal = -1;
// Begin NetBSD-specific code... BCG
-#if defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)
+#if defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)
u_int64_t tempCPU[CPUSTATES];
#else
long tempCPU[CPUSTATES];
@@ -92,7 +94,8 @@ void CPUMeter::getcputime( void ){
cputime_[cpuindex_][0] = tempCPU[0];
cputime_[cpuindex_][1] = tempCPU[1];
#if defined(XOSVIEW_FREEBSD) || defined(XOSVIEW_BSDI) || \
- (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000))
+ (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)) || \
+ defined(XOSVIEW_OPENBSD)
// FreeBSD seems at least to be filling cp_time[CP_INTR]. So, we add that
// as another field. (pavel 25-Jan-1998)
cputime_[cpuindex_][2] = tempCPU[2];
@@ -123,13 +126,13 @@ void CPUMeter::getcputime( void ){
static int firstTime = 1;
if (firstTime) {
fprintf(stderr,
-" Warning: the CPU tick counters are not changing. This could
-be due to running a kernel besides /netbsd (or the equivalent for FreeBSD).
- If this is the case, re-run xosview with the -N kernel-name option.
- If not, then this is a bug. Please send a message to
-bgrayson@ece.utexas.edu, in addition to any send-pr bug reports
-(or in lieu of -- it ought to get fixed faster if you contact me
-directly). Thanks!\n");
+" Warning: the CPU tick counters are not changing. This could\n"
+"be due to running a kernel besides /netbsd (or the equivalent for FreeBSD).\n"
+" If this is the case, re-run xosview with the -N kernel-name option.\n"
+" If not, then this is a bug. Please send a message to\n"
+"bgrayson@ece.utexas.edu, in addition to any send-pr bug reports\n"
+"(or in lieu of -- it ought to get fixed faster if you contact me\n"
+"directly). Thanks!\n");
firstTime = 0;
}
}