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

Function sys_profil

freebsd/kern/subr_prof.c:409–437  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

407#endif
408/* ARGSUSED */
409int
410sys_profil(struct thread *td, struct profil_args *uap)
411{
412 struct uprof *upp;
413 struct proc *p;
414
415 if (uap->scale > (1 << 16))
416 return (EINVAL);
417
418 p = td->td_proc;
419 if (uap->scale == 0) {
420 PROC_LOCK(p);
421 stopprofclock(p);
422 PROC_UNLOCK(p);
423 return (0);
424 }
425 PROC_LOCK(p);
426 upp = &td->td_proc->p_stats->p_prof;
427 PROC_PROFLOCK(p);
428 upp->pr_off = uap->offset;
429 upp->pr_scale = uap->scale;
430 upp->pr_base = uap->samples;
431 upp->pr_size = uap->size;
432 PROC_PROFUNLOCK(p);
433 startprofclock(p);
434 PROC_UNLOCK(p);
435
436 return (0);
437}
438
439/*
440 * Scale is a fixed-point number with the binary point 16 bits

Callers

nothing calls this directly

Calls 2

stopprofclockFunction · 0.85
startprofclockFunction · 0.85

Tested by

no test coverage detected