Skip to content

Commit

Permalink
Revert 5s->15s tps sample change
Browse files Browse the repository at this point in the history
The issues with bad readings after startup or tick pauses will be fixed separately later
  • Loading branch information
jpenilla committed Jan 5, 2025
1 parent 2fded0c commit b67a3eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void executeTickInfo(final @NonNull CommandContext<Commander> ctx) {
.append(space());
final Iterator<Double> tpsIterator = Arrays.stream(tps).iterator();
final Deque<String> tpsDurations = tps.length == 4
? new ArrayDeque<>(Arrays.asList("15s", "1m", "5m", "15m"))
? new ArrayDeque<>(Arrays.asList("5s", "1m", "5m", "15m"))
: new ArrayDeque<>(Arrays.asList("1m", "5m", "15m"));
while (tpsIterator.hasNext()) {
builder.append(TPSUtil.coloredTps(tpsIterator.next(), Theme.DEFAULT.colorScheme()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract class MinecraftServerMixin implements MinecraftServerAccess {
private final TickTimes tickTimes60s = new TickTimes(1200);

@Unique
private final RollingAverage tps15s = new RollingAverage(15);
private final RollingAverage tps5s = new RollingAverage(5);
@Unique
private final RollingAverage tps1m = new RollingAverage(60);
@Unique
Expand Down Expand Up @@ -104,7 +104,7 @@ public void injectTick(
final long diff = tickStartTimeNanos - this.previousTime;
this.previousTime = tickStartTimeNanos;
final BigDecimal currentTps = RollingAverage.TPS_BASE.divide(new BigDecimal(diff), 30, RoundingMode.HALF_UP);
this.tps15s.add(currentTps, diff);
this.tps5s.add(currentTps, diff);
this.tps1m.add(currentTps, diff);
this.tps5m.add(currentTps, diff);
this.tps15m.add(currentTps, diff);
Expand All @@ -117,7 +117,7 @@ public void injectTick(

public double @NonNull [] tabtps$recentTps() {
final double[] tps = new double[4];
tps[0] = this.tps15s.average();
tps[0] = this.tps5s.average();
tps[1] = this.tps1m.average();
tps[2] = this.tps5m.average();
tps[3] = this.tps15m.average();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract class MinecraftServerMixin implements MinecraftServerAccess {
private final TickTimes tickTimes60s = new TickTimes(1200);

@Unique
private final RollingAverage tps15s = new RollingAverage(15);
private final RollingAverage tps5s = new RollingAverage(5);
@Unique
private final RollingAverage tps1m = new RollingAverage(60);
@Unique
Expand Down Expand Up @@ -104,7 +104,7 @@ public void injectTick(
final long diff = tickStartTimeNanos - this.previousTime;
this.previousTime = tickStartTimeNanos;
final BigDecimal currentTps = RollingAverage.TPS_BASE.divide(new BigDecimal(diff), 30, RoundingMode.HALF_UP);
this.tps15s.add(currentTps, diff);
this.tps5s.add(currentTps, diff);
this.tps1m.add(currentTps, diff);
this.tps5m.add(currentTps, diff);
this.tps15m.add(currentTps, diff);
Expand All @@ -117,7 +117,7 @@ public void injectTick(

public double @NonNull [] tabtps$recentTps() {
final double[] tps = new double[4];
tps[0] = this.tps15s.average();
tps[0] = this.tps5s.average();
tps[1] = this.tps1m.average();
tps[2] = this.tps5m.average();
tps[3] = this.tps15m.average();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract class MinecraftServerMixin implements MinecraftServerAccess {
private final TickTimes tickTimes60s = new TickTimes(1200);

@Unique
private final RollingAverage tps15s = new RollingAverage(15);
private final RollingAverage tps5s = new RollingAverage(5);
@Unique
private final RollingAverage tps1m = new RollingAverage(60);
@Unique
Expand Down Expand Up @@ -106,7 +106,7 @@ public void injectTick(
final long diff = tickStartTimeNanos - this.previousTime;
this.previousTime = tickStartTimeNanos;
final BigDecimal currentTps = RollingAverage.TPS_BASE.divide(new BigDecimal(diff), 30, RoundingMode.HALF_UP);
this.tps15s.add(currentTps, diff);
this.tps5s.add(currentTps, diff);
this.tps1m.add(currentTps, diff);
this.tps5m.add(currentTps, diff);
this.tps15m.add(currentTps, diff);
Expand All @@ -119,7 +119,7 @@ public void injectTick(

public double @NonNull [] tabtps$recentTps() {
final double[] tps = new double[4];
tps[0] = this.tps15s.average();
tps[0] = this.tps5s.average();
tps[1] = this.tps1m.average();
tps[2] = this.tps5m.average();
tps[3] = this.tps15m.average();
Expand Down

0 comments on commit b67a3eb

Please sign in to comment.