MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_thread_cputime

Function kern_thread_cputime

freebsd/kern/kern_time.c:250–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void
251kern_thread_cputime(struct thread *targettd, struct timespec *ats)
252{
253 uint64_t runtime, curtime, switchtime;
254
255 if (targettd == NULL) { /* current thread */
256 critical_enter();
257 switchtime = PCPU_GET(switchtime);
258 curtime = cpu_ticks();
259 runtime = curthread->td_runtime;
260 critical_exit();
261 runtime += curtime - switchtime;
262 } else {
263 PROC_LOCK_ASSERT(targettd->td_proc, MA_OWNED);
264 thread_lock(targettd);
265 runtime = targettd->td_runtime;
266 thread_unlock(targettd);
267 }
268 cputick2timespec(runtime, ats);
269}
270
271void
272kern_process_cputime(struct proc *targetp, struct timespec *ats)

Callers 2

get_cputimeFunction · 0.85
kern_clock_gettimeFunction · 0.85

Calls 3

cputick2timespecFunction · 0.85
critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected