| 269 | } |
| 270 | |
| 271 | void |
| 272 | kern_process_cputime(struct proc *targetp, struct timespec *ats) |
| 273 | { |
| 274 | uint64_t runtime; |
| 275 | struct rusage ru; |
| 276 | |
| 277 | PROC_LOCK_ASSERT(targetp, MA_OWNED); |
| 278 | PROC_STATLOCK(targetp); |
| 279 | rufetch(targetp, &ru); |
| 280 | runtime = targetp->p_rux.rux_runtime; |
| 281 | if (curthread->td_proc == targetp) |
| 282 | runtime += cpu_ticks() - PCPU_GET(switchtime); |
| 283 | PROC_STATUNLOCK(targetp); |
| 284 | cputick2timespec(runtime, ats); |
| 285 | } |
| 286 | |
| 287 | static int |
| 288 | get_cputime(struct thread *td, clockid_t clock_id, struct timespec *ats) |
no test coverage detected