Date: Mon, 8 Sep 2014 04:51:21 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 1199530 for review Message-ID: <201409080451.s884pLh6027256@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1199530?ac=10 Change 1199530 by jhb@jhb_pippin on 2014/08/29 16:53:45 Fix ki_stamp for threads. Affected files ... .. //depot/projects/smpng/sys/kern/kern_proc.c#137 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_proc.c#137 (text+ko) ==== @@ -785,12 +785,12 @@ static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) { + struct timeval uptime; struct thread *td0; struct tty *tp; struct session *sp; struct ucred *cred; struct sigacts *ps; - struct timeval uptime; /* For proc_realparent. */ sx_assert(&proctree_lock, SX_LOCKED); @@ -873,10 +873,10 @@ kp->ki_fibnum = p->p_fibnum; kp->ki_start = p->p_stats->p_start; timevaladd(&kp->ki_start, &boottime); + PROC_SLOCK(p); microuptime(&uptime); /* Wrapping is ok as this is only used to compute deltas. */ kp->ki_stamp = uptime.tv_sec * 1000000 + uptime.tv_usec; - PROC_SLOCK(p); rufetch(p, &kp->ki_rusage); kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime); calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); @@ -940,6 +940,7 @@ static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread) { + struct timeval uptime; struct proc *p; p = td->td_proc; @@ -999,6 +1000,9 @@ kp->ki_pri.pri_user = td->td_user_pri; if (preferthread) { + microuptime(&uptime); + /* Wrapping is ok as this is only used to compute deltas. */ + kp->ki_stamp = uptime.tv_sec * 1000000 + uptime.tv_usec; rufetchtd(td, &kp->ki_rusage); kp->ki_runtime = cputick2usec(td->td_rux.rux_runtime); kp->ki_pctcpu = sched_pctcpu(td);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409080451.s884pLh6027256>
