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

Function cpu_idleclock

freebsd/kern/kern_clocksource.c:760–788  ·  view source on GitHub ↗

* Switch to idle mode (all ticks handled). */

Source from the content-addressed store, hash-verified

758 * Switch to idle mode (all ticks handled).
759 */
760sbintime_t
761cpu_idleclock(void)
762{
763 sbintime_t now, t;
764 struct pcpu_state *state;
765
766 if (idletick || busy ||
767 (periodic && (timer->et_flags & ET_FLAGS_PERCPU))
768#ifdef DEVICE_POLLING
769 || curcpu == CPU_FIRST()
770#endif
771 )
772 return (-1);
773 state = DPCPU_PTR(timerstate);
774 if (periodic)
775 now = state->now;
776 else
777 now = sbinuptime();
778 CTR3(KTR_SPARE2, "idle at %d: now %d.%08x",
779 curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff));
780 t = getnextcpuevent(1);
781 ET_HW_LOCK(state);
782 state->idle = 1;
783 state->nextevent = t;
784 if (!periodic)
785 loadtimer(now, 0);
786 ET_HW_UNLOCK(state);
787 return (MAX(t - now, 0));
788}
789
790/*
791 * Switch to active mode (skip empty ticks).

Callers 4

cpu_idleFunction · 0.85
cpu_idleFunction · 0.85
cpu_idleFunction · 0.85
cpu_idleFunction · 0.85

Calls 3

sbinuptimeFunction · 0.85
getnextcpueventFunction · 0.85
loadtimerFunction · 0.85

Tested by

no test coverage detected