* Schedule binuptime of the next event on current CPU. */
| 229 | * Schedule binuptime of the next event on current CPU. |
| 230 | */ |
| 231 | static sbintime_t |
| 232 | getnextcpuevent(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. |
no outgoing calls
no test coverage detected