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

Function getnextcpuevent

freebsd/kern/kern_clocksource.c:231–262  ·  view source on GitHub ↗

* Schedule binuptime of the next event on current CPU. */

Source from the content-addressed store, hash-verified

229 * Schedule binuptime of the next event on current CPU.
230 */
231static sbintime_t
232getnextcpuevent(int idle)
233{
234 sbintime_t event;
235 struct pcpu_state *state;
236 u_int hardfreq;
237
238 state = DPCPU_PTR(timerstate);
239 /* Handle hardclock() events, skipping some if CPU is idle. */
240 event = state->nexthard;
241 if (idle) {
242 hardfreq = (u_int)hz / 2;
243 if (tc_min_ticktock_freq > 2
244#ifdef SMP
245 && curcpu == CPU_FIRST()
246#endif
247 )
248 hardfreq = hz / tc_min_ticktock_freq;
249 if (hardfreq > 1)
250 event += tick_sbt * (hardfreq - 1);
251 }
252 /* Handle callout events. */
253 if (event > state->nextcall)
254 event = state->nextcall;
255 if (!idle) { /* If CPU is active - handle other types of events. */
256 if (event > state->nextstat)
257 event = state->nextstat;
258 if (profiling && event > state->nextprof)
259 event = state->nextprof;
260 }
261 return (event);
262}
263
264/*
265 * Schedule binuptime of the next event on all CPUs.

Callers 2

handleeventsFunction · 0.85
cpu_idleclockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected