Lines Matching defs:th

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