Bug 66018 - [PATCH] sysutils/wmmon: code cleanup for 64-bit platform sparc64
Summary: [PATCH] sysutils/wmmon: code cleanup for 64-bit platform sparc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pav Lucistnik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-27 09:10 UTC by bel
Modified: 2004-05-17 21:39 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bel 2004-04-27 09:10:12 UTC
          wmmon does not show correctly CPU usage.

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 ---
How-To-Repeat:           Build port and run wmmon.
Comment 1 Ceri Davies freebsd_committer freebsd_triage 2004-04-29 18:29:35 UTC
Class Changed
From-To: sw-bug->change-request

Reassign misfiled PR. 


Comment 2 Ceri Davies freebsd_committer freebsd_triage 2004-04-29 18:29:35 UTC
Responsible Changed
From-To: gnats-admin->freebsd-ports-bugs

Reassign misfiled PR.
Comment 3 Pav Lucistnik freebsd_committer freebsd_triage 2004-05-02 16:58:13 UTC
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?
Comment 4 Pav Lucistnik freebsd_committer freebsd_triage 2004-05-02 16:58:16 UTC
State Changed
From-To: open->feedback

Asked maintainer for approval. 


Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2004-05-02 16:58:16 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pav

Handle
Comment 6 Pav Lucistnik freebsd_committer freebsd_triage 2004-05-17 21:39:20 UTC
State Changed
From-To: feedback->closed

Committed, thanks!