Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Oct 1999 23:10:26 -0700
From:      Arun Sharma <adsharma@home.com>
To:        freebsd-smp@FreeBSD.ORG
Subject:   Re: Kernel + xosview patch for cp_time
Message-ID:  <19991012231026.A31302@home.com>
In-Reply-To: <19990901223607.A4616@home.com>; from Arun Sharma on Wed, Sep 01, 1999 at 10:36:07PM -0700
References:  <19990901223607.A4616@home.com>

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

--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii

On Wed, Sep 01, 1999 at 10:36:07PM -0700, Arun Sharma wrote:
> Here's a minor patch to make the kernel keep track of per CPU times and
> another patch to help xosview take advantage of that.
> 
> 	-Arun
> 

I didn't receive any feedback on this mail. Did anyone with commit 
privs look at this (the kernel part) ? 

	-Arun


--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mp_cp_time.patch"

Index: kern//kern_clock.c
===================================================================
RCS file: /home/adsharma/cvs_root/freebsd-sys/kern/kern_clock.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 kern_clock.c
--- kern_clock.c	1999/08/31 05:12:42	1.1.1.2
+++ kern_clock.c	1999/09/02 04:13:35
@@ -89,7 +89,7 @@
 
 /* Some of these don't belong here, but it's easiest to concentrate them. */
 #if defined(SMP) && defined(BETTER_CLOCK)
-long cp_time[CPUSTATES];
+long cp_time[NCPUS][CPUSTATES];
 #else
 static long cp_time[CPUSTATES];
 #endif
@@ -389,9 +389,17 @@
 		 */
 		p->p_uticks++;
 		if (p->p_nice > NZERO)
+#ifdef SMP
+			cp_time[cpuid][CP_NICE]++;
+#else
 			cp_time[CP_NICE]++;
+#endif
 		else
+#ifdef SMP
+			cp_time[cpuid][CP_USER]++;
+#else
 			cp_time[CP_USER]++;
+#endif
 	} else {
 #ifdef GPROF
 		/*
@@ -428,12 +436,26 @@
 		if (CLKF_INTR(frame)) {
 			if (p != NULL)
 				p->p_iticks++;
+#ifdef SMP
+			cp_time[cpuid][CP_INTR]++;
+#else
 			cp_time[CP_INTR]++;
+#endif
+
 		} else if (p != NULL) {
 			p->p_sticks++;
+#ifdef SMP
+			cp_time[cpuid][CP_SYS]++;
+#else
 			cp_time[CP_SYS]++;
+#endif
 		} else
+#ifdef SMP
+			cp_time[cpuid][CP_IDLE]++;
+#else
 			cp_time[CP_IDLE]++;
+#endif
+
 	}
 	pscnt = psdiv;
 
Index: i386//i386/mp_machdep.c
===================================================================
RCS file: /home/adsharma/cvs_root/freebsd-sys/i386/i386/mp_machdep.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 mp_machdep.c
--- mp_machdep.c	1999/08/31 05:12:10	1.1.1.2
+++ mp_machdep.c	1999/09/02 04:15:26
@@ -2227,8 +2227,9 @@
 int		checkstate_cpustate[NCPU];
 u_long		checkstate_pc[NCPU];
 
-extern long	cp_time[CPUSTATES];
+extern long	cp_time[NCPUS][CPUSTATES];
 
+
 #define PC_TO_INDEX(pc, prof)				\
         ((int)(((u_quad_t)((pc) - (prof)->pr_off) *	\
             (u_quad_t)((prof)->pr_scale)) >> 16) & ~1)
@@ -2278,9 +2279,9 @@
 			return;
 		p->p_uticks++;
 		if (p->p_nice > NZERO)
-			cp_time[CP_NICE]++;
+			cp_time[cpuid][CP_NICE]++;
 		else
-			cp_time[CP_USER]++;
+			cp_time[cpuid][CP_USER]++;
 		break;
 	case CHECKSTATE_SYS:
 #ifdef GPROF
@@ -2300,10 +2301,10 @@
 			return;
 
 		if (!p)
-			cp_time[CP_IDLE]++;
+			cp_time[cpuid][CP_IDLE]++;
 		else {
 			p->p_sticks++;
-			cp_time[CP_SYS]++;
+			cp_time[cpuid][CP_SYS]++;
 		}
 		break;
 	case CHECKSTATE_INTR:
@@ -2325,7 +2326,7 @@
 			return;
 		if (p)
 			p->p_iticks++;
-		cp_time[CP_INTR]++;
+		cp_time[cpuid][CP_INTR]++;
 	}
 	if (p != NULL) {
 		p->p_cpticks++;

--X1bOJ3K7DJ5YkBrT--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




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