Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Feb 2004 13:08:14 +0100 (CET)
From:      Michael Ranner <mranner@inode.at>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/62535: [NEW PORT] sysutils/kcube: "Cpu load kicker-applet for KDE"
Message-ID:  <200402081208.i18C8EjP011765@dwarf.jawa.at>
Resent-Message-ID: <200402081210.i18CAJ5J065003@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         62535
>Category:       ports
>Synopsis:       [NEW PORT] sysutils/kcube: "Cpu load kicker-applet for KDE"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 08 04:10:18 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Michael Ranner
>Release:        FreeBSD 4.9-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD dwarf.jawa.at 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 #4: Sat Nov 29 11:09:14 CET 2003
System: FreeBSD dwarf.jawa.at 5.2-RELEASE FreeBSD 5.2-RELEASE #4: Sat Feb 1 18:35:05 CET 2004
>Description:
Kcube is a kicker-application that displays a realtime rotating
3d-object and the current cpu-load. The cpu-load also makes the
object spin faster/slower.

WWW: http://www.tuxed.de/kcube/

Generated with FreeBSD Port Tools 0.50
>How-To-Repeat:
>Fix:

--- kcube-0.61.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	kcube
#	kcube/files
#	kcube/files/patch-kcube.h
#	kcube/files/patch-kcube.cpp
#	kcube/Makefile
#	kcube/pkg-descr
#	kcube/pkg-plist
#	kcube/distinfo
#
echo c - kcube
mkdir -p kcube > /dev/null 2>&1
echo c - kcube/files
mkdir -p kcube/files > /dev/null 2>&1
echo x - kcube/files/patch-kcube.h
sed 's/^X//' >kcube/files/patch-kcube.h << 'END-of-kcube/files/patch-kcube.h'
X*** kcube/kcube.h.orig	Thu Feb 13 19:25:29 2003
X--- kcube/kcube.h	Sat Feb  7 22:39:59 2004
X***************
X*** 37,42 ****
X--- 37,54 ----
X  
X  #include "PrefForm.h"
X  
X+ #ifdef Q_OS_BSD4
X+ #include <sys/param.h>
X+ #if defined(__FreeBSD__) && __FreeBSD_version >= 500101
X+ #include <sys/resource.h>
X+ #else
X+ #include <sys/dkstat.h>
X+ #endif
X+ #include <sys/sysctl.h>
X+ #include <string.h>
X+ #include <kvm.h>
X+ #endif
X+ 
X  class Kcube : public KPanelApplet
X  {
X  Q_OBJECT
END-of-kcube/files/patch-kcube.h
echo x - kcube/files/patch-kcube.cpp
sed 's/^X//' >kcube/files/patch-kcube.cpp << 'END-of-kcube/files/patch-kcube.cpp'
X*** kcube/kcube.cpp.orig	Thu Feb 13 22:12:49 2003
X--- kcube/kcube.cpp	Sun Feb  8 11:30:04 2004
X***************
X*** 33,41 ****
X--- 33,51 ----
X  #include <qslider.h>
X  
X  #include <stdio.h>
X+ #include <unistd.h>
X+ #include <fcntl.h>
X+ 
X+ #include <nlist.h>
X  
X  #include "kcube.h"
X  
X+ struct nlist    nl[] = {
X+ #define X_CP_TIME   0
X+     { "_cp_time" },
X+     { "" },
X+ };
X+ 
X  extern "C"
X  {
X  	KPanelApplet* init( QWidget *parent, const QString configFile)
X***************
X*** 64,70 ****
X  
X  	// timer
X  	cpu_timer = new QTimer();
X! 	cpu_timer->start(500, false);
X  	connect (cpu_timer, SIGNAL ( timeout() ), this, SLOT ( cpu_timer_event() ) );
X  	draw_timer = new QTimer();
X  	draw_timer->start(50, false);
X--- 74,80 ----
X  
X  	// timer
X  	cpu_timer = new QTimer();
X! 	cpu_timer->start(1000, false);
X  	connect (cpu_timer, SIGNAL ( timeout() ), this, SLOT ( cpu_timer_event() ) );
X  	draw_timer = new QTimer();
X  	draw_timer->start(50, false);
X***************
X*** 82,87 ****
X--- 92,98 ----
X  	prefform = new PrefForm(this);
X  	prefform->setFixedSize( prefform->width(), prefform->height() );
X  	loadConfig();
X+ 
X  }
X  
X  Kcube::~Kcube()
X***************
X*** 119,132 ****
X  int Kcube::calc_cpu_total()
X  {
X  	int 	use_nice = 0, t=0;
X! 	int 	total, used;
X  	char 	cpuid[6];
X! 	int 	cpu,nice,system,idle;
X  
X  	FILE *fp;
X  	fp = fopen("/proc/stat","rt");
X  	fscanf(fp,"%s %d %d %d %d",cpuid,&cpu,&nice,&system,&idle);
X  	fclose(fp);
X  
X  	used 	= cpu + system + nice;
X  	total 	= used + idle + (1-use_nice)*nice;
X--- 130,171 ----
X  int Kcube::calc_cpu_total()
X  {
X  	int 	use_nice = 0, t=0;
X! 	long 	total, used;
X  	char 	cpuid[6];
X! 	long 	cpu,nice,system,idle;
X! #ifdef Q_OS_BSD4
X!     static int name2oid[2] = { 0, 3 };
X!     static int oidCpuTime[CTL_MAXNAME + 2];
X!     static size_t oidCpuTimeLen = sizeof(oidCpuTime);
X!     long cpuTime[CPUSTATES];
X!     size_t cpuTimeLen = sizeof(cpuTime);
X!     static char *name = "kern.cp_time";
X!     static int initialized = 0;
X! #endif
X  
X+ #ifdef Q_OS_LINUX
X  	FILE *fp;
X  	fp = fopen("/proc/stat","rt");
X  	fscanf(fp,"%s %d %d %d %d",cpuid,&cpu,&nice,&system,&idle);
X  	fclose(fp);
X+ #endif
X+ 
X+ #ifdef Q_OS_BSD4
X+ 	if (! initialized) {
X+ 		if (sysctl(name2oid, 2, oidCpuTime, &oidCpuTimeLen, name, strlen(name)) < 0)
X+ 			return 0;
X+ 		oidCpuTimeLen /= sizeof(int);
X+ 		initialized = 1;
X+ 	}
X+ 
X+ 	if (sysctl(oidCpuTime, oidCpuTimeLen, cpuTime, &cpuTimeLen, 0, 0) < 0)
X+ 		return 0;
X+ 
X+ 	idle = cpuTime[CP_IDLE];
X+ 	cpu = cpuTime[CP_USER];
X+ 	nice = cpuTime[CP_NICE];
X+ 	system = cpuTime[CP_SYS];
X+ #endif
X  
X  	used 	= cpu + system + nice;
X  	total 	= used + idle + (1-use_nice)*nice;
X***************
X*** 148,154 ****
X  	if ( load > prefform->high_color_cpu->text().toInt() ) setColors("high");
X  	else setColors("low");
X  		
X! 	draw_timer->changeInterval( 51 - load/2 );
X  	label_load->setText( QString("%1%").arg(load) );
X  }
X  
X--- 187,193 ----
X  	if ( load > prefform->high_color_cpu->text().toInt() ) setColors("high");
X  	else setColors("low");
X  		
X! 	draw_timer->changeInterval( 61 - load/2 );
X  	label_load->setText( QString("%1%").arg(load) );
X  }
X  
END-of-kcube/files/patch-kcube.cpp
echo x - kcube/Makefile
sed 's/^X//' >kcube/Makefile << 'END-of-kcube/Makefile'
X# New ports collection makefile for:   kcube
X# Date created:        05 January 2004
X# Whom:                Michael Ranner
X#
X# $FreeBSD$
X#
X
XPORTNAME=	kcube
XPORTVERSION=	0.61
XCATEGORIES=	sysutils kde
XMASTER_SITES=	http://www.tuxed.de/kcube/download/
X
XMAINTAINER=		mranner@inode.at
XCOMMENT=	"Another cpu load kicker applet for KDE"
X
XUSE_KDELIBS_VER=3
XGNU_CONFIGURE=	yes
XUSE_GMAKE=	yes
XUSE_REINPLACE=	yes
XUSE_LIBTOOL=yes
XINSTALLS_SHLIB=	yes
XCONFIGURE_TARGET=
XCONFIGURE_ARGS+=	--with-freebsd-pthread
X
X.include <bsd.port.pre.mk>
X.include "${PORTSDIR}/x11/kde3/Makefile.kde"
X.include <bsd.port.post.mk>
END-of-kcube/Makefile
echo x - kcube/pkg-descr
sed 's/^X//' >kcube/pkg-descr << 'END-of-kcube/pkg-descr'
XKcube is a kicker-application that displays a realtime rotating
X3d-object and the current cpu-load. The cpu-load also makes the
Xobject spin faster/slower.
X
XWWW: http://www.tuxed.de/kcube/
END-of-kcube/pkg-descr
echo x - kcube/pkg-plist
sed 's/^X//' >kcube/pkg-plist << 'END-of-kcube/pkg-plist'
Xlib/libkcube.so.1
Xlib/libkcube.la
Xshare/apps/kicker/applets/kcube.desktop
X@dirrm share/apps/kicker/applets
X@dirrm share/nls
END-of-kcube/pkg-plist
echo x - kcube/distinfo
sed 's/^X//' >kcube/distinfo << 'END-of-kcube/distinfo'
XMD5 (kcube-0.61.tar.gz) = 98735371ce2e3838cc498c35a47488e4
END-of-kcube/distinfo
exit
--- kcube-0.61.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402081208.i18C8EjP011765>