9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-28 19:19:09 +00:00
Files
Gale/patches/server/0018-Remove-vanilla-profiler.patch
Martijn Muijsers df71461201 Squash fixup patches
2023-03-21 23:59:48 +01:00

1844 lines
97 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Thu, 22 Dec 2022 22:32:18 +0100
Subject: [PATCH] Remove vanilla profiler
License: MIT (https://opensource.org/licenses/MIT)
Gale - https://galemc.org
This patch is based on the following patch:
"Remove Mojang Profiler"
By: BillyGalbreath <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/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 87cc7562e4a166d078fe11b7f6980497fc0bd33e..28d78c5d593302d8fe376686db6402cafa5ccb86 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -149,7 +149,6 @@ public class Commands {
DamageCommand.register(this.dispatcher, commandRegistryAccess);
DataCommands.register(this.dispatcher);
DataPackCommand.register(this.dispatcher);
- DebugCommand.register(this.dispatcher);
DefaultGameModeCommands.register(this.dispatcher);
DifficultyCommand.register(this.dispatcher);
EffectCommands.register(this.dispatcher, commandRegistryAccess);
@@ -309,13 +308,9 @@ public class Commands {
public int performCommand(ParseResults<CommandSourceStack> parseresults, String s, String label) { // CraftBukkit
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource();
- commandlistenerwrapper.getServer().getProfiler().push(() -> {
- return "/" + s;
- });
-
byte b0;
- try {
+ { // Gale - Purpur - remove vanilla profiler
byte b1;
try {
@@ -393,8 +388,6 @@ public class Commands {
b0 = 0;
}
- } finally {
- commandlistenerwrapper.getServer().getProfiler().pop();
}
return b0;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9000dc3498ea22ef379908eb3c997467ffba82b4..3e938810faa1ac85da58364327d5bed0d7dbb70e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -213,14 +213,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList();
- private MetricsRecorder metricsRecorder;
- private ProfilerFiller profiler;
- private Consumer<ProfileResults> onMetricsRecordingStopped;
- private Consumer<Path> onMetricsRecordingFinished;
- private boolean willStartRecordingMetrics;
- @Nullable
- private MinecraftServer.TimeProfiler debugCommandProfiler;
- private boolean debugCommandProfilerDelayStart;
private ServerConnectionListener connection;
public final ChunkProgressListenerFactory progressListenerFactory;
@Nullable
@@ -334,13 +326,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server");
SERVER = this; // Paper - better singleton
- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- this.profiler = this.metricsRecorder.getProfiler();
- this.onMetricsRecordingStopped = (methodprofilerresults) -> {
- this.stopRecordingMetrics();
- };
- this.onMetricsRecordingFinished = (path) -> {
- };
this.random = RandomSource.create();
this.port = -1;
this.levels = Maps.newLinkedHashMap();
@@ -938,9 +923,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end
// CraftBukkit end
- if (this.metricsRecorder.isRecording()) {
- this.cancelRecordingMetrics();
- }
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
@@ -1164,23 +1146,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
- if (this.debugCommandProfilerDelayStart) {
- this.debugCommandProfilerDelayStart = false;
- this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }
-
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
lastTick = curTime;
this.nextTickTime += 50L;
- this.startMetricsRecordingTick();
- this.profiler.push("tick");
this.tickServer(this::haveTime);
- this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
this.waitUntilNextTick();
- this.profiler.pop();
- this.endMetricsRecordingTick();
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
@@ -1341,7 +1313,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
- this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1408,7 +1379,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
- this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1423,7 +1393,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- this.profiler.pop();
// Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
@@ -1436,7 +1405,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end
- this.profiler.push("tallying");
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
this.averageTickTime = this.averageTickTime * 0.8F + (float) j / 1000000.0F * 0.19999999F;
@@ -1448,7 +1416,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
tickTimes60s.add(this.tickCount, j);
// Paper end
this.frameTimer.logFrameDuration(k - i);
- this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTimingFullServerTick(); // Paper // Gale - final timings calls
}
@@ -1486,11 +1453,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
- this.profiler.push("commandFunctions");
MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
this.getFunctions().tick();
MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
- this.profiler.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - moved down
// CraftBukkit start
@@ -1531,9 +1496,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
- this.profiler.push(() -> {
- return worldserver + " " + worldserver.dimension().location();
- });
/* Drop global time updates
if (this.tickCount % 20 == 0) {
this.profiler.push("timeSync");
@@ -1542,8 +1504,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end */
- this.profiler.push("tick");
-
try {
worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking);
@@ -1568,17 +1528,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport);
}
- this.profiler.pop();
- this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper
- this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot
this.getConnection().tick();
MinecraftTimings.connectionTimer.stopTiming(); // Spigot
- this.profiler.popPush("players");
MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
this.playerList.tick();
MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
@@ -1586,15 +1542,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}
- this.profiler.popPush("server gui refresh");
-
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
-
- this.profiler.pop();
}
private void synchronizeTime(ServerLevel world) {
@@ -1602,7 +1554,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
- this.profiler.push("timeSync");
Iterator iterator = this.getAllLevels().iterator();
while (iterator.hasNext()) {
@@ -1610,8 +1561,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.synchronizeTime(worldserver);
}
-
- this.profiler.pop();
}
public boolean isNetherEnabled() {
@@ -2269,10 +2218,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.frameTimer;
}
- public ProfilerFiller getProfiler() {
- return this.profiler;
- }
-
public abstract boolean isSingleplayerOwner(GameProfile profile);
public void dumpServerProperties(Path file) throws IOException {}
@@ -2508,53 +2453,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end
- private void startMetricsRecordingTick() {
- if (this.willStartRecordingMetrics) {
- this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
- this.executeBlocking(() -> {
- this.saveDebugReport(path.resolve("server"));
- });
- this.onMetricsRecordingFinished.accept(path);
- });
- this.willStartRecordingMetrics = false;
- }
-
- this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
- this.metricsRecorder.startTick();
- this.profiler.startTick();
- }
-
- private void endMetricsRecordingTick() {
- this.profiler.endTick();
- this.metricsRecorder.endTick();
- }
-
- public boolean isRecordingMetrics() {
- return this.metricsRecorder.isRecording();
- }
-
- public void startRecordingMetrics(Consumer<ProfileResults> resultConsumer, Consumer<Path> dumpConsumer) {
- this.onMetricsRecordingStopped = (methodprofilerresults) -> {
- this.stopRecordingMetrics();
- resultConsumer.accept(methodprofilerresults);
- };
- this.onMetricsRecordingFinished = dumpConsumer;
- this.willStartRecordingMetrics = true;
- }
-
- public void stopRecordingMetrics() {
- this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
- }
-
- public void finishRecordingMetrics() {
- this.metricsRecorder.end();
- }
-
- public void cancelRecordingMetrics() {
- this.metricsRecorder.cancel();
- this.profiler = this.metricsRecorder.getProfiler();
- }
-
public Path getWorldPath(LevelResource worldSavePath) {
return this.storageSource.getLevelPath(worldSavePath);
}
@@ -2600,25 +2498,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.isSaving;
}
- public boolean isTimeProfilerRunning() {
- return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
- }
-
- public void startTimeProfiler() {
- this.debugCommandProfilerDelayStart = true;
- }
-
- public ProfileResults stopTimeProfiler() {
- if (this.debugCommandProfiler == null) {
- return EmptyProfileResults.EMPTY;
- } else {
- ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
-
- this.debugCommandProfiler = null;
- return methodprofilerresults;
- }
- }
-
public int getMaxChainedNeighborUpdates() {
return 1000000;
}
@@ -2655,56 +2534,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- private static class TimeProfiler {
-
- final long startNanos;
- final int startTick;
-
- TimeProfiler(long time, int tick) {
- this.startNanos = time;
- this.startTick = tick;
- }
-
- ProfileResults stop(final long endTime, final int endTick) {
- return new ProfileResults() {
- @Override
- public List<ResultField> getTimes(String parentPath) {
- return Collections.emptyList();
- }
-
- @Override
- public boolean saveResults(Path path) {
- return false;
- }
-
- @Override
- public long getStartTimeNano() {
- return TimeProfiler.this.startNanos;
- }
-
- @Override
- public int getStartTimeTicks() {
- return TimeProfiler.this.startTick;
- }
-
- @Override
- public long getEndTimeNano() {
- return endTime;
- }
-
- @Override
- public int getEndTimeTicks() {
- return endTick;
- }
-
- @Override
- public String getProfilerResults() {
- return "";
- }
- };
- }
- }
-
public static record ServerResourcePackInfo(String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
diff --git a/src/main/java/net/minecraft/server/ReloadableServerResources.java b/src/main/java/net/minecraft/server/ReloadableServerResources.java
index a9adb3ae346e9bb2ca335a6688163eb5d7a27e6d..cae1797677a9373321f5011e87bc5d04bb2bcf0a 100644
--- a/src/main/java/net/minecraft/server/ReloadableServerResources.java
+++ b/src/main/java/net/minecraft/server/ReloadableServerResources.java
@@ -81,7 +81,7 @@ public class ReloadableServerResources {
public static CompletableFuture<ReloadableServerResources> loadResources(ResourceManager manager, RegistryAccess.Frozen dynamicRegistryManager, FeatureFlagSet enabledFeatures, Commands.CommandSelection environment, int functionPermissionLevel, Executor prepareExecutor, Executor applyExecutor) {
ReloadableServerResources reloadableServerResources = new ReloadableServerResources(dynamicRegistryManager, enabledFeatures, environment, functionPermissionLevel);
- return SimpleReloadInstance.create(manager, reloadableServerResources.listeners(), prepareExecutor, applyExecutor, DATA_RELOAD_INITIAL_TASK, LOGGER.isDebugEnabled()).done().whenComplete((void_, throwable) -> {
+ return SimpleReloadInstance.create(manager, reloadableServerResources.listeners(), prepareExecutor, applyExecutor, DATA_RELOAD_INITIAL_TASK, false).done().whenComplete((void_, throwable) -> { // Gale - Purpur - remove vanilla profiler
reloadableServerResources.commandBuildContext.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.FAIL);
}).thenApply((void_) -> {
return reloadableServerResources;
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 6483a1d461904a0584b6808b2f86ac7329bba963..a4e5fdd5c4667c51ecfea0e4d3139594fc366061 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -57,10 +57,7 @@ public class ServerFunctionManager {
}
private void executeTagFunctions(Collection<CommandFunction> functions, ResourceLocation label) {
- ProfilerFiller gameprofilerfiller = this.server.getProfiler();
-
Objects.requireNonNull(label);
- gameprofilerfiller.push(label::toString);
Iterator iterator = functions.iterator();
while (iterator.hasNext()) {
@@ -68,8 +65,6 @@ public class ServerFunctionManager {
this.execute(customfunction, this.getGameLoopSender());
}
-
- this.server.getProfiler().pop();
}
public int execute(CommandFunction function, CommandSourceStack source) {
@@ -175,12 +170,10 @@ public class ServerFunctionManager {
return j;
}
- try {
+ { // Gale - Purpur - remove vanilla profiler
ServerFunctionManager.QueuedCommand customfunctiondata_b = (ServerFunctionManager.QueuedCommand) this.commandQueue.removeFirst();
- ProfilerFiller gameprofilerfiller = ServerFunctionManager.this.server.getProfiler();
Objects.requireNonNull(customfunctiondata_b);
- gameprofilerfiller.push(customfunctiondata_b::toString);
this.depth = customfunctiondata_b.depth;
customfunctiondata_b.execute(ServerFunctionManager.this, this.commandQueue, i, this.tracer);
if (!this.nestedCalls.isEmpty()) {
@@ -191,8 +184,6 @@ public class ServerFunctionManager {
list.forEach(deque::addFirst);
this.nestedCalls.clear();
}
- } finally {
- ServerFunctionManager.this.server.getProfiler().pop();
}
++j;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index fbe209a66c77c47935ad026dd3e45e682af91fd8..d7a8b1ee9c3efda2c8463d6e06e54eb59b1b4dc4 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -76,7 +76,6 @@ import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.util.thread.ProcessorHandle;
import net.minecraft.util.thread.ProcessorMailbox;
@@ -621,20 +620,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
-
try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
- gameprofilerfiller.push("poi");
this.poiManager.tick(shouldKeepTicking);
} // Paper
- gameprofilerfiller.popPush("chunk_unload");
if (!this.level.noSave()) {
try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
this.processUnloads(shouldKeepTicking);
} // Paper
}
-
- gameprofilerfiller.pop();
}
public boolean hasWork() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..d95c3b14c06421c03c99f84efb3a5319200f8a57 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -24,7 +24,6 @@ import net.minecraft.core.SectionPos;
import net.minecraft.network.protocol.Packet;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.util.VisibleForDebug;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.village.poi.PoiManager;
@@ -428,16 +427,12 @@ public class ServerChunkCache extends ChunkSource {
return ifLoaded;
}
// Paper end
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
-
- gameprofilerfiller.incrementCounter("getChunk");
long k = ChunkPos.asLong(x, z);
ChunkAccess ichunkaccess;
// Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system
- gameprofilerfiller.incrementCounter("getChunkCacheMiss");
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
@@ -625,24 +620,19 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
- this.level.getProfiler().push("purge");
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- this.level.getProfiler().popPush("unload");
this.chunkMap.tick(() -> true);
- this.level.getProfiler().pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
- this.level.getProfiler().push("purge");
this.level.timings.doChunkMap.startTiming(); // Spigot
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
this.level.timings.doChunkMap.stopTiming(); // Spigot
- this.level.getProfiler().popPush("chunks");
if (tickChunks) {
this.level.timings.chunks.startTiming(); // Paper - timings
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
@@ -651,10 +641,8 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.timings.doChunkUnload.startTiming(); // Spigot
- this.level.getProfiler().popPush("unload");
this.chunkMap.tick(shouldKeepTicking);
this.level.timings.doChunkUnload.stopTiming(); // Spigot
- this.level.getProfiler().pop();
this.clearCache();
}
@@ -700,13 +688,10 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimize isOutisdeRange
LevelData worlddata = this.level.getLevelData();
- ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
- gameprofilerfiller.push("naturalSpawnCount");
this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
@@ -724,13 +709,11 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
- gameprofilerfiller.popPush("filteringLoadedChunks");
// Paper - moved down
this.level.timings.chunkTicks.startTiming(); // Paper
// Paper - moved down
- gameprofilerfiller.popPush("spawnAndTick");
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
// Paper - only shuffle if per-player mob spawning is disabled
@@ -781,15 +764,12 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimise chunk tick iteration
this.level.timings.chunkTicks.stopTiming(); // Paper
- gameprofilerfiller.popPush("customSpawners");
if (flag2) {
try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
} // Paper - timings
}
- gameprofilerfiller.pop();
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
- gameprofilerfiller.popPush("broadcast");
this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
@@ -803,7 +783,6 @@ public class ServerChunkCache extends ChunkSource {
}
}
this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
- gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
// Paper start - controlled flush for entity tracker packets
List<net.minecraft.network.Connection> disabledFlushes = new java.util.ArrayList<>(this.level.players.size());
@@ -994,7 +973,6 @@ public class ServerChunkCache extends ChunkSource {
@Override
protected void doRunTask(Runnable task) {
- ServerChunkCache.this.level.getProfiler().incrementCounter("runTask");
super.doRunTask(task);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 512da79de8c9476c7289f4857c8bb966ff1a11c6..42b0aa27af33aa5879f9d9a5fcfa19c296fbc635 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -76,7 +76,6 @@ import net.minecraft.util.CsvOutput;
import net.minecraft.util.Mth;
import net.minecraft.util.ProgressListener;
import net.minecraft.util.Unit;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.valueproviders.IntProvider;
import net.minecraft.util.valueproviders.UniformInt;
import net.minecraft.world.DifficultyInstance;
@@ -525,15 +524,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), spigotConfig -> minecraftserver.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor // Gale - Gale configuration
+ super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), spigotConfig -> minecraftserver.galeConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig)), executor); // Paper - Async-Anti-Xray - Pass executor // Gale - Gale configuration // Gale - Purpur - remove vanilla profiler
this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
// CraftBukkit end
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
- this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
- this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
+ // Gale start - Purpur - remove vanilla profiler
+ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded);
+ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded);
+ // Gale end - Purpur - remove vanilla profiler
this.navigatingMobs = new ObjectOpenHashSet();
this.blockEvents = new ObjectLinkedOpenHashSet();
this.blockEventsToReschedule = new ArrayList(64);
@@ -631,12 +632,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise checkDespawn
- ProfilerFiller gameprofilerfiller = this.getProfiler();
-
this.handlingTick = true;
- gameprofilerfiller.push("world border");
this.getWorldBorder().tick();
- gameprofilerfiller.popPush("weather");
this.advanceWeatherCycle();
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;
@@ -663,32 +660,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
- gameprofilerfiller.popPush("tickPending");
timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug()) {
j = this.getGameTime();
- gameprofilerfiller.push("blockTicks");
this.blockTicks.tick(j, 65536, this::tickBlock);
- gameprofilerfiller.popPush("fluidTicks");
this.fluidTicks.tick(j, 65536, this::tickFluid);
- gameprofilerfiller.pop();
}
timings.scheduledBlocks.stopTiming(); // Paper
- gameprofilerfiller.popPush("raid");
this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
this.timings.raids.stopTiming(); // Paper - timings
- gameprofilerfiller.popPush("chunkSource");
this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking, true);
this.timings.chunkProviderTick.stopTiming(); // Paper - timings
- gameprofilerfiller.popPush("blockEvents");
timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
timings.doSounds.stopTiming(); // Spigot
this.handlingTick = false;
- gameprofilerfiller.pop();
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) {
@@ -696,12 +685,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (flag || this.emptyTime++ < 300) {
- gameprofilerfiller.push("entities");
timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null) {
- gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
- gameprofilerfiller.pop();
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
@@ -711,9 +697,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
} else {
- gameprofilerfiller.push("checkDespawn");
entity.checkDespawn();
- gameprofilerfiller.pop();
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
Entity entity1 = entity.getVehicle();
@@ -725,22 +709,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding();
}
- gameprofilerfiller.push("tick");
this.guardEntityTick(this::tickNonPassenger, entity);
- gameprofilerfiller.pop();
}
}
}
});
timings.entityTick.stopTiming(); // Spigot
timings.tickEntities.stopTiming(); // Spigot
- gameprofilerfiller.pop();
this.tickBlockEntities();
}
- gameprofilerfiller.push("entityManagement");
//this.entityManager.tick(); // Paper - rewrite chunk system
- gameprofilerfiller.pop();
}
@Override
@@ -799,9 +778,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ();
- ProfilerFiller gameprofilerfiller = this.getProfiler();
-
- gameprofilerfiller.push("thunder");
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder
@@ -831,7 +807,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
- gameprofilerfiller.popPush("iceandsnow");
int l;
if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
@@ -882,7 +857,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper start - optimise random block ticking
- gameprofilerfiller.popPush("randomTick");
timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
@@ -918,7 +892,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper end - optimise random block ticking
timings.chunkTicksBlocks.stopTiming(); // Paper
- gameprofilerfiller.pop();
}
public Optional<BlockPos> findLightningRod(BlockPos pos) {
@@ -1196,19 +1169,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
try {
// Paper end - timings
entity.setOldPosAndRot();
- ProfilerFiller gameprofilerfiller = this.getProfiler();
++entity.tickCount;
- this.getProfiler().push(() -> {
- return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
- });
- gameprofilerfiller.incrementCounter("tickNonPassenger");
if (isActive) { // Paper - EAR 2
TimingHistory.activatedEntityTicks++;
entity.tick();
entity.postTick(); // CraftBukkit
} else { entity.inactiveTick(); } // Paper - EAR 2
- this.getProfiler().pop();
} finally { timer.stopTiming(); } // Paper - timings
Iterator iterator = entity.getPassengers().iterator();
@@ -1237,12 +1204,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
- ProfilerFiller gameprofilerfiller = this.getProfiler();
-
- gameprofilerfiller.push(() -> {
- return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
- });
- gameprofilerfiller.incrementCounter("tickPassenger");
// Paper start - EAR 2
if (isActive) {
passenger.rideTick();
@@ -1254,7 +1215,6 @@ public class ServerLevel extends Level implements WorldGenLevel {
vehicle.positionRider(passenger);
}
// Paper end - EAR 2
- gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ca5291a9573a62cb5c19539cf5c7aceff11f9829..3c92e6fb78cce27572709cd767fb191f9107e0eb 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1161,7 +1161,6 @@ public class ServerPlayer extends Player {
PortalInfo shapedetectorshape = this.findDimensionEntryPoint(worldserver);
if (shapedetectorshape != null) {
- worldserver1.getProfiler().push("moving");
worldserver = shapedetectorshape.world; // CraftBukkit
if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
if (resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit
@@ -1184,8 +1183,6 @@ public class ServerPlayer extends Player {
worldserver = ((CraftWorld) exit.getWorld()).getHandle();
// CraftBukkit end
- worldserver1.getProfiler().pop();
- worldserver1.getProfiler().push("placing");
if (true) { // CraftBukkit
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
@@ -1203,7 +1200,6 @@ public class ServerPlayer extends Player {
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);
- worldserver1.getProfiler().pop();
this.triggerDimensionChangeTriggers(worldserver1);
this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities()));
playerlist.sendLevelInfo(this, worldserver);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88..d56ed157045184d51a0af7cb722dbf5f01320b8f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -392,7 +392,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.aboveGroundVehicleTickCount = 0;
}
- this.server.getProfiler().push("keepAlive");
// Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
long currentTime = Util.getMillis();
@@ -413,7 +412,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
// Paper end
- this.server.getProfiler().pop();
// CraftBukkit start
for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ;
if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable
diff --git a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
index 828196decc89e7e03f88c4a3208ee1ab2bb69242..ff1ac081ba9de69bd684a26a6455ac2b6cd2cae9 100644
--- a/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
+++ b/src/main/java/net/minecraft/server/packs/resources/PreparableReloadListener.java
@@ -5,7 +5,13 @@ import java.util.concurrent.Executor;
import net.minecraft.util.profiling.ProfilerFiller;
public interface PreparableReloadListener {
- CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor);
+ // Gale start - Purpur - remove vanilla profiler
+ default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
+ return this.reload(synchronizer, manager, prepareExecutor, applyExecutor);
+ }
+
+ CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor);
+ // Gale end - Purpur - remove vanilla profiler
default String getName() {
return this.getClass().getSimpleName();
diff --git a/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java b/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
index c83c6fe5f7e2dc00a36cdd76c23317f232a2336b..47091691ca667e8ee58fa96ee9a2a827bcee5ce3 100644
--- a/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
+++ b/src/main/java/net/minecraft/server/packs/resources/ReloadableResourceManager.java
@@ -43,7 +43,7 @@ public class ReloadableResourceManager implements ResourceManager, AutoCloseable
}));
this.resources.close();
this.resources = new MultiPackResourceManager(this.type, packs);
- return SimpleReloadInstance.create(this.resources, this.listeners, prepareExecutor, applyExecutor, initialStage, LOGGER.isDebugEnabled());
+ return SimpleReloadInstance.create(this.resources, this.listeners, prepareExecutor, applyExecutor, initialStage, false); // Gale - Purpur - remove vanilla profiler
}
@Override
diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
index 9ddbfcf80d9a381dace78a62880f85a4d767e0eb..46695c08d4c84a5df964dbe0706ff0f8ba124364 100644
--- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
+++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java
@@ -7,13 +7,9 @@ import net.minecraft.util.profiling.ProfilerFiller;
public interface ResourceManagerReloadListener extends PreparableReloadListener {
@Override
- default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
+ default CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) { // Gale - Purpur - remove vanilla profiler
return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> {
- applyProfiler.startTick();
- applyProfiler.push("listener");
this.onResourceManagerReload(manager);
- applyProfiler.pop();
- applyProfiler.endTick();
}, applyExecutor);
}
diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
index 7ab57748b2f2aea1003d9b7e70e76c372aa1e432..47e75ec4a01f8a456ec6ebc13031c1f0c5537d6a 100644
--- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
+++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java
@@ -2,15 +2,17 @@ package net.minecraft.server.packs.resources;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
+
+import net.minecraft.util.profiling.InactiveProfiler;
import net.minecraft.util.profiling.ProfilerFiller;
public abstract class SimplePreparableReloadListener<T> implements PreparableReloadListener {
@Override
- public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, ProfilerFiller prepareProfiler, ProfilerFiller applyProfiler, Executor prepareExecutor, Executor applyExecutor) {
+ public final CompletableFuture<Void> reload(PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) { // Gale - Purpur - remove vanilla profiler
return CompletableFuture.supplyAsync(() -> {
- return this.prepare(manager, prepareProfiler);
+ return this.prepare(manager, InactiveProfiler.INSTANCE); // Gale - Purpur - remove vanilla profiler
}, prepareExecutor).thenCompose(synchronizer::wait).thenAcceptAsync((prepared) -> {
- this.apply(prepared, manager, applyProfiler);
+ this.apply(prepared, manager, InactiveProfiler.INSTANCE); // Gale - Purpur - remove vanilla profiler
}, applyExecutor);
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9a1e8589e6b371869b2199650172d61ae186c907..389e382ba6197c224b0829b5b98f3c22f443e56f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -789,7 +789,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit end
public void baseTick() {
- this.level.getProfiler().push("entityBaseTick");
if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Update last hurt when ticking
this.feetBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) {
@@ -850,7 +849,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.firstTick = false;
- this.level.getProfiler().pop();
}
public void setSharedFlagOnFire(boolean onFire) {
@@ -1024,7 +1022,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
}
- this.level.getProfiler().push("move");
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
movement = movement.multiply(this.stuckSpeedMultiplier);
this.stuckSpeedMultiplier = Vec3.ZERO;
@@ -1033,7 +1030,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper start - ignore movement changes while inactive.
if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
setDeltaMovement(Vec3.ZERO);
- this.level.getProfiler().pop();
return;
}
// Paper end
@@ -1054,8 +1050,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z);
}
- this.level.getProfiler().pop();
- this.level.getProfiler().push("rest");
boolean flag = !Mth.equal(movement.x, vec3d1.x);
boolean flag1 = !Mth.equal(movement.z, vec3d1.z);
@@ -1073,9 +1067,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
BlockState iblockdata = this.level.getBlockState(blockposition);
this.checkFallDamage(vec3d1.y, this.onGround, iblockdata, blockposition);
- if (this.isRemoved()) {
- this.level.getProfiler().pop();
- } else {
+ if (!this.isRemoved()) { // Gale - Purpur - remove vanilla profiler
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -1214,8 +1206,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.isOnFire() && (this.isInPowderSnow || this.isInWaterRainOrBubble())) {
this.setRemainingFireTicks(-this.getFireImmuneTicks());
}
-
- this.level.getProfiler().pop();
}
}
// Paper start - detailed watchdog information
@@ -2911,7 +2901,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
ServerLevel worldserver1 = minecraftserver.getLevel(resourcekey);
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
- this.level.getProfiler().push("portal");
this.portalTime = i;
// Paper start
io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
@@ -2929,7 +2918,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
} // Paper
// CraftBukkit end
- this.level.getProfiler().pop();
}
this.isInsidePortal = false;
@@ -3396,14 +3384,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end
if (this.level instanceof ServerLevel && !this.isRemoved()) {
- this.level.getProfiler().push("changeDimension");
// CraftBukkit start
// this.decouple();
if (worldserver == null) {
return null;
}
// CraftBukkit end
- this.level.getProfiler().push("reposition");
PortalInfo shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new PortalInfo(new Vec3(location.x(), location.y(), location.z()), Vec3.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
if (shapedetectorshape == null) {
@@ -3437,7 +3423,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.unRide();
// CraftBukkit end
- this.level.getProfiler().popPush("reloading");
// Paper start - Change lead drop timing to prevent dupe
if (this instanceof Mob) {
((Mob) this).dropLeash(true, true); // Paper drop lead
@@ -3460,10 +3445,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.removeAfterChangingDimensions();
- this.level.getProfiler().pop();
((ServerLevel) this.level).resetEmptyTime();
worldserver.resetEmptyTime();
- this.level.getProfiler().pop();
return entity;
}
} else {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index dcfb71b5a53df789e366fea2080921d677549a2e..b4b916f2929d83aaa160a69a198836ed53430e23 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -388,7 +388,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
super.baseTick();
- this.level.getProfiler().push("livingEntityBaseTick");
if (this.fireImmune() || this.level.isClientSide) {
this.clearFire();
}
@@ -490,7 +489,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.yHeadRotO = this.yHeadRot;
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
- this.level.getProfiler().pop();
}
public boolean canSpawnSoulSpeedParticle() {
@@ -3006,10 +3004,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.run += (f3 - this.run) * 0.3F;
- this.level.getProfiler().push("headTurn");
f2 = this.tickHeadTurn(f1, f2);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("rangeChecks");
// Paper start - stop large pitch and yaw changes from crashing the server
this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
@@ -3021,7 +3016,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
// Paper end
- this.level.getProfiler().pop();
this.animStep += f2;
if (this.isFallFlying()) {
++this.fallFlyTicks;
@@ -3310,19 +3304,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.setDeltaMovement(d4, d5, d6);
- this.level.getProfiler().push("ai");
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
this.zza = 0.0F;
} else if (this.isEffectiveAi()) {
- this.level.getProfiler().push("newAi");
this.serverAiStep();
- this.level.getProfiler().pop();
}
- this.level.getProfiler().pop();
- this.level.getProfiler().push("jump");
if (this.jumping && this.isAffectedByFluids()) {
double d7;
@@ -3349,8 +3338,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.noJumpDelay = 0;
}
- this.level.getProfiler().pop();
- this.level.getProfiler().push("travel");
this.xxa *= 0.98F;
this.zza *= 0.98F;
this.updateFallFlying();
@@ -3366,8 +3353,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
//SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
- this.level.getProfiler().pop();
- this.level.getProfiler().push("freezing");
if (!this.level.isClientSide && !this.isDeadOrDying() && !freezeLocked) { // Paper - Freeze Tick Lock API
int i = this.getTicksFrozen();
@@ -3384,15 +3369,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurt(this.damageSources().freeze(), 1.0F);
}
- this.level.getProfiler().pop();
- this.level.getProfiler().push("push");
if (this.autoSpinAttackTicks > 0) {
--this.autoSpinAttackTicks;
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
this.pushEntities();
- this.level.getProfiler().pop();
// Paper start
if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..a19956dbbb43f64043381bd968af74550b8a359a 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -144,8 +144,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.pathfindingMalus = Maps.newEnumMap(BlockPathTypes.class);
this.restrictCenter = BlockPos.ZERO;
this.restrictRadius = -1.0F;
- this.goalSelector = new GoalSelector(world.getProfilerSupplier());
- this.targetSelector = new GoalSelector(world.getProfilerSupplier());
+ // Gale start - Purpur - remove vanilla profiler
+ this.goalSelector = new GoalSelector();
+ this.targetSelector = new GoalSelector();
+ // Gale end - Purpur - remove vanilla profiler
this.lookControl = new LookControl(this);
this.moveControl = new MoveControl(this);
this.jumpControl = new JumpControl(this);
@@ -357,13 +359,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
public void baseTick() {
super.baseTick();
- this.level.getProfiler().push("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) {
this.resetAmbientSoundTime();
this.playAmbientSound();
}
-
- this.level.getProfiler().pop();
}
@Override
@@ -668,7 +667,6 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
public void aiStep() {
super.aiStep();
- this.level.getProfiler().push("looting");
if (!this.level.isClientSide && this.canPickUpLoot() && this.isAlive() && !this.dead && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
Vec3i baseblockposition = this.getPickupReach();
List<ItemEntity> list = this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ()));
@@ -687,8 +685,6 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
}
}
-
- this.level.getProfiler().pop();
}
protected Vec3i getPickupReach() {
@@ -900,42 +896,22 @@ public abstract class Mob extends LivingEntity implements Targeting {
return;
}
// Paper end
- this.level.getProfiler().push("sensing");
this.sensing.tick();
- this.level.getProfiler().pop();
int i = this.level.getServer().getTickCount() + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
- this.level.getProfiler().push("targetSelector");
this.targetSelector.tickRunningGoals(false);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("goalSelector");
this.goalSelector.tickRunningGoals(false);
- this.level.getProfiler().pop();
} else {
- this.level.getProfiler().push("targetSelector");
this.targetSelector.tick();
- this.level.getProfiler().pop();
- this.level.getProfiler().push("goalSelector");
this.goalSelector.tick();
- this.level.getProfiler().pop();
}
- this.level.getProfiler().push("navigation");
this.navigation.tick();
- this.level.getProfiler().pop();
- this.level.getProfiler().push("mob tick");
this.customServerAiStep();
- this.level.getProfiler().pop();
- this.level.getProfiler().push("controls");
- this.level.getProfiler().push("move");
this.moveControl.tick();
- this.level.getProfiler().popPush("look");
this.lookControl.tick();
- this.level.getProfiler().popPush("jump");
this.jumpControl.tick();
- this.level.getProfiler().pop();
- this.level.getProfiler().pop();
this.sendDebugPackets();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index b738ee2d3801fadfd09313f05ae24593e56b0ec6..ce2804271bb67803c60c9121aec6c8dc0e99a1d9 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -11,7 +11,6 @@ import java.util.Set;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;
-import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
public class GoalSelector {
@@ -29,7 +28,6 @@ public class GoalSelector {
};
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
- private final Supplier<ProfilerFiller> profiler;
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
private int tickCount;
@@ -37,9 +35,7 @@ public class GoalSelector {
private int curRate;
private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector
- public GoalSelector(Supplier<ProfilerFiller> profiler) {
- this.profiler = profiler;
- }
+ public GoalSelector() {} // Gale - Purpur - remove vanilla profiler
public void addGoal(int priority, Goal goal) {
this.availableGoals.add(new WrappedGoal(priority, goal));
@@ -102,9 +98,6 @@ public class GoalSelector {
}
public void tick() {
- ProfilerFiller profilerFiller = this.profiler.get();
- profilerFiller.push("goalCleanup");
-
for(WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) {
wrappedGoal.stop();
@@ -120,9 +113,6 @@ public class GoalSelector {
}
}
- profilerFiller.pop();
- profilerFiller.push("goalUpdate");
-
for(WrappedGoal wrappedGoal2 : this.availableGoals) {
// Paper start
if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.goalTypes) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) {
@@ -141,21 +131,15 @@ public class GoalSelector {
}
}
- profilerFiller.pop();
this.tickRunningGoals(true);
}
public void tickRunningGoals(boolean tickAll) {
- ProfilerFiller profilerFiller = this.profiler.get();
- profilerFiller.push("goalTick");
-
for(WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) {
wrappedGoal.tick();
}
}
-
- profilerFiller.pop();
}
public Set<WrappedGoal> getAvailableGoals() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 7ffe5bef3778d5971ea4ceadf3102725fd0d08cd..ec797e7ab5185ae9f4ccae53023785ce780d89ad 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -172,12 +172,10 @@ public abstract class PathNavigation {
}
}
// Paper end
- this.level.getProfiler().push("pathfind");
BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition();
int i = (int)(followRange + (float)range);
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier);
- this.level.getProfiler().pop();
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = distance;
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
index 288c6627906d07c0d223eacd84ae4eb31a349998..ed440b9a84ac0e4619c075491515fa072d6aebec 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java
@@ -26,9 +26,7 @@ public class Sensing {
} else if (this.unseen.contains(i)) {
return false;
} else {
- this.mob.level.getProfiler().push("hasLineOfSight");
boolean bl = this.mob.hasLineOfSight(entity);
- this.mob.level.getProfiler().pop();
if (bl) {
this.seen.add(i);
} else {
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 9b57d2b766f2de2d3fb4a3b5ef4df8d6756a1942..068c6904599f57b70b9cf166a5fe949362a7b23f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -225,12 +225,8 @@ public class Allay extends PathfinderMob implements InventoryCarrier {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("allayBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("allayActivityUpdate");
AllayAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index a4e98b02175da96472474b8d7ad5975ce4d2fc43..c513138be4b343ee1868a9ef541130a637fa0744 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -287,12 +287,8 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("axolotlBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("axolotlActivityUpdate");
AxolotlAi.updateActivity(this);
- this.level.getProfiler().pop();
if (!this.isNoAi()) {
Optional<Integer> optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 05c7680569346bb863b896bcc9515f3e7cfb8114..8fd496e3d51fc55caff764981654347d33357004 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -149,13 +149,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("camelBrain");
Brain<Camel> brain = (Brain<Camel>) this.getBrain(); // Paper - decompile fix
brain.tick((ServerLevel)this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("camelActivityUpdate");
CamelAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index a65cec3c9837882df5b61de58f03d276d4db6bfc..c7b08018dbfb7d210ea4102518ea7e592ad01452 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -169,12 +169,8 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("frogBrain");
this.getBrain().tick((ServerLevel)this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("frogActivityUpdate");
FrogAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index 9058f9f2e561cda9f475f33218bf7a78297de4bc..09240841cd9216c06da8dc4059f8a60ef9022d39 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -79,12 +79,8 @@ public class Tadpole extends AbstractFish {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("tadpoleBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("tadpoleActivityUpdate");
TadpoleAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index cfa904d42734d0fb0c1ed8b18f4d8bc131027962..ef584de97ba678176ab9bf61365d97ca61ff07cf 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -190,12 +190,8 @@ public class Goat extends Animal {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("goatBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().pop();
- this.level.getProfiler().push("goatActivityUpdate");
GoatAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index c6949c7ec0766bda07324a6f004b29cbd37d0f1f..b7e248b9589a52f561bddacdbdf873cdfec290b4 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -435,11 +435,8 @@ public class Sniffer extends Animal {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("snifferBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().popPush("snifferActivityUpdate");
SnifferAi.updateActivity(this);
- this.level.getProfiler().pop();
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
index 51ad507a3b625201ecca50bd92f8f089f3b4d60a..818d1f09b63ad0df9e3fae059a05801571a5606d 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
@@ -198,9 +198,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("zoglinBrain");
this.getBrain().tick((ServerLevel)this.level, this);
- this.level.getProfiler().pop();
this.updateActivity();
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 5d3b3cb3a882eb5d716f678095a65b28d0967476..739f4f86af7951ea42a3b248b93989de8b8f4f54 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -128,9 +128,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("hoglinBrain");
this.getBrain().tick((ServerLevel)this.level, this);
- this.level.getProfiler().pop();
HoglinAi.updateActivity(this);
if (this.isConverting()) {
++this.timeInOverworld;
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
index afa7ecfa8453da510ec5ccecb1ceeb1d9893d259..a2246ab400545284cb65c292012eaf8bb3376ad7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -310,9 +310,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("piglinBrain");
this.getBrain().tick((ServerLevel) this.level, this);
- this.level.getProfiler().pop();
PiglinAi.updateActivity(this);
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index e44eec821eaa1cd77569814000d4aa36253fb13d..edee6a47e67a9e02ac269dcc16b1932cedb4d8aa 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -85,9 +85,7 @@ public class PiglinBrute extends AbstractPiglin {
@Override
protected void customServerAiStep() {
- this.level.getProfiler().push("piglinBruteBrain");
this.getBrain().tick((ServerLevel)this.level, this);
- this.level.getProfiler().pop();
PiglinBruteAi.updateActivity(this);
PiglinBruteAi.maybePlayActivitySound(this);
super.customServerAiStep();
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index b2b63d9df3c07696f47281e9be74f1799f50b93e..4544ce7e0f33b13a56cd4d4a3c905f71d370bbe6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -274,9 +274,7 @@ public class Warden extends Monster implements VibrationListener.VibrationListen
protected void customServerAiStep() {
ServerLevel worldserver = (ServerLevel) this.level;
- worldserver.getProfiler().push("wardenBrain");
this.getBrain().tick(worldserver, this);
- this.level.getProfiler().pop();
super.customServerAiStep();
if ((this.tickCount + this.getId()) % 120 == 0) {
Warden.applyDarknessAround(worldserver, this.position(), this, 20);
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 6023b9eb3001e1a98ab8b970d853c4e7c7603f4d..cf865df0763ebbe9ebbe74f32b0863e2636de63f 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -246,9 +246,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@Override
protected void customServerAiStep() { mobTick(false); }
protected void mobTick(boolean inactive) {
- this.level.getProfiler().push("villagerBrain");
if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper
- this.level.getProfiler().pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 59837144c2c0460aca6e8c349eb3d6528111d1dc..aa6ea4ebaa6777815f3a2245f260c5e58a7a3b21 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -372,7 +372,6 @@ public class Explosion {
if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper
BlockPos blockposition1 = blockposition.immutable();
- this.level.getProfiler().push("explosion_blocks");
if (block.dropFromExplosion(this)) {
Level world = this.level;
@@ -394,7 +393,6 @@ public class Explosion {
this.level.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 3);
block.wasExploded(this.level, blockposition, this);
- this.level.getProfiler().pop();
}
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 63122fb74a51547e23232a5409295369ee3aa353..262626a0a01ed05f3f49cebec8b31266b2c441e7 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -35,7 +35,6 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.util.AbortableIterationConsumer;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageSources;
@@ -130,7 +129,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
private final ResourceKey<DimensionType> dimensionTypeId;
private final Holder<DimensionType> dimensionTypeRegistration;
public final WritableLevelData levelData;
- private final Supplier<ProfilerFiller> profiler;
public final boolean isClientSide;
private final WorldBorder worldBorder;
private final BiomeManager biomeManager;
@@ -272,7 +270,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, GaleWorldConfiguration> galeWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor // Gale - Gale configuration
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, GaleWorldConfiguration> galeWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor // Gale - Gale configuration // Gale - Purpur - remove vanilla profiler
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
this.galeConfig = galeWorldConfigCreator.apply(this.spigotConfig); // Gale - Gale configuration
@@ -287,7 +285,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// CraftBukkit end
- this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
this.dimensionTypeId = (ResourceKey) holder.unwrapKey().orElseThrow(() -> {
@@ -568,9 +565,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
BlockState iblockdata2 = this.getBlockState(pos);
if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
- this.getProfiler().push("queueCheckLight");
this.getChunkSource().getLightEngine().checkBlock(pos);
- this.getProfiler().pop();
}
/*
@@ -869,9 +864,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
protected void tickBlockEntities() {
- ProfilerFiller gameprofilerfiller = this.getProfiler();
-
- gameprofilerfiller.push("blockEntities");
timings.tileEntityPending.startTiming(); // Spigot
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
@@ -916,7 +908,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
- gameprofilerfiller.pop();
spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1109,7 +1100,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
- this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
return list;
@@ -1128,7 +1118,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
- this.getProfiler().incrementCounter("getEntities");
// Paper start - optimise this call
//TODO use limit
if (filter instanceof net.minecraft.world.entity.EntityType entityTypeTest) {
@@ -1452,14 +1441,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return false;
}
- public ProfilerFiller getProfiler() {
- return (ProfilerFiller) this.profiler.get();
- }
-
- public Supplier<ProfilerFiller> getProfilerSupplier() {
- return this.profiler;
- }
-
@Override
public BiomeManager getBiomeManager() {
return this.biomeManager;
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 15d266fc97eb73338f4f6fb2cfe25d6861e79810..eebc251467ddc141b2ae0408941740f6b01d11f2 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -132,7 +132,6 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
- world.getProfiler().push("spawner");
world.timings.mobSpawn.startTiming(); // Spigot
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -189,7 +188,6 @@ public final class NaturalSpawner {
}
world.timings.mobSpawn.stopTiming(); // Spigot
- world.getProfiler().pop();
}
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
index 0f1025495237aebe30132ace0832aa5718d6f9bb..efe922810507c96183a56a5e81a7b14214d8747b 100644
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
@@ -154,8 +154,4 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
public int getHeight() {
return this.level.getHeight();
}
-
- public ProfilerFiller getProfiler() {
- return this.level.getProfiler();
- }
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 206dc04086a218b510930739a6c573f2653ab0fa..d46ca5eb581bdf4b64bdb875a93238ef6343090c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -28,7 +28,6 @@ import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
@@ -1306,9 +1305,6 @@ public class LevelChunk extends ChunkAccess {
if (LevelChunk.this.isTicking(blockposition)) {
try {
- ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
-
- gameprofilerfiller.push(this::getType);
this.blockEntity.tickTimer.startTiming(); // Spigot
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
@@ -1319,8 +1315,6 @@ public class LevelChunk extends ChunkAccess {
this.loggedInvalidBlockState = true;
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
}
-
- gameprofilerfiller.pop();
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index d23481453717f715124156b5d83f6448f720d049..c4052d1a7c2903564a8a6226c1b019d299c71b2a 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -12,7 +12,6 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.profiling.metrics.MetricCategory;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.PathNavigationRegion;
@@ -44,7 +43,7 @@ public class PathFinder {
map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), pos));
}
// Paper end
- Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
+ Path path = this.findPath(node, map, followRange, distance, rangeMultiplier); // Gale - Purpur - remove vanilla profiler
this.nodeEvaluator.done();
return path;
}
@@ -52,9 +51,7 @@ public class PathFinder {
@Nullable
// Paper start - optimize collection
- private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
- profiler.push("find_path");
- profiler.markForCharting(MetricCategory.PATH_FINDING);
+ private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // Gale - Purpur - remove vanilla profiler
// Set<Target> set = positions.keySet();
startNode.g = 0.0F;
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
index 1d7c663fa0e550bd0cfb9a4b83ccd7e2968666f0..cf685940e09251bef1a3d06f1e2468ce4ff46cc5 100644
--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java
+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
@@ -23,7 +23,6 @@ import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.core.Vec3i;
-import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
@@ -32,7 +31,6 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
return ScheduledTick.INTRA_TICK_DRAIN_ORDER.compare(a.peek(), b.peek());
};
private final LongPredicate tickCheck;
- private final Supplier<ProfilerFiller> profiler;
private final Long2ObjectMap<LevelChunkTicks<T>> allContainers = new Long2ObjectOpenHashMap<>();
private final Long2LongMap nextTickForContainer = Util.make(new Long2LongOpenHashMap(), (map) -> {
map.defaultReturnValue(Long.MAX_VALUE);
@@ -48,9 +46,8 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
};
- public LevelTicks(LongPredicate tickingFutureReadyPredicate, Supplier<ProfilerFiller> profilerGetter) {
+ public LevelTicks(LongPredicate tickingFutureReadyPredicate) { // Gale - Purpur - remove vanilla profiler
this.tickCheck = tickingFutureReadyPredicate;
- this.profiler = profilerGetter;
}
public void addContainer(ChunkPos pos, LevelChunkTicks<T> scheduler) {
@@ -86,20 +83,13 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
public void tick(long time, int maxTicks, BiConsumer<BlockPos, T> ticker) {
- ProfilerFiller profilerFiller = this.profiler.get();
- profilerFiller.push("collect");
- this.collectTicks(time, maxTicks, profilerFiller);
- profilerFiller.popPush("run");
- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size());
+ this.collectTicks(time, maxTicks); // Gale - Purpur - remove vanilla profiler
this.runCollectedTicks(ticker);
- profilerFiller.popPush("cleanup");
this.cleanupAfterTick();
- profilerFiller.pop();
}
- private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) {
+ private void collectTicks(long time, int maxTicks) { // Gale - Purpur - remove vanilla profiler
this.sortContainersToTick(time);
- profiler.incrementCounter("containersToTick", this.containersToTick.size());
this.drainContainers(time, maxTicks);
this.rescheduleLeftoverContainers();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
index 3cb4860fea30bfaf2147b4f29a34336b6e417d6c..970496eca63f8e6020722aa4ed6813b63161da37 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
@@ -40,8 +40,10 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
if (this.getRabbitType() == Type.THE_KILLER_BUNNY) {
// Reset goals and target finders.
Level world = ((CraftWorld) this.getWorld()).getHandle();
- entity.goalSelector = new GoalSelector(world.getProfilerSupplier());
- entity.targetSelector = new GoalSelector(world.getProfilerSupplier());
+ // Gale start - Purpur - remove vanilla profiler
+ entity.goalSelector = new GoalSelector();
+ entity.targetSelector = new GoalSelector();
+ // Gale end - Purpur - remove vanilla profiler
entity.registerGoals();
entity.initializePathFinderGoals();
}