Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jun 2018 21:36:35 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335828 - stable/11/sys/kern
Message-ID:  <201806302136.w5ULaZdP095516@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806302136.w5ULaZdP095516>