9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0019-Config-to-disable-method-profiler.patch
Lumine1909 c5ecbe85d2 1.21.7/8 (#587)
---------

Co-authored-by: MC-XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
2025-07-21 21:18:24 +08:00

33 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Mon, 15 Aug 2022 10:18:36 +0800
Subject: [PATCH] Config to disable method profiler
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index feb5fc93498a5ed89e3bcb61cd72ba6e75881358..6539574b72dcb362d8d106a68d6e2d968340fc5e 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1248,7 +1248,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
lastTick = currentTime;
this.nextTickTimeNanos += l;
- try (Profiler.Scope scope = Profiler.use(this.createProfiler())) {
+ try (Profiler.Scope scope = org.leavesmc.leaves.LeavesConfig.mics.disableMethodProfiler ? null : Profiler.use(this.createProfiler())) { // Leaves - disable profiler
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("tick");
this.tickFrame.start();
diff --git a/net/minecraft/util/profiling/Profiler.java b/net/minecraft/util/profiling/Profiler.java
index cbd57d68e169ed044f325a776075da78b473b6f3..3e597d650e262bb6021062521f66c91d9806860b 100644
--- a/net/minecraft/util/profiling/Profiler.java
+++ b/net/minecraft/util/profiling/Profiler.java
@@ -44,6 +44,7 @@ public final class Profiler {
}
public static ProfilerFiller get() {
+ if (org.leavesmc.leaves.LeavesConfig.mics.disableMethodProfiler) return InactiveProfiler.INSTANCE; // Leaves - disable profiler
return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : Objects.requireNonNullElseGet(ACTIVE.get(), Profiler::getDefaultFiller);
}