/** * Initializes and calibrates the clock based on wall clock time * * @return the epoch microsecond timestamp at initialization time */ public long init() { return init(System.currentTimeMillis() * 1000, System.nanoTime()); }
public void copyFrom(TraceContext other) { traceId.copyFrom(other.traceId); id.copyFrom(other.id); parentId.copyFrom(other.parentId); transactionId.copyFrom(other.transactionId); outgoingHeader.append(other.outgoingHeader); flags = other.flags; clock.init(other.clock); onMutation(); }
public void asRootSpan(Sampler sampler) { traceId.setToRandomValue(); id.setToRandomValue(); transactionId.copyFrom(id); if (sampler.isSampled(traceId)) { this.flags = FLAG_RECORDED; } clock.init(); onMutation(); }
clock.init(); return true; } catch (IllegalArgumentException e) {
public void asChildOf(TraceContext parent) { traceId.copyFrom(parent.traceId); parentId.copyFrom(parent.id); transactionId.copyFrom(parent.transactionId); flags = parent.flags; id.setToRandomValue(); clock.init(parent.clock); onMutation(); }
@Test void testEpochMicros() { epochTickClock.init(0, 0); final int nanoTime = 1000; assertThat(epochTickClock.getEpochMicros(nanoTime)).isEqualTo(TimeUnit.NANOSECONDS.toMicros(nanoTime)); } }