From: David van Moolenbroek Date: Thu, 16 Dec 2010 09:46:26 +0000 (+0000) Subject: Kernel: statistical profiling fixes X-Git-Tag: v3.2.0~713 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.rndc.html?a=commitdiff_plain;h=b6f3b7e7f662276af0e1cf4e380e7d95083d6eea;p=minix.git Kernel: statistical profiling fixes - create name entries for forked processes as well; - create name entries only for system processes. --- diff --git a/kernel/profile.c b/kernel/profile.c index 73f79bd46..4eed04c24 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -101,18 +101,19 @@ PRIVATE void profile_sample(struct proc * p, void * pc) return; } - if (!(p->p_misc_flags & MF_SPROF_SEEN)) { - p->p_misc_flags |= MF_SPROF_SEEN; - sprof_save_proc(p); - } - /* Runnable system process? */ if (p->p_endpoint == IDLE) - sprof_info.idle_samples++; + sprof_info.idle_samples++; else if (p->p_endpoint == KERNEL || - (priv(p)->s_flags & SYS_PROC && proc_is_runnable(p))) { - sprof_save_sample(p, pc); - sprof_info.system_samples++; + (priv(p)->s_flags & SYS_PROC && proc_is_runnable(p))) { + + if (!(p->p_misc_flags & MF_SPROF_SEEN)) { + p->p_misc_flags |= MF_SPROF_SEEN; + sprof_save_proc(p); + } + + sprof_save_sample(p, pc); + sprof_info.system_samples++; } else { /* User process. */ sprof_info.user_samples++; diff --git a/kernel/system/do_fork.c b/kernel/system/do_fork.c index 12c1610f9..631252a6b 100644 --- a/kernel/system/do_fork.c +++ b/kernel/system/do_fork.c @@ -79,7 +79,8 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr) rpc->p_sys_time = 0; rpc->p_reg.psw &= ~TRACEBIT; /* clear trace bit */ - rpc->p_misc_flags &= ~(MF_VIRT_TIMER | MF_PROF_TIMER | MF_SC_TRACE); + rpc->p_misc_flags &= + ~(MF_VIRT_TIMER | MF_PROF_TIMER | MF_SC_TRACE | MF_SPROF_SEEN); rpc->p_virt_left = 0; /* disable, clear the process-virtual timers */ rpc->p_prof_left = 0;