aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko/spark/common/util
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2023-03-19 19:35:29 +0000
committerLuck <git@lucko.me>2023-03-19 19:35:29 +0000
commita70ccb394839c63f13b3e6ff5539c0a042925d2f (patch)
tree400f3a80ec19238831f5994b319cdbf4e168f1f3 /spark-common/src/main/java/me/lucko/spark/common/util
parent6cdd78a0c57d751d3a44b319703c20b034f8d675 (diff)
downloadspark-a70ccb394839c63f13b3e6ff5539c0a042925d2f.tar.gz
spark-a70ccb394839c63f13b3e6ff5539c0a042925d2f.tar.bz2
spark-a70ccb394839c63f13b3e6ff5539c0a042925d2f.zip
Allow platforms to provide their own TPS/MSPT calculations
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/util')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java11
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java4
2 files changed, 3 insertions, 12 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java b/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java
index 65753bc..57dfdff 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java
@@ -21,7 +21,6 @@
package me.lucko.spark.common.util;
import me.lucko.spark.api.statistic.misc.DoubleAverageInfo;
-import me.lucko.spark.proto.SparkProtos;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -112,14 +111,4 @@ public class RollingAverage implements DoubleAverageInfo {
return sortedSamples[rank].doubleValue();
}
- public SparkProtos.RollingAverageValues toProto() {
- return SparkProtos.RollingAverageValues.newBuilder()
- .setMean(mean())
- .setMax(max())
- .setMin(min())
- .setMedian(median())
- .setPercentile95(percentile95th())
- .build();
- }
-
}
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java b/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
index 22ee9bb..b488f50 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/util/StatisticFormatter.java
@@ -22,6 +22,8 @@ package me.lucko.spark.common.util;
import com.google.common.base.Strings;
+import me.lucko.spark.api.statistic.misc.DoubleAverageInfo;
+
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.TextColor;
@@ -55,7 +57,7 @@ public enum StatisticFormatter {
return text((tps > 20.0 ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0), color);
}
- public static TextComponent formatTickDurations(RollingAverage average) {
+ public static TextComponent formatTickDurations(DoubleAverageInfo average) {
return text()
.append(formatTickDuration(average.min()))
.append(text('/', GRAY))