Subject: Re: bin/20316: systat interrupt counters
To: Johnny Billquist <bqt@update.uu.se>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 02/17/2003 12:59:27
> Well, it's a hack... It improves things slightly, but isn't really a good
> solution. Someone who have a good idea on how these strings are to be used
> should tell, and then we should do it that way. As it stands now, we're a
> bit inconsistent between ports, and systat shouldn't try to accomodate for
> that. It's like fixing the symptoms instead of the problem.

Try the attached patch?
It stirs the field about a bit...

	David

Index: vmstat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.47
diff -u -r1.47 vmstat.c
--- vmstat.c	2003/02/13 08:09:33	1.47
+++ vmstat.c	2003/02/17 12:56:19
@@ -136,19 +136,20 @@
  */
 #define STATROW		 0	/* uses 1 row and 68 cols */
 #define STATCOL		 2
-#define MEMROW		 2	/* uses 4 rows and 31 cols */
+#define MEMROW		 9	/* uses 4 rows and 31 cols */
 #define MEMCOL		 0
 #define PAGEROW		 2	/* uses 4 rows and 26 cols */
-#define PAGECOL		36
-#define INTSROW		 2	/* uses all rows to bottom and 17 cols */
-#define INTSCOL		63
-#define PROCSROW	 7	/* uses 2 rows and 20 cols */
+#define PAGECOL		54
+#define INTSROW		 9	/* uses all rows to bottom and 17 cols */
+#define INTSCOL		40
+#define INTSCOLEND	(VMSTATCOL - 0)
+#define PROCSROW	 2	/* uses 2 rows and 20 cols */
 #define PROCSCOL	 0
-#define GENSTATROW	 7	/* uses 2 rows and 30 cols */
+#define GENSTATROW	 2	/* uses 2 rows and 30 cols */
 #define GENSTATCOL	18
-#define VMSTATROW	 7	/* uses 17 rows and 12 cols */
-#define VMSTATCOL	48
-#define GRAPHROW	10	/* uses 3 rows and 51 cols */
+#define VMSTATROW	 7	/* uses 17 rows and 15 cols */
+#define VMSTATCOL	64
+#define GRAPHROW	 5	/* uses 3 rows and 51 cols */
 #define GRAPHCOL	 0
 #define NAMEIROW	14	/* uses 3 rows and 38 cols */
 #define NAMEICOL	 0
@@ -255,7 +256,7 @@
 	/* event counter interrupt counts */
 	get_interrupt_events();
 
-	nextintsrow = INTSROW + 2;
+	nextintsrow = INTSROW + 1;
 	allocinfo(&s);
 	allocinfo(&s1);
 	allocinfo(&s2);
@@ -282,7 +283,7 @@
 {
 	int width, name_width, group_width;
 
-	width = COLS - (INTSCOL + 9);
+	width = INTSCOLEND - (INTSCOL + 9);
 	if (width <= 0)
 		return;
 
@@ -341,8 +342,7 @@
 	mvprintw(PAGEROW + 2, PAGECOL, "ops");
 	mvprintw(PAGEROW + 3, PAGECOL, "pages");
 
-	mvprintw(INTSROW, INTSCOL + 3, " Interrupts");
-	mvprintw(INTSROW + 1, INTSCOL + 9, "total");
+	mvprintw(INTSROW, INTSCOL + 9, "Interrupts");
 
 	mvprintw(VMSTATROW + 0, VMSTATCOL + 10, "forks");
 	mvprintw(VMSTATROW + 1, VMSTATCOL + 10, "fkppw");
@@ -390,7 +390,7 @@
 		if (intrloc[i] == 0)
 			continue;
 		mvprintw(intrloc[i], INTSCOL + 9, "%-.*s",
-			COLS - (INTSCOL + 9), intrname[i]);
+			INTSCOLEND - (INTSCOL + 9), intrname[i]);
 	}
 	for (i = 0; i < nevcnt; i++) {
 		if (ie_head[i].ie_loc == 0)
@@ -447,7 +447,7 @@
 				continue;
 			intrloc[i] = nextintsrow++;
 			mvprintw(intrloc[i], INTSCOL + 9, "%-.*s",
-				COLS - (INTSCOL + 9), intrname[i]);
+				INTSCOLEND - (INTSCOL + 9), intrname[i]);
 		}
 		X(intrcnt);
 		l = (int)((float)s.intrcnt[i]/etime + 0.5);
@@ -468,7 +468,7 @@
 		inttotal += l;
 		putint(l, ie_head[i].ie_loc, INTSCOL, 8);
 	}
-	putint(inttotal, INTSROW + 1, INTSCOL, 8);
+	putint(inttotal, INTSROW, INTSCOL, 8);
 	Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);
 	Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes);
 	s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +

-- 
David Laight: david@l8s.co.uk