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
MC_XiaoHei 90080d238e 1.21.10 (#752)
---------

Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
2025-11-28 03:15:54 +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 309ff4c55b2a4ccf3d18951b51c2e10d0ff39bfc..19b89c3d0a21c0223bac1844081099d2bf8296ab 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1333,7 +1333,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper - improve tick loop - done above
- 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);
}