Lines Matching refs:cr
127 counter_ratecheck(struct counter_rate *cr, int64_t limit) in counter_ratecheck() argument
132 val = cr->cr_over; in counter_ratecheck()
135 if ((u_int)(now - cr->cr_ticks) >= hz) { in counter_ratecheck()
140 if ((cr->cr_lock == 0) && in counter_ratecheck()
141 atomic_cmpset_acq_int(&cr->cr_lock, 0, 1)) { in counter_ratecheck()
146 if ((u_int)(now - cr->cr_ticks) >= hz) { in counter_ratecheck()
147 val = counter_u64_fetch(cr->cr_rate); in counter_ratecheck()
148 counter_u64_zero(cr->cr_rate); in counter_ratecheck()
149 cr->cr_over = 0; in counter_ratecheck()
150 cr->cr_ticks = now; in counter_ratecheck()
154 atomic_store_rel_int(&cr->cr_lock, 0); in counter_ratecheck()
164 counter_u64_add(cr->cr_rate, 1); in counter_ratecheck()
165 if (cr->cr_over != 0) in counter_ratecheck()
167 if (counter_u64_fetch(cr->cr_rate) > limit) in counter_ratecheck()
168 val = cr->cr_over = -1; in counter_ratecheck()