diff options
author | Luck <git@lucko.me> | 2019-06-15 17:15:30 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2019-06-15 17:15:43 +0100 |
commit | 35a3bf42fca8bae92780d87b1833cf4217a828f4 (patch) | |
tree | 23e62a19b1929a8c944e6c0019c7ca2fb37f9d6d /spark-common/src/main/java | |
parent | eedbb931fba57d398d62024cd77135610d6beadb (diff) | |
download | spark-35a3bf42fca8bae92780d87b1833cf4217a828f4.tar.gz spark-35a3bf42fca8bae92780d87b1833cf4217a828f4.tar.bz2 spark-35a3bf42fca8bae92780d87b1833cf4217a828f4.zip |
Return total time as a double
Diffstat (limited to 'spark-common/src/main/java')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/sampler/node/AbstractNode.java | 9 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/sampler/node/StackTraceNode.java | 2 |
2 files changed, 3 insertions, 8 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/node/AbstractNode.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/node/AbstractNode.java index 8c5975a..221b9cb 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/node/AbstractNode.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/node/AbstractNode.java @@ -30,7 +30,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.LongAdder; /** @@ -55,12 +54,8 @@ public abstract class AbstractNode { * * @return the total time */ - public long getTotalTime() { - long millis = TimeUnit.MICROSECONDS.toMillis(this.totalTime.longValue()); - if (millis == 0) { - return 1; - } - return millis; + public double getTotalTime() { + return this.totalTime.longValue() / 1000d; } private AbstractNode resolveChild(String className, String methodName, int lineNumber) { diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/node/StackTraceNode.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/node/StackTraceNode.java index c4e7ac4..80338e1 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/node/StackTraceNode.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/node/StackTraceNode.java @@ -75,7 +75,7 @@ public final class StackTraceNode extends AbstractNode implements Comparable<Sta @Override public int compareTo(StackTraceNode that) { - int i = -Long.compare(this.getTotalTime(), that.getTotalTime()); + int i = -Double.compare(this.getTotalTime(), that.getTotalTime()); if (i != 0) { return i; } |