From 93328593c60cd3da941e34a61c6a85d244dd2232 Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Sat, 8 Oct 2005 12:24:26 +0000 Subject: [PATCH] 1:1 Userland threading stage 2.2/4: Move profiling and intervall timer data to struct proc. --- sys/i386/i386/trap.c | 6 +++--- sys/kern/kern_clock.c | 10 +++++----- sys/kern/kern_time.c | 6 +++--- sys/kern/subr_prof.c | 8 ++++---- sys/platform/pc32/i386/trap.c | 6 +++--- sys/sys/proc.h | 7 +++---- sys/sys/resourcevar.h | 19 +++++++++---------- sys/vm/vm_glue.c | 4 +--- 8 files changed, 31 insertions(+), 35 deletions(-) diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index aeeb64556d..930c62bd44 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -36,7 +36,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $ - * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.60 2005/07/19 19:25:43 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.61 2005/10/08 12:24:26 corecode Exp $ */ /* @@ -486,8 +486,8 @@ restart: if (mycpu->gd_reqflags & RQF_AST_OWEUPC) { atomic_clear_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_OWEUPC); - addupc_task(p, p->p_stats->p_prof.pr_addr, - p->p_stats->p_prof.pr_ticks); + addupc_task(p, p->p_prof.pr_addr, + p->p_prof.pr_ticks); } goto out; diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index c5eea7e335..537853fd43 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -70,7 +70,7 @@ * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_clock.c,v 1.105.2.10 2002/10/17 13:19:40 maxim Exp $ - * $DragonFly: src/sys/kern/kern_clock.c,v 1.45 2005/06/29 01:25:08 dillon Exp $ + * $DragonFly: src/sys/kern/kern_clock.c,v 1.46 2005/10/08 12:24:26 corecode Exp $ */ #include "opt_ntp.h" @@ -503,11 +503,11 @@ hardclock(systimer_t info, struct intrframe *frame) if ((p = curproc) != NULL && try_mplock()) { pstats = p->p_stats; if (frame && CLKF_USERMODE(frame) && - timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) && - itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) + timevalisset(&p->p_timer[ITIMER_VIRTUAL].it_value) && + itimerdecr(&p->p_timer[ITIMER_VIRTUAL], tick) == 0) psignal(p, SIGVTALRM); - if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) && - itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) + if (timevalisset(&p->p_timer[ITIMER_PROF].it_value) && + itimerdecr(&p->p_timer[ITIMER_PROF], tick) == 0) psignal(p, SIGPROF); rel_mplock(); } diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 626029edbd..8a813736ef 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -32,7 +32,7 @@ * * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/kern_time.c,v 1.68.2.1 2002/10/01 08:00:41 bde Exp $ - * $DragonFly: src/sys/kern/kern_time.c,v 1.30 2005/09/12 19:01:45 joerg Exp $ + * $DragonFly: src/sys/kern/kern_time.c,v 1.31 2005/10/08 12:24:26 corecode Exp $ */ #include @@ -702,7 +702,7 @@ getitimer(struct getitimer_args *uap) timevalsub(&aitv.it_value, &ctv); } } else { - aitv = p->p_stats->p_timer[uap->which]; + aitv = p->p_timer[uap->which]; } crit_exit(); return (copyout((caddr_t)&aitv, (caddr_t)uap->itv, @@ -747,7 +747,7 @@ setitimer(struct setitimer_args *uap) timevaladd(&aitv.it_value, &ctv); p->p_realtimer = aitv; } else { - p->p_stats->p_timer[uap->which] = aitv; + p->p_timer[uap->which] = aitv; } crit_exit(); return (0); diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 71e79a437e..677700aadf 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -32,7 +32,7 @@ * * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/subr_prof.c,v 1.32.2.2 2000/08/03 00:09:32 ps Exp $ - * $DragonFly: src/sys/kern/subr_prof.c,v 1.10 2005/06/06 15:02:28 dillon Exp $ + * $DragonFly: src/sys/kern/subr_prof.c,v 1.11 2005/10/08 12:24:26 corecode Exp $ */ #include @@ -356,7 +356,7 @@ profil(struct profil_args *uap) stopprofclock(p); return (0); } - upp = &p->p_stats->p_prof; + upp = &p->p_prof; /* Block profile interrupts while changing state. */ crit_enter(); @@ -402,7 +402,7 @@ addupc_intr(struct proc *p, u_long pc, u_int ticks) if (ticks == 0) return; - prof = &p->p_stats->p_prof; + prof = &p->p_prof; if (pc < prof->pr_off || (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) return; /* out of range; ignore */ @@ -431,7 +431,7 @@ addupc_task(struct proc *p, u_long pc, u_int ticks) if ((p->p_flag & P_PROFIL) == 0 || ticks == 0) return; - prof = &p->p_stats->p_prof; + prof = &p->p_prof; if (pc < prof->pr_off || (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) return; diff --git a/sys/platform/pc32/i386/trap.c b/sys/platform/pc32/i386/trap.c index 96a8145a4c..8508d25ee1 100644 --- a/sys/platform/pc32/i386/trap.c +++ b/sys/platform/pc32/i386/trap.c @@ -36,7 +36,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $ - * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.60 2005/07/19 19:25:43 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.61 2005/10/08 12:24:26 corecode Exp $ */ /* @@ -486,8 +486,8 @@ restart: if (mycpu->gd_reqflags & RQF_AST_OWEUPC) { atomic_clear_int_nonlocked(&mycpu->gd_reqflags, RQF_AST_OWEUPC); - addupc_task(p, p->p_stats->p_prof.pr_addr, - p->p_stats->p_prof.pr_ticks); + addupc_task(p, p->p_prof.pr_addr, + p->p_prof.pr_ticks); } goto out; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ff39c28359..b855aed2f7 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -37,7 +37,7 @@ * * @(#)proc.h 8.15 (Berkeley) 5/19/95 * $FreeBSD: src/sys/sys/proc.h,v 1.99.2.9 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/proc.h,v 1.63 2005/10/06 20:01:29 corecode Exp $ + * $DragonFly: src/sys/sys/proc.h,v 1.64 2005/10/08 12:24:26 corecode Exp $ */ #ifndef _SYS_PROC_H_ @@ -60,6 +60,7 @@ #include #include #include +#include #ifdef _KERNEL #include #endif @@ -228,10 +229,7 @@ struct proc { #define p_slptime p_lwp.lwp_slptime struct itimerval p_realtimer; /* Alarm timer. */ -#ifdef notyet struct itimerval p_timer[3]; /* Virtual-time timers. */ - struct uprof p_prof; /* Profiling arguments. */ -#endif int p_traceflag; /* Kernel trace points. */ struct vnode *p_tracep; /* Trace to vnode. */ @@ -278,6 +276,7 @@ struct proc { struct sysentvec *p_sysent; /* System call dispatch information. */ + struct uprof p_prof; /* Profiling arguments. */ struct rtprio p_rtprio; /* Realtime priority. */ struct pargs *p_args; /* End area that is copied on creation. */ diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index a13e3a6bd3..9255bf23db 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -32,7 +32,7 @@ * * @(#)resourcevar.h 8.4 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/resourcevar.h,v 1.16.2.1 2000/09/07 19:13:55 truckman Exp $ - * $DragonFly: src/sys/sys/resourcevar.h,v 1.10 2004/06/20 22:29:10 hmp Exp $ + * $DragonFly: src/sys/sys/resourcevar.h,v 1.11 2005/10/08 12:24:26 corecode Exp $ */ #ifndef _SYS_RESOURCEVAR_H_ @@ -52,16 +52,15 @@ struct pstats { struct rusage p_ru; /* stats for this proc */ struct rusage p_cru; /* sum of stats for reaped children */ - struct itimerval p_timer[3]; /* virtual-time timers */ +}; - struct uprof { /* profile arguments */ - caddr_t pr_base; /* buffer base */ - u_long pr_size; /* buffer size */ - u_long pr_off; /* pc offset */ - u_long pr_scale; /* pc scaling */ - u_long pr_addr; /* temp storage for addr until AST */ - u_long pr_ticks; /* temp storage for ticks until AST */ - } p_prof; +struct uprof { /* profile arguments */ + caddr_t pr_base; /* buffer base */ + u_long pr_size; /* buffer size */ + u_long pr_off; /* pc offset */ + u_long pr_scale; /* pc scaling */ + u_long pr_addr; /* temp storage for addr until AST */ + u_long pr_ticks; /* temp storage for ticks until AST */ }; /* diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index ffba3b635e..a98f615255 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -60,7 +60,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/vm/vm_glue.c,v 1.94.2.4 2003/01/13 22:51:17 dillon Exp $ - * $DragonFly: src/sys/vm/vm_glue.c,v 1.32 2005/06/25 20:03:32 dillon Exp $ + * $DragonFly: src/sys/vm/vm_glue.c,v 1.33 2005/10/08 12:24:26 corecode Exp $ */ #include "opt_vm.h" @@ -257,8 +257,6 @@ vm_fork(struct proc *p1, struct proc *p2, int flags) } bzero(&up->u_stats, sizeof(struct pstats)); - bcopy(&p1->p_stats->p_prof, &up->u_stats.p_prof, - sizeof(struct uprof)); bcopy(&p1->p_thread->td_start, &p2->p_thread->td_start, sizeof(struct timeval)); -- 2.41.0