PERFORCE change 1199530 for review

John Baldwin jhb at FreeBSD.org
Mon Sep 8 04:52:51 UTC 2014


http://p4web.freebsd.org/@@1199530?ac=10

Change 1199530 by jhb at 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);


More information about the p4-projects mailing list