mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: c8028d1c Fix data version check for ItemStack serialization (#3394) 9254a80a Fix race condition reintroduced in Prioritize class loader patch 6f196fe7 Add Raw Byte ItemStack Serialization df43f828 Allow server startup for those poor people running <1G Xmx 3c9b65ef Fix cases where no-tick < tick view distance 72f89a07 Workaround for Client Lag Spikes (MC-162253) 3f941c0c Add option for console having all permissions d2ae4658 Add permission for command blocks 9f8ae5cb Prioritise own classes where possible 74466412 Check portal restrictions when entering end gateways fc9cf84d Fix NPE when temp ip bans expire (#3373) 16bd420d Add missing mob goals for API (#3367) b5c4e2f6 Ensure no-tick view is not smaller than ticking VD 52564b1f Expand Pathfinding API with more options dde65481 Fix usage of vanilla goals 7797aebe Drop Leads from nether portals - Fixes #3226 511b6bc2 Reduce MutableInt and Vec3d allocations, use ArrayDeque 84673141 Optimize NibbleArray to use pooled buffers 897dd2c8 Foundational work for Future Memory usage improvements bb4002d8 Handle CraftPlayer#setSpectatorTarget better 4ae08959 Fix collision checks on spawning hanging entities and null on async chunk loads c2f8d1ef Protect Bedrock and End Portal/Frames from being destroyed 827cc632 Updated Upstream (Bukkit/CraftBukkit/Spigot) 92f680ed Fix Pathfinding and obscure glitchy buggy 0 tick farms 7a7c4292 Optimize Pathfinder - Remove Streams / Optimized collections fc917d16 Optimize Hoppers - Major performance improvement 14ad77c6 Fix PotionEffect API Ignoring Icon bug eb3ce8a2 Fix EntityRaider picking up items when they shouldn't be able 1ea9ada0 Add a TELEPORT ticket when changing dimensions 8e9459ea Fix missing flag pass for isUrgent 7befec44 Potential bed api (#3339) 27945a6b Optimize WorldBorder collision checks and air 55e17a85 Wait for Async Tasks during shutdown b5905256 Ensure Entity AABB's are never invalid a054aa6f Properly remove Entities from current chunk c894ddfd Fix teleporting onto a chunk line 57d6cc01 Send LOGIN protocol packets immediately - Fix disconnect during async prelogin cd93e54d Don't use our modified chunk checks for collision in world gen b4003ef1 Allow loading entities current chunk if needed to fix collision checks e5f64896 Add Urgent API for Async Chunks API and use it for Async Teleport ad8e59dc Ensure chunks loaded on respawn for suffocation check
82 lines
4.6 KiB
Diff
82 lines
4.6 KiB
Diff
From 6ef5ae3357460132d80230bb96c2457ac9f65e0e Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sun, 28 Jul 2019 01:27:37 -0500
|
|
Subject: [PATCH] Add 5 second tps average in /tps
|
|
|
|
---
|
|
.../java/net/minecraft/server/MinecraftServer.java | 13 +++++++++----
|
|
.../java/org/bukkit/craftbukkit/CraftServer.java | 1 +
|
|
.../java/org/spigotmc/TicksPerSecondCommand.java | 2 +-
|
|
3 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 2b60ecde7..378fd60db 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -183,7 +183,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
public static final int TPS = 20;
|
|
public static final int TICK_TIME = 1000000000 / TPS;
|
|
private static final int SAMPLE_INTERVAL = 20; // Paper
|
|
- public final double[] recentTps = new double[ 3 ];
|
|
+ public final double[] recentTps = new double[ 4 ]; // Purpur
|
|
public boolean lagging = false; // Purpur
|
|
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
|
|
// Spigot end
|
|
@@ -848,6 +848,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
|
private long lastTick = 0;
|
|
private long catchupTime = 0;
|
|
+ public final RollingAverage tps5s = new RollingAverage(5); // Purpur
|
|
public final RollingAverage tps1 = new RollingAverage(60);
|
|
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
|
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
|
@@ -937,13 +938,17 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
{
|
|
final long diff = curTime - tickSection;
|
|
java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
|
+ tps5s.add(currentTps, diff); // Purpur
|
|
tps1.add(currentTps, diff);
|
|
tps5.add(currentTps, diff);
|
|
tps15.add(currentTps, diff);
|
|
// Backwards compat with bad plugins
|
|
- recentTps[0] = tps1.getAverage();
|
|
- recentTps[1] = tps5.getAverage();
|
|
- recentTps[2] = tps15.getAverage();
|
|
+ // Purpur start
|
|
+ recentTps[0] = tps5s.getAverage();
|
|
+ recentTps[1] = tps1.getAverage();
|
|
+ recentTps[2] = tps5.getAverage();
|
|
+ recentTps[3] = tps15.getAverage();
|
|
+ // Purpur end
|
|
// Paper end
|
|
lagging = recentTps[0] < net.pl3x.purpur.PurpurConfig.laggingThreshold; // Purpur
|
|
tickSection = curTime;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index b488d1848..b2db22413 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -2092,6 +2092,7 @@ public final class CraftServer implements Server {
|
|
@Override
|
|
public double[] getTPS() {
|
|
return new double[] {
|
|
+ net.minecraft.server.MinecraftServer.getServer().tps5s.getAverage(), // Purpur
|
|
net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(),
|
|
net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(),
|
|
net.minecraft.server.MinecraftServer.getServer().tps15.getAverage()
|
|
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
index 387af9d5c..650f74ba3 100644
|
|
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
@@ -30,7 +30,7 @@ public class TicksPerSecondCommand extends Command
|
|
for ( int i = 0; i < tps.length; i++) {
|
|
tpsAvg[i] = format( tps[i] );
|
|
}
|
|
- sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "));
|
|
+ sender.sendMessage( ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
|
|
// Paper end
|
|
|
|
return true;
|
|
--
|
|
2.24.0
|
|
|