Debug sync chunk loads
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 2 Apr 2022 17:25:28 -0500
|
||||
Subject: [PATCH] Debug sync chunk loads
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index d0c55497040158d959693ef2ddf3ff03bd6df05f..62d87903f339669ed0730118d2d0707062f766c8 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -70,7 +70,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class PaperCommand extends Command {
|
||||
private static final String BASE_PERM = "bukkit.command.paper.";
|
||||
- private static final ImmutableSet<String> SUBCOMMANDS = ImmutableSet.<String>builder().add("heap", "entity", "reload", "version", "debug", "chunkinfo", "fixlight", "syncloadinfo", "dumpitem", "mobcaps", "playermobcaps").build();
|
||||
+ private static final ImmutableSet<String> SUBCOMMANDS = ImmutableSet.<String>builder().add("heap", "entity", "reload", "version", "debug", "chunkinfo", "fixlight", "syncloadinfo", "dumpitem", "mobcaps", "playermobcaps", "debugsyncload").build(); // Slice
|
||||
|
||||
public PaperCommand(String name) {
|
||||
super(name);
|
||||
@@ -122,6 +122,12 @@ public class PaperCommand extends Command {
|
||||
return getListMatchingLast(sender, args, "clear");
|
||||
}
|
||||
break;
|
||||
+ // Slice start
|
||||
+ case "debugsyncload":
|
||||
+ SyncLoadFinder.DEBUG = !SyncLoadFinder.DEBUG;
|
||||
+ MinecraftServer.LOGGER.info("Debugging sync chunk loads now " + (SyncLoadFinder.DEBUG ? "ON" : "OFF"));
|
||||
+ break;
|
||||
+ // Slice end
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
index d3e619655382e50e9ac9323ed942502d85c9599c..ff222a54a320eee467383a612f2ce17614b0fe2a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
@@ -17,6 +17,8 @@ public class SyncLoadFinder {
|
||||
|
||||
public static final boolean ENABLED = Boolean.getBoolean("paper.debug-sync-loads");
|
||||
|
||||
+ public static boolean DEBUG; // Slice
|
||||
+
|
||||
private static final WeakHashMap<Level, Object2ObjectOpenHashMap<ThrowableWithEquals, SyncLoadInformation>> SYNC_LOADS = new WeakHashMap<>();
|
||||
|
||||
private static final class SyncLoadInformation {
|
||||
@@ -37,6 +39,13 @@ public class SyncLoadFinder {
|
||||
|
||||
final ThrowableWithEquals stacktrace = new ThrowableWithEquals(Thread.currentThread().getStackTrace());
|
||||
|
||||
+ // Slice start
|
||||
+ if (DEBUG) {
|
||||
+ org.bukkit.Bukkit.getServer().getLogger().log(java.util.logging.Level.WARNING, "Sync chunk load at " + world.getWorld().getName() + " (" + chunkX + "," + chunkZ + ")");
|
||||
+ Thread.dumpStack();
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
SYNC_LOADS.compute(world, (final Level keyInMap, Object2ObjectOpenHashMap<ThrowableWithEquals, SyncLoadInformation> map) -> {
|
||||
if (map == null) {
|
||||
map = new Object2ObjectOpenHashMap<>();
|
||||
Reference in New Issue
Block a user