MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bintime_off

Function bintime_off

freebsd/kern/kern_tc.c:213–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211 */
212
213static __inline void
214bintime_off(struct bintime *bt, u_int off)
215{
216 struct timehands *th;
217 struct bintime *btp;
218 uint64_t scale, x;
219 u_int delta, gen, large_delta;
220
221 do {
222 th = timehands;
223 gen = atomic_load_acq_int(&th->th_generation);
224 btp = (struct bintime *)((vm_offset_t)th + off);
225 *bt = *btp;
226 scale = th->th_scale;
227 delta = tc_delta(th);
228 large_delta = th->th_large_delta;
229 atomic_thread_fence_acq();
230 } while (gen == 0 || gen != th->th_generation);
231
232 if (__predict_false(delta >= large_delta)) {
233 /* Avoid overflow for scale * delta. */
234 x = (scale >> 32) * delta;
235 bt->sec += x >> 32;
236 bintime_addx(bt, x << 32);
237 bintime_addx(bt, (scale & 0xffffffff) * delta);
238 } else {
239 bintime_addx(bt, scale * delta);
240 }
241}
242#define GETTHBINTIME(dst, member) \
243do { \
244 bintime_off(dst, __offsetof(struct timehands, member)); \

Callers

nothing calls this directly

Calls 3

tc_deltaFunction · 0.85
bintime_addxFunction · 0.85
atomic_thread_fence_acqFunction · 0.50

Tested by

no test coverage detected