mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 18:39:23 +00:00
ClassInstanceMultiMap belongs to Minecraft vanilla entity storage. And is unused, since replaced by spottedleaf's entity storage (rewrite chunk system). However these patches might be useful for vanilla entity storage if is used.
59 lines
3.0 KiB
Diff
59 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Wed, 30 Nov 2022 12:42:32 +0100
|
|
Subject: [PATCH] 5 second TPS average
|
|
|
|
License: MIT (https://opensource.org/licenses/MIT)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Add 5 second tps average in /tps"
|
|
By: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
As part of: Purpur (https://github.com/PurpurMC/Purpur)
|
|
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
|
|
|
* Purpur copyright *
|
|
|
|
MIT License
|
|
|
|
Copyright (c) 2019-2022 PurpurMC
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index 470e9f7570d1fa6b1328052e59ecd1324ec58825..fb998898c33ee5ab48c0858a7487fa41492d2c45 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1094,6 +1094,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
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); // Gale - Purpur - 5 second TPS average
|
|
public final RollingAverage tps1 = new RollingAverage(60);
|
|
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
|
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
|
@@ -1204,6 +1205,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
|
|
final long diff = currentTime - tickSection;
|
|
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
|
+ tps5s.add(currentTps, diff); // Gale - Purpur - 5 second TPS average
|
|
tps1.add(currentTps, diff);
|
|
tps5.add(currentTps, diff);
|
|
tps15.add(currentTps, diff);
|