aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_time.c')
-rw-r--r--sys/kern/kern_time.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 9820509f950b..be9e5c830ab0 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -280,6 +280,8 @@ get_process_cputime(struct proc *targetp, struct timespec *ats)
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);
}