svn commit: r335828 - stable/11/sys/kern

Colin Percival cperciva at FreeBSD.org
Sat Jun 30 21:36:36 UTC 2018


Author: cperciva
Date: Sat Jun 30 21:36:35 2018
New Revision: 335828
URL: https://svnweb.freebsd.org/changeset/base/335828

Log:
  MFC r335553: Make CLOCK_PROCESS_CPUTIME_ID more accurate by including
  the current timeslice, matching the behaviour of CLOCK_VIRTUAL and
  CLOCK_PROF.

Modified:
  stable/11/sys/kern/kern_time.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_time.c
==============================================================================
--- stable/11/sys/kern/kern_time.c	Sat Jun 30 20:15:11 2018	(r335827)
+++ stable/11/sys/kern/kern_time.c	Sat Jun 30 21:36:35 2018	(r335828)
@@ -278,6 +278,8 @@ get_process_cputime(struct proc *targetp, struct times
 	PROC_STATLOCK(targetp);
 	rufetch(targetp, &ru);
 	runtime = targetp->p_rux.rux_runtime;
+	if (curthread->td_proc == targetp)
+		runtime += cpu_ticks() - PCPU_GET(switchtime);
 	PROC_STATUNLOCK(targetp);
 	cputick2timespec(runtime, ats);
 }


More information about the svn-src-all mailing list