From owner-freebsd-smp Tue Oct 12 23:10:38 1999 Delivered-To: freebsd-smp@freebsd.org Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id 4991014CEF for ; Tue, 12 Oct 1999 23:10:27 -0700 (PDT) (envelope-from adsharma@c62443-a.frmt1.sfba.home.com) Received: from c62443-a.frmt1.sfba.home.com ([24.0.69.165]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <19991013061027.QDZA28137.mail.rdc1.sfba.home.com@c62443-a.frmt1.sfba.home.com> for ; Tue, 12 Oct 1999 23:10:27 -0700 Received: (from adsharma@localhost) by c62443-a.frmt1.sfba.home.com (8.9.3/8.9.3) id XAA31318 for freebsd-smp@FreeBSD.ORG; Tue, 12 Oct 1999 23:10:26 -0700 Date: Tue, 12 Oct 1999 23:10:26 -0700 From: Arun Sharma To: freebsd-smp@FreeBSD.ORG Subject: Re: Kernel + xosview patch for cp_time Message-ID: <19991012231026.A31302@home.com> References: <19990901223607.A4616@home.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=X1bOJ3K7DJ5YkBrT X-Mailer: Mutt 0.95.6i In-Reply-To: <19990901223607.A4616@home.com>; from Arun Sharma on Wed, Sep 01, 1999 at 10:36:07PM -0700 Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --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