Lines Matching refs:th
206 tc_delta(struct timehands *th) in tc_delta() argument
210 tc = th->th_counter; in tc_delta()
211 return ((tc->tc_get_timecount(tc) - th->th_offset_count) & in tc_delta()
241 struct timehands *th; in bintime_off() local
247 th = timehands; in bintime_off()
248 gen = atomic_load_acq_int(&th->th_generation); in bintime_off()
249 btp = (struct bintime *)((vm_offset_t)th + off); in bintime_off()
251 scale = th->th_scale; in bintime_off()
252 delta = tc_delta(th); in bintime_off()
253 large_delta = th->th_large_delta; in bintime_off()
255 } while (gen == 0 || gen != th->th_generation); in bintime_off()
270 struct timehands *th; in getthmember() local
274 th = timehands; in getthmember()
275 gen = atomic_load_acq_int(&th->th_generation); in getthmember()
276 memcpy(out, (char *)th + off, out_size); in getthmember()
278 } while (gen == 0 || gen != th->th_generation); in getthmember()
775 ffclock_change_tc(struct timehands *th) in ffclock_change_tc() argument
782 tc = th->th_counter; in ffclock_change_tc()
900 struct timehands *th; in ffclock_read_counter() local
909 th = timehands; in ffclock_read_counter()
910 gen = atomic_load_acq_int(&th->th_generation); in ffclock_read_counter()
912 delta = tc_delta(th); in ffclock_read_counter()
915 } while (gen == 0 || gen != th->th_generation); in ffclock_read_counter()
1050 struct timehands *th; in sysclock_getsnapshot() local
1066 th = timehands; in sysclock_getsnapshot()
1067 gen = atomic_load_acq_int(&th->th_generation); in sysclock_getsnapshot()
1068 fbi->th_scale = th->th_scale; in sysclock_getsnapshot()
1069 fbi->tick_time = th->th_offset; in sysclock_getsnapshot()
1080 delta = tc_delta(th); in sysclock_getsnapshot()
1082 } while (gen == 0 || gen != th->th_generation); in sysclock_getsnapshot()
1344 recalculate_scaling_factor_and_large_delta(struct timehands *th) in recalculate_scaling_factor_and_large_delta() argument
1349 scale += (th->th_adjustment / 1024) * 2199; in recalculate_scaling_factor_and_large_delta()
1350 scale /= th->th_counter->tc_frequency; in recalculate_scaling_factor_and_large_delta()
1351 th->th_scale = scale * 2; in recalculate_scaling_factor_and_large_delta()
1352 th->th_large_delta = MIN(((uint64_t)1 << 63) / scale, UINT_MAX); in recalculate_scaling_factor_and_large_delta()
1365 struct timehands *th, *tho; in tc_windup() local
1380 th = tho->th_next; in tc_windup()
1381 ogen = th->th_generation; in tc_windup()
1382 th->th_generation = 0; in tc_windup()
1384 memcpy(th, tho, offsetof(struct timehands, th_generation)); in tc_windup()
1386 th->th_boottime = *new_boottimebin; in tc_windup()
1394 delta = tc_delta(th); in tc_windup()
1395 if (th->th_counter != tc) in tc_windup()
1402 th->th_offset_count += delta; in tc_windup()
1403 th->th_offset_count &= th->th_counter->tc_counter_mask; in tc_windup()
1404 bintime_add_tc_delta(&th->th_offset, th->th_scale, in tc_windup()
1405 th->th_large_delta, delta); in tc_windup()
1427 bt = th->th_offset; in tc_windup()
1428 bintime_add(&bt, &th->th_boottime); in tc_windup()
1436 ntp_update_second(&th->th_adjustment, &bt.sec); in tc_windup()
1438 th->th_boottime.sec += bt.sec - t; in tc_windup()
1442 recalculate_scaling_factor_and_large_delta(th); in tc_windup()
1446 th->th_bintime = bt; in tc_windup()
1447 bintime2timeval(&bt, &th->th_microtime); in tc_windup()
1448 bintime2timespec(&bt, &th->th_nanotime); in tc_windup()
1451 if (th->th_counter != tc) { in tc_windup()
1455 if ((th->th_counter->tc_flags & TC_FLAGS_C2STOP) != 0) in tc_windup()
1458 th->th_counter = tc; in tc_windup()
1459 th->th_offset_count = ncount; in tc_windup()
1462 recalculate_scaling_factor_and_large_delta(th); in tc_windup()
1464 ffclock_change_tc(th); in tc_windup()
1474 atomic_store_rel_int(&th->th_generation, ogen); in tc_windup()
1481 time_second = th->th_microtime.tv_sec; in tc_windup()
1482 time_uptime = th->th_offset.sec; in tc_windup()
1492 timehands = th; in tc_windup()
1763 struct timehands *th; in pps_capture() local
1767 th = timehands; in pps_capture()
1768 pps->capgen = atomic_load_acq_int(&th->th_generation); in pps_capture()
1769 pps->capth = th; in pps_capture()
1773 tc = th->th_counter; in pps_capture()
2190 struct timehands *th; in tc_fill_vdso_timehands() local
2193 th = timehands; in tc_fill_vdso_timehands()
2194 vdso_th->th_scale = th->th_scale; in tc_fill_vdso_timehands()
2195 vdso_th->th_offset_count = th->th_offset_count; in tc_fill_vdso_timehands()
2196 vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; in tc_fill_vdso_timehands()
2197 vdso_th->th_offset = th->th_offset; in tc_fill_vdso_timehands()
2198 vdso_th->th_boottime = th->th_boottime; in tc_fill_vdso_timehands()
2199 if (th->th_counter->tc_fill_vdso_timehands != NULL) { in tc_fill_vdso_timehands()
2200 enabled = th->th_counter->tc_fill_vdso_timehands(vdso_th, in tc_fill_vdso_timehands()
2201 th->th_counter); in tc_fill_vdso_timehands()
2213 struct timehands *th; in tc_fill_vdso_timehands32() local
2216 th = timehands; in tc_fill_vdso_timehands32()
2217 *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; in tc_fill_vdso_timehands32()
2218 vdso_th32->th_offset_count = th->th_offset_count; in tc_fill_vdso_timehands32()
2219 vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; in tc_fill_vdso_timehands32()
2220 vdso_th32->th_offset.sec = th->th_offset.sec; in tc_fill_vdso_timehands32()
2221 *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; in tc_fill_vdso_timehands32()
2222 vdso_th32->th_boottime.sec = th->th_boottime.sec; in tc_fill_vdso_timehands32()
2223 *(uint64_t *)&vdso_th32->th_boottime.frac[0] = th->th_boottime.frac; in tc_fill_vdso_timehands32()
2224 if (th->th_counter->tc_fill_vdso_timehands32 != NULL) { in tc_fill_vdso_timehands32()
2225 enabled = th->th_counter->tc_fill_vdso_timehands32(vdso_th32, in tc_fill_vdso_timehands32()
2226 th->th_counter); in tc_fill_vdso_timehands32()
2241 struct timehands *th; in DB_SHOW_COMMAND() local
2245 th = timehands; in DB_SHOW_COMMAND()
2246 tc = th->th_counter; in DB_SHOW_COMMAND()
2257 (uintmax_t)th->th_adjustment, (uintmax_t)th->th_scale, in DB_SHOW_COMMAND()
2258 th->th_large_delta, th->th_offset_count, th->th_generation); in DB_SHOW_COMMAND()
2260 (intmax_t)th->th_offset.sec, (uintmax_t)th->th_offset.frac, in DB_SHOW_COMMAND()
2261 (intmax_t)th->th_boottime.sec, (uintmax_t)th->th_boottime.frac); in DB_SHOW_COMMAND()