From 161d3bdfbfe331a1ea3c6da1d096e86fd7a5c525 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 21 Feb 2019 13:06:10 +0000 Subject: Allow sampling at fractions of a millisecond intervals --- spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java') diff --git a/spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java b/spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java index 3a9a271..2e8ac65 100644 --- a/spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java +++ b/spark-common/src/main/java/me/lucko/spark/sampler/Sampler.java @@ -23,6 +23,7 @@ package me.lucko.spark.sampler; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.gson.stream.JsonWriter; + import me.lucko.spark.sampler.aggregator.DataAggregator; import me.lucko.spark.sampler.aggregator.SimpleDataAggregator; import me.lucko.spark.sampler.aggregator.TickedDataAggregator; @@ -71,7 +72,7 @@ public class Sampler implements Runnable { /** A future to encapsulation the completion of this sampler instance */ private final CompletableFuture future = new CompletableFuture<>(); - /** The interval to wait between sampling, in milliseconds */ + /** The interval to wait between sampling, in microseconds */ private final int interval; /** The time when sampling first began */ private long startTime = -1; @@ -98,7 +99,7 @@ public class Sampler implements Runnable { public void start() { this.startTime = System.currentTimeMillis(); this.dataAggregator.start(); - this.task = this.workerPool.scheduleAtFixedRate(this, 0, this.interval, TimeUnit.MILLISECONDS); + this.task = this.workerPool.scheduleAtFixedRate(this, 0, this.interval, TimeUnit.MICROSECONDS); } public long getStartTime() { -- cgit