Lines Matching defs:timer
88 "Show ntoskrnl timer stats");
1615 * KeWaitForSingleObject() on NDIS timer and event objects, so we
1616 * have to support that as well. Conseqently, our NDIS timer and event
1617 * code has to be closely tied into our ntoskrnl timer and event code,
1629 * - For timers, if the timer has already fired and the timer is in
1631 * timer. Unlike an event, timers get signalled automatically when
1634 * events: KeInitializeTimerEx() lets you initialize a timer as
3396 * a timer or event object, you actually end up with an
3405 * a timer object by simply allocating the memory for a ktimer
3407 * the timer has no object_header and no reference counting or
3613 ktimer *timer;
3619 timer = arg;
3624 ntoskrnl_remove_timer(timer);
3631 if (timer->k_header.dh_inserted == FALSE) {
3633 printf("NTOS: timer %p fired even though "
3634 "it was canceled\n", timer);
3638 /* Mark the timer as no longer being on the timer queue. */
3640 timer->k_header.dh_inserted = FALSE;
3644 timer->k_header.dh_sigstate = 1;
3645 ntoskrnl_waittest(&timer->k_header, IO_NO_INCREMENT);
3648 * If this is a periodic timer, re-arm it
3651 * it's possible the DPC might cancel the timer,
3656 if (timer->k_period) {
3658 tv.tv_usec = timer->k_period * 1000;
3659 timer->k_header.dh_inserted = TRUE;
3660 ntoskrnl_insert_timer(timer, tvtohz(&tv));
3666 dpc = timer->k_dpc;
3670 /* If there's a DPC associated with the timer, queue it up. */
3703 printf("timer sets: %qu\n", ntoskrnl_timer_sets);
3704 printf("timer reloads: %qu\n", ntoskrnl_timer_reloads);
3705 printf("timer cancels: %qu\n", ntoskrnl_timer_cancels);
3706 printf("timer fires: %qu\n", ntoskrnl_timer_fires);
3716 ntoskrnl_insert_timer(timer, ticks)
3717 ktimer *timer;
3725 * Try and allocate a timer.
3741 timer->k_callout = c;
3744 callout_reset(c, ticks, ntoskrnl_timercall, timer);
3748 ntoskrnl_remove_timer(timer)
3749 ktimer *timer;
3753 e = (callout_entry *)timer->k_callout;
3754 callout_stop(timer->k_callout);
3762 KeInitializeTimer(timer)
3763 ktimer *timer;
3765 if (timer == NULL)
3768 KeInitializeTimerEx(timer, EVENT_TYPE_NOTIFY);
3772 KeInitializeTimerEx(timer, type)
3773 ktimer *timer;
3776 if (timer == NULL)
3779 bzero((char *)timer, sizeof(ktimer));
3780 InitializeListHead((&timer->k_header.dh_waitlisthead));
3781 timer->k_header.dh_sigstate = FALSE;
3782 timer->k_header.dh_inserted = FALSE;
3784 timer->k_header.dh_type = DISP_TYPE_NOTIFICATION_TIMER;
3786 timer->k_header.dh_type = DISP_TYPE_SYNCHRONIZATION_TIMER;
3787 timer->k_header.dh_size = sizeof(ktimer) / sizeof(uint32_t);
4072 KeSetTimerEx(timer, duetime, period, dpc)
4073 ktimer *timer;
4082 if (timer == NULL)
4087 if (timer->k_header.dh_inserted == TRUE) {
4088 ntoskrnl_remove_timer(timer);
4092 timer->k_header.dh_inserted = FALSE;
4097 timer->k_duetime = duetime;
4098 timer->k_period = period;
4099 timer->k_header.dh_sigstate = FALSE;
4100 timer->k_dpc = dpc;
4117 timer->k_header.dh_inserted = TRUE;
4118 ntoskrnl_insert_timer(timer, tvtohz(&tv));
4129 KeSetTimer(timer, duetime, dpc)
4130 ktimer *timer;
4134 return (KeSetTimerEx(timer, duetime, 0, dpc));
4139 * a timer that has a DPC will result in the DPC also being
4144 KeCancelTimer(timer)
4145 ktimer *timer;
4149 if (timer == NULL)
4154 pending = timer->k_header.dh_inserted;
4156 if (timer->k_header.dh_inserted == TRUE) {
4157 timer->k_header.dh_inserted = FALSE;
4158 ntoskrnl_remove_timer(timer);
4170 KeReadStateTimer(timer)
4171 ktimer *timer;
4173 return (timer->k_header.dh_sigstate);
4179 ktimer timer;
4184 KeInitializeTimer(&timer);
4185 KeSetTimer(&timer, *interval, NULL);
4186 KeWaitForSingleObject(&timer, 0, 0, alertable, NULL);