public long getLatestQueryTime() { return _latestQueryTime.get(); }
/** * Return the current statistics resetting the internal values if reset is true. */ private DTimeMetricStats getStatistics(boolean reset) { if (reset) { // Note these values are not guaranteed to be consistent wrt each other // but should be reasonably consistent (small time between count and total) final long beans = beanCount.sumThenReset(); final long maxVal = max.getThenReset(); final long totalVal = total.sumThenReset(); final long countVal = count.sumThenReset(); final long startTimeVal = startTime.getAndSet(System.currentTimeMillis()); return new DTimeMetricStats(metricType, name, startTimeVal, countVal, totalVal, maxVal, beans); } else { return new DTimeMetricStats(metricType, name, startTime.get(), count.sum(), total.sum(), max.get(), beanCount.sum()); } }
public long getLatestQueryTime() { return latestQueryTime.get(); } }
/** * Return the current statistics reseting the internal values if reset is true. */ public ValueStatistics getStatistics(boolean reset) { if (reset) { // Note these values are not guaranteed to be consistent wrt each other // but should be reasonably consistent (small time between count and total) final long startTimeVal = startTime.getAndSet(System.currentTimeMillis()); final long countVal = count.sumThenReset(); final long totalVal = total.sumThenReset(); final long maxVal = max.getThenReset(); return new DefaultValueStatistics(startTimeVal, countVal, totalVal, maxVal); } else { return new DefaultValueStatistics(startTime.get(), count.sum(), total.sum(), max.get()); } }
/** * @return max counter value */ public long getMax() { return _max.get(); }
/** * Return a Snapshot of the query execution statistics potentially resetting the internal counters. */ Snapshot getSnapshot(boolean reset) { List<MetaQueryPlanOriginCount> origins = getOrigins(reset); // not guaranteed to be consistent due to time gaps between getting each value out of LongAdders but can live with that // relative to the cost of making sure count and totalTime etc are all guaranteed to be consistent if (reset) { return new Snapshot(queryPlan, count.sumThenReset(), totalTime.sumThenReset(), totalBeans.sumThenReset(), maxTime.getThenReset(), startTime.getAndSet(System.currentTimeMillis()), lastQueryTime, origins); } return new Snapshot(queryPlan, count.sum(), totalTime.sum(), totalBeans.sum(), maxTime.get(), startTime.get(), lastQueryTime, origins); }
/** * @return the max value of the recorded samples */ public long getMax() { return _max.get(); }
/** * Return the current statistics resetting the internal values if reset is true. */ private DTimeMetricStats getStatistics(boolean reset) { if (reset) { // Note these values are not guaranteed to be consistent wrt each other // but should be reasonably consistent (small time between count and total) final long beans = beanCount.sumThenReset(); final long maxVal = max.getThenReset(); final long totalVal = total.sumThenReset(); final long countVal = count.sumThenReset(); final long startTimeVal = startTime.getAndSet(System.currentTimeMillis()); return new DTimeMetricStats(metricType, name, startTimeVal, countVal, totalVal, maxVal, beans); } else { return new DTimeMetricStats(metricType, name, startTime.get(), count.sum(), total.sum(), max.get(), beanCount.sum()); } }
@Test @Ignore public void test() throws Exception { processor = WorkQueueProcessor.builder().name("test-processor").bufferSize(RINGBUFFER_SIZE).build(); Flux .create((emitter) -> burstyProducer(emitter, PRODUCED_MESSAGES_COUNT, BURST_SIZE)) .onBackpressureDrop(this::incrementDroppedMessagesCounter) // .log("test", Level.INFO, SignalType.REQUEST) .subscribeWith(processor) .map(this::complicatedCalculation) .subscribe(this::logConsumedValue); waitForProducerFinish(); System.out.println("\n\nMax ringbuffer pending: " + maxRingBufferPending.get()); assertEquals(getDroppedMessagesCount(), 0, "Expect zero dropped messages"); }
private <T> T checkAndUpdateLowerBound(Supplier<T> timestampContainerSupplier, ToLongFunction<T> lowerBoundExtractor, ToLongFunction<T> upperBoundExtractor) { long threadLocalLowerBound = lowerBound.get(); T timestampContainer = timestampContainerSupplier.get(); checkTimestamp(threadLocalLowerBound, lowerBoundExtractor.applyAsLong(timestampContainer)); updateLowerBound(upperBoundExtractor.applyAsLong(timestampContainer)); return timestampContainer; }
/** * Return the max value. */ public long getMax() { return max.get(); }
/** * @return the max value of the recorded samples */ public long getMax() { return _max.get(); }
/** * @return max counter value */ public long getMax() { return _max.get(); }
public long maxUsedCount() { return maxUsed.get(); }
@Override public Duration blockingTimeMax() { return ofNanos( maxAcquireDuration.get() ); }
@Override public Duration creationTimeMax() { return ofNanos( maxCreatedDuration.get() ); }
@Override public Long maximum() { return isEmpty() ? null : maximum.get(); }
@Override public Long minimum() { return isEmpty() ? null : minimum.get(); }
/** * Copy the mappings stored in a {@link LocatableResolver} to the specified replica. * * @param replica The {@link LocatableResolver} to copy to. * @return A future that will complete when the copy is finished. */ public CompletableFuture<Void> copyToAsync(@Nonnull final LocatableResolver replica) { if (!replica.getDatabase().equals(runner.getDatabase())) { throw new IllegalArgumentException("copy must be within same database"); } final LongAccumulator maxAccumulator = new LongAccumulator(Long::max, 0L); final AtomicInteger counter = new AtomicInteger(); return copyInternal(replica, maxAccumulator, counter) .thenCompose(ignore -> replica.setWindow(maxAccumulator.get())); }
private <T> T checkAndUpdateLowerBound(Supplier<T> timestampContainerSupplier, ToLongFunction<T> lowerBoundExtractor, ToLongFunction<T> upperBoundExtractor) { long threadLocalLowerBound = lowerBound.get(); T timestampContainer = timestampContainerSupplier.get(); checkTimestamp(threadLocalLowerBound, lowerBoundExtractor.applyAsLong(timestampContainer)); updateLowerBound(upperBoundExtractor.applyAsLong(timestampContainer)); return timestampContainer; }