socsvn commit: r239242 - in soc2012/rudot/sys: kern sys

rudot at FreeBSD.org rudot at FreeBSD.org
Tue Jul 10 15:54:07 UTC 2012


Author: rudot
Date: Tue Jul 10 15:54:04 2012
New Revision: 239242
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239242

Log:
  support any scheduler - 4bsd scheduler is handled as a special case

Modified:
  soc2012/rudot/sys/kern/kern_racct.c
  soc2012/rudot/sys/sys/sched.h

Modified: soc2012/rudot/sys/kern/kern_racct.c
==============================================================================
--- soc2012/rudot/sys/kern/kern_racct.c	Tue Jul 10 15:16:50 2012	(r239241)
+++ soc2012/rudot/sys/kern/kern_racct.c	Tue Jul 10 15:54:04 2012	(r239242)
@@ -33,6 +33,7 @@
 __FBSDID("$FreeBSD: src/sys/kern/kern_racct.c,v 1.18 2012/05/22 15:58:27 trasz Exp $");
 
 #include "opt_kdtrace.h"
+#include "opt_sched.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,7 +49,6 @@
 #include <sys/racct.h>
 #include <sys/resourcevar.h>
 #include <sys/sbuf.h>
-#include <sys/sched.h>
 #include <sys/sdt.h>
 #include <sys/sx.h>
 #include <sys/sysent.h>
@@ -270,7 +270,10 @@
 racct_getpcpu(struct proc *p)
 {
 	u_int swtime;
-	fixpt_t p_pctcpu, pctcpu, pctcpu_next;
+#ifdef SCHED_4BSD
+	fixpt_t pctcpu, pctcpu_next;
+#endif
+	fixpt_t p_pctcpu;
 	struct thread *td;
 
 	swtime = (ticks - p->p_swtick) / hz;
@@ -280,11 +283,15 @@
 	p_pctcpu = 0;
 	FOREACH_THREAD_IN_PROC(p, td) {
 		thread_lock(td);
+#ifdef SCHED_4BSD
 		pctcpu = sched_pctcpu(td);
 		/* Count also the yet unfinished second. */
 		pctcpu_next = (pctcpu * ccpu_exp[1]) >> FSHIFT;
 		pctcpu_next += sched_pctcpu_delta(td);
 		p_pctcpu += max(pctcpu, pctcpu_next);
+#else
+		p_pctcpu += sched_pctcpu(td);
+#endif
 		thread_unlock(td);
 	}
 

Modified: soc2012/rudot/sys/sys/sched.h
==============================================================================
--- soc2012/rudot/sys/sys/sched.h	Tue Jul 10 15:16:50 2012	(r239241)
+++ soc2012/rudot/sys/sys/sched.h	Tue Jul 10 15:54:04 2012	(r239242)
@@ -104,8 +104,10 @@
 void	sched_wakeup(struct thread *td);
 void	sched_preempt(struct thread *td);
 #ifdef	RACCT
+#ifdef	SCHED_4BSD
 fixpt_t	sched_pctcpu_delta(struct thread *td);
 #endif
+#endif
 
 /*
  * Threads are moved on and off of run queues


More information about the svn-soc-all mailing list