Lines Matching refs:th

185 tc_delta(struct timehands *th)  in tc_delta()  argument
189 tc = th->th_counter; in tc_delta()
190 return ((tc->tc_get_timecount(tc) - th->th_offset_count) & in tc_delta()
204 struct timehands *th; in fbclock_binuptime() local
208 th = timehands; in fbclock_binuptime()
209 gen = atomic_load_acq_int(&th->th_generation); in fbclock_binuptime()
210 *bt = th->th_offset; in fbclock_binuptime()
211 bintime_addx(bt, th->th_scale * tc_delta(th)); in fbclock_binuptime()
213 } while (gen == 0 || gen != th->th_generation); in fbclock_binuptime()
263 struct timehands *th; in fbclock_getbinuptime() local
267 th = timehands; in fbclock_getbinuptime()
268 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getbinuptime()
269 *bt = th->th_offset; in fbclock_getbinuptime()
271 } while (gen == 0 || gen != th->th_generation); in fbclock_getbinuptime()
277 struct timehands *th; in fbclock_getnanouptime() local
281 th = timehands; in fbclock_getnanouptime()
282 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getnanouptime()
283 bintime2timespec(&th->th_offset, tsp); in fbclock_getnanouptime()
285 } while (gen == 0 || gen != th->th_generation); in fbclock_getnanouptime()
291 struct timehands *th; in fbclock_getmicrouptime() local
295 th = timehands; in fbclock_getmicrouptime()
296 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getmicrouptime()
297 bintime2timeval(&th->th_offset, tvp); in fbclock_getmicrouptime()
299 } while (gen == 0 || gen != th->th_generation); in fbclock_getmicrouptime()
305 struct timehands *th; in fbclock_getbintime() local
309 th = timehands; in fbclock_getbintime()
310 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getbintime()
311 *bt = th->th_offset; in fbclock_getbintime()
313 } while (gen == 0 || gen != th->th_generation); in fbclock_getbintime()
320 struct timehands *th; in fbclock_getnanotime() local
324 th = timehands; in fbclock_getnanotime()
325 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getnanotime()
326 *tsp = th->th_nanotime; in fbclock_getnanotime()
328 } while (gen == 0 || gen != th->th_generation); in fbclock_getnanotime()
334 struct timehands *th; in fbclock_getmicrotime() local
338 th = timehands; in fbclock_getmicrotime()
339 gen = atomic_load_acq_int(&th->th_generation); in fbclock_getmicrotime()
340 *tvp = th->th_microtime; in fbclock_getmicrotime()
342 } while (gen == 0 || gen != th->th_generation); in fbclock_getmicrotime()
348 struct timehands *th; in binuptime() local
352 th = timehands; in binuptime()
353 gen = atomic_load_acq_int(&th->th_generation); in binuptime()
354 *bt = th->th_offset; in binuptime()
355 bintime_addx(bt, th->th_scale * tc_delta(th)); in binuptime()
357 } while (gen == 0 || gen != th->th_generation); in binuptime()
407 struct timehands *th; in getbinuptime() local
411 th = timehands; in getbinuptime()
412 gen = atomic_load_acq_int(&th->th_generation); in getbinuptime()
413 *bt = th->th_offset; in getbinuptime()
415 } while (gen == 0 || gen != th->th_generation); in getbinuptime()
421 struct timehands *th; in getnanouptime() local
425 th = timehands; in getnanouptime()
426 gen = atomic_load_acq_int(&th->th_generation); in getnanouptime()
427 bintime2timespec(&th->th_offset, tsp); in getnanouptime()
429 } while (gen == 0 || gen != th->th_generation); in getnanouptime()
435 struct timehands *th; in getmicrouptime() local
439 th = timehands; in getmicrouptime()
440 gen = atomic_load_acq_int(&th->th_generation); in getmicrouptime()
441 bintime2timeval(&th->th_offset, tvp); in getmicrouptime()
443 } while (gen == 0 || gen != th->th_generation); in getmicrouptime()
449 struct timehands *th; in getbintime() local
453 th = timehands; in getbintime()
454 gen = atomic_load_acq_int(&th->th_generation); in getbintime()
455 *bt = th->th_offset; in getbintime()
457 } while (gen == 0 || gen != th->th_generation); in getbintime()
464 struct timehands *th; in getnanotime() local
468 th = timehands; in getnanotime()
469 gen = atomic_load_acq_int(&th->th_generation); in getnanotime()
470 *tsp = th->th_nanotime; in getnanotime()
472 } while (gen == 0 || gen != th->th_generation); in getnanotime()
478 struct timehands *th; in getmicrotime() local
482 th = timehands; in getmicrotime()
483 gen = atomic_load_acq_int(&th->th_generation); in getmicrotime()
484 *tvp = th->th_microtime; in getmicrotime()
486 } while (gen == 0 || gen != th->th_generation); in getmicrotime()
764 ffclock_change_tc(struct timehands *th) in ffclock_change_tc() argument
771 tc = th->th_counter; in ffclock_change_tc()
889 struct timehands *th; in ffclock_read_counter() local
898 th = timehands; in ffclock_read_counter()
899 gen = atomic_load_acq_int(&th->th_generation); in ffclock_read_counter()
901 delta = tc_delta(th); in ffclock_read_counter()
904 } while (gen == 0 || gen != th->th_generation); in ffclock_read_counter()
1003 struct timehands *th; in dtrace_getnanotime() local
1007 th = timehands; in dtrace_getnanotime()
1008 gen = atomic_load_acq_int(&th->th_generation); in dtrace_getnanotime()
1009 *tsp = th->th_nanotime; in dtrace_getnanotime()
1011 } while (gen == 0 || gen != th->th_generation); in dtrace_getnanotime()
1032 struct timehands *th; in sysclock_getsnapshot() local
1048 th = timehands; in sysclock_getsnapshot()
1049 gen = atomic_load_acq_int(&th->th_generation); in sysclock_getsnapshot()
1050 fbi->th_scale = th->th_scale; in sysclock_getsnapshot()
1051 fbi->tick_time = th->th_offset; in sysclock_getsnapshot()
1062 delta = tc_delta(th); in sysclock_getsnapshot()
1064 } while (gen == 0 || gen != th->th_generation); in sysclock_getsnapshot()
1271 struct timehands *th, *tho; in tc_windup() local
1287 th = tho->th_next; in tc_windup()
1288 ogen = th->th_generation; in tc_windup()
1289 th->th_generation = 0; in tc_windup()
1291 bcopy(tho, th, offsetof(struct timehands, th_generation)); in tc_windup()
1298 delta = tc_delta(th); in tc_windup()
1299 if (th->th_counter != timecounter) in tc_windup()
1306 th->th_offset_count += delta; in tc_windup()
1307 th->th_offset_count &= th->th_counter->tc_counter_mask; in tc_windup()
1308 while (delta > th->th_counter->tc_frequency) { in tc_windup()
1310 delta -= th->th_counter->tc_frequency; in tc_windup()
1311 th->th_offset.sec++; in tc_windup()
1313 if ((delta > th->th_counter->tc_frequency / 2) && in tc_windup()
1314 (th->th_scale * delta < ((uint64_t)1 << 63))) { in tc_windup()
1316 th->th_offset.sec++; in tc_windup()
1318 bintime_addx(&th->th_offset, th->th_scale * delta); in tc_windup()
1340 bt = th->th_offset; in tc_windup()
1347 ntp_update_second(&th->th_adjustment, &bt.sec); in tc_windup()
1353 bintime2timeval(&bt, &th->th_microtime); in tc_windup()
1354 bintime2timespec(&bt, &th->th_nanotime); in tc_windup()
1357 if (th->th_counter != timecounter) { in tc_windup()
1361 if ((th->th_counter->tc_flags & TC_FLAGS_C2STOP) != 0) in tc_windup()
1364 th->th_counter = timecounter; in tc_windup()
1365 th->th_offset_count = ncount; in tc_windup()
1369 ffclock_change_tc(th); in tc_windup()
1397 scale += (th->th_adjustment / 1024) * 2199; in tc_windup()
1398 scale /= th->th_counter->tc_frequency; in tc_windup()
1399 th->th_scale = scale * 2; in tc_windup()
1407 atomic_store_rel_int(&th->th_generation, ogen); in tc_windup()
1414 time_second = th->th_microtime.tv_sec; in tc_windup()
1415 time_uptime = th->th_offset.sec; in tc_windup()
1425 timehands = th; in tc_windup()
1684 struct timehands *th; in pps_capture() local
1687 th = timehands; in pps_capture()
1688 pps->capgen = atomic_load_acq_int(&th->th_generation); in pps_capture()
1689 pps->capth = th; in pps_capture()
1693 pps->capcount = th->th_counter->tc_get_timecount(th->th_counter); in pps_capture()
1695 if (pps->capgen != th->th_generation) in pps_capture()
2089 struct timehands *th; in tc_fill_vdso_timehands() local
2092 th = timehands; in tc_fill_vdso_timehands()
2094 vdso_th->th_scale = th->th_scale; in tc_fill_vdso_timehands()
2095 vdso_th->th_offset_count = th->th_offset_count; in tc_fill_vdso_timehands()
2096 vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; in tc_fill_vdso_timehands()
2097 vdso_th->th_offset = th->th_offset; in tc_fill_vdso_timehands()
2099 enabled = cpu_fill_vdso_timehands(vdso_th, th->th_counter); in tc_fill_vdso_timehands()
2109 struct timehands *th; in tc_fill_vdso_timehands32() local
2112 th = timehands; in tc_fill_vdso_timehands32()
2114 *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; in tc_fill_vdso_timehands32()
2115 vdso_th32->th_offset_count = th->th_offset_count; in tc_fill_vdso_timehands32()
2116 vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; in tc_fill_vdso_timehands32()
2117 vdso_th32->th_offset.sec = th->th_offset.sec; in tc_fill_vdso_timehands32()
2118 *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; in tc_fill_vdso_timehands32()
2121 enabled = cpu_fill_vdso_timehands32(vdso_th32, th->th_counter); in tc_fill_vdso_timehands32()