From bel@orel.ru  Tue Apr 27 01:01:35 2004
Return-Path: <bel@orel.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 34D7916A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Apr 2004 01:01:35 -0700 (PDT)
Received: from tts.orel.ru (tts.orel.ru [213.59.64.67])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5E21F43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Apr 2004 01:01:34 -0700 (PDT)
	(envelope-from bel@orel.ru)
Received: from orel.ru (lg.orel.ru [62.33.11.59])
	by tts.orel.ru (8.12.10/8.12.10/bel) with ESMTP id i3R81Ugk002273
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Apr 2004 12:01:31 +0400
Message-Id: <408E135A.4020300@orel.ru>
Date: Tue, 27 Apr 2004 12:01:30 +0400
From: Andrew Belashov <bel@orel.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] sysutils/wmmon: code cleanup for 64-bit platform sparc64

>Number:         66018
>Category:       ports
>Synopsis:       [PATCH] sysutils/wmmon: code cleanup for 64-bit platform sparc64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pav
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 27 01:10:12 PDT 2004
>Closed-Date:    Mon May 17 13:39:27 PDT 2004
>Last-Modified:  Mon May 17 13:39:27 PDT 2004
>Originator:     Andrew Belashov
>Release:        FreeBSD 5.2-CURRENT sparc64
>Organization:
JSC "CenterTelecom"
>Environment:
 System: FreeBSD bel.localdomain 5.2-CURRENT FreeBSD 5.2-CURRENT #1:
 Thu Apr 8 16:58:57 MSD 2004 bel@bel.localdomain:/usr/obj/usr/src/sys/NOSMP sparc64
 
          Machine: Sun Ultra 60 Creator 3D, OS: FreeBSD/sparc64, XFree86 4.3.0
          Kernel build without SMP option for stability!

>Description:

          wmmon does not show correctly CPU usage.

>How-To-Repeat:
          Build port and run wmmon.

>Fix:
 
          Apply attached patch. Alternative location of patch:
 	<http://www.orel.ru/~bel/patches/wmmon.patch>
 
 --- patch-pp begins here ---
 --- wmmon.c.orig	Tue Apr 27 11:22:29 2004
 +++ wmmon.c	Tue Apr 27 11:22:03 2004
 @@ -186,8 +186,8 @@
   /* functions */
   void usage(void);
   void printversion(void);
 -void DrawStats(int *, int, int, int, int);
 -void DrawStats_io(int *, int, int, int, int);
 +void DrawStats(long *, int, int, int, int);
 +void DrawStats_io(long *, int, int, int, int);
 
   #if defined(__FreeBSD__) || defined(__NetBSD__)
   int swapmode( long *retavail, long *retfree);
 @@ -255,7 +255,7 @@
   typedef struct {
 
   	char	name[5];			/* "cpu0..cpuz", eventually.. :) */
 -	int		his[55];
 +	long		his[55];
   	int		hisaddcnt;
   	long	rt_stat;
   	long	statlast;
 @@ -900,7 +900,11 @@
   void get_statistics(char *devname, long *is, long *ds, long *idle) {
 
   	int	i;
 +#if defined(__FreeBSD__)
 +	double	averun[1];
 +#else
   	long	averun[3];
 +#endif
   	long	cp_time[CPUSTATES];
   	long	maxdiskio=0;
 
 @@ -915,8 +919,13 @@
   			if (kvm_nlist(kvmd, nl) >= 0) {
   				if (nl[0].n_type != 0) {
   					if ((kvm_read(kvmd, nl[N_CP_TIME].n_value, (char *)&cp_time, sizeof(cp_time))==sizeof(cp_time)) &&
 +#if defined(__FreeBSD__)
 +					    (kvm_getloadavg(kvmd, averun, 1)==1)) {
 +						*is = (long) (100 * averun[0]);
 +#else
   					    (kvm_read(kvmd, nl[N_AVERUN].n_value, (char *)&averun, sizeof(averun))==sizeof(averun))) {
   						*is = (long) (100 * ((double)averun[0] / FSCALE));
 +#endif
 
   						for (i = 0; i < CPUSTATES; i++) {
   							if (i != CP_IDLE) *ds += cp_time[i];
 @@ -1188,11 +1197,11 @@
   |* DrawStats                                                                   *|
   \*******************************************************************************/
 
 -void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 +void DrawStats(long *his, int num, int size, int x_left, int y_bottom) {
 
   	int     pixels_per_byte;
   	int     j,k;
 -	int     *p;
 +	long     *p;
   	int		d;
 
   /*	printf ("size = %d, num = %d\n", size, num); */
 @@ -1235,11 +1244,11 @@
   |* DrawStats_io                                                                *|
   \*******************************************************************************/
 
 -void DrawStats_io(int *his, int num, int size, int x_left, int y_bottom) {
 +void DrawStats_io(long *his, int num, int size, int x_left, int y_bottom) {
 
   	float	pixels_per_byte;
   	int     j,k;
 -	int     *p;
 +	long    *p;
   	int		d;
 
   	static int	global_io_scale = 1;
 --- patch-pp ends here ---
>Release-Note:
>Audit-Trail:
Class-Changed-From-To: sw-bug->change-request 
Class-Changed-By: ceri 
Class-Changed-When: Thu Apr 29 10:29:35 PDT 2004 
Class-Changed-Why:  
Reassign misfiled PR. 


Responsible-Changed-From-To: gnats-admin->freebsd-ports-bugs 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Thu Apr 29 10:29:35 PDT 2004 
Responsible-Changed-Why:  
Reassign misfiled PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66018 
State-Changed-From-To: open->feedback 
State-Changed-By: pav 
State-Changed-When: Sun May 2 08:58:16 PDT 2004 
State-Changed-Why:  
Asked maintainer for approval. 


Responsible-Changed-From-To: freebsd-ports-bugs->pav 
Responsible-Changed-By: pav 
Responsible-Changed-When: Sun May 2 08:58:16 PDT 2004 
Responsible-Changed-Why:  
Handle 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66018 

From: Pav Lucistnik <pav@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, sk-ports@vegamuse.org
Cc:  
Subject: Re: ports/66018: [PATCH] sysutils/wmmon: code cleanup for 64-bit
	platform sparc64
Date: Sun, 02 May 2004 17:58:13 +0200

 Dear maintainer of FreeBSD port sysutils/wmmon, please take a look at
 
 http://www.freebsd.org/cgi/query-pr.cgi?q=66018
 
 Do you approve this patch?
 
 -- 
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 It's ten o'clock; do you know where your processes are?
State-Changed-From-To: feedback->closed 
State-Changed-By: pav 
State-Changed-When: Mon May 17 13:39:20 PDT 2004 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66018 
>Unformatted:
