Commits

md_5 authored 3996d7d5c02
Patch rebuild
No tags

CraftBukkit-Patches/0010-Spigot-Timings.patch

Modified
1 -From 544cf1c81c690e8a8ee1d1814faafdb5c567e111 Mon Sep 17 00:00:00 2001
1 +From fc6e386a2d4d78e3149364bca505cc07b09cc926 Mon Sep 17 00:00:00 2001
2 2 From: Aikar <aikar@aikar.co>
3 3 Date: Thu, 10 Jan 2013 00:18:11 -0500
4 4 Subject: [PATCH] Spigot Timings
5 5
6 6 Overhauls the Timings System adding performance tracking all around the Minecraft Server
7 7
8 8 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
9 9 index ead421a..38f303d 100644
10 10 --- a/src/main/java/net/minecraft/server/Chunk.java
11 11 +++ b/src/main/java/net/minecraft/server/Chunk.java
223 223 + SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
224 224 this.world.methodProfiler.b();
225 225 this.world.methodProfiler.a("push");
226 226 + SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
227 227 this.cs();
228 228 + SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
229 229 this.world.methodProfiler.b();
230 230 }
231 231
232 232 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
233 -index 715ada4..f738015 100644
233 +index 763e02a..3a9d674 100644
234 234 --- a/src/main/java/net/minecraft/server/MinecraftServer.java
235 235 +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
236 236 @@ -50,6 +50,8 @@ import org.apache.logging.log4j.Logger;
237 237 import org.bukkit.Bukkit;
238 238 import org.bukkit.craftbukkit.CraftServer;
239 239 // CraftBukkit end
240 240 +import org.bukkit.craftbukkit.SpigotTimings; // Spigot
241 241 +
242 242 public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics {
243 243
244 244 public static final Logger LOGGER = LogManager.getLogger();
245 -@@ -633,6 +635,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
245 +@@ -634,6 +636,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
246 246 public void B() {}
247 247
248 248 protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws
249 249 + SpigotTimings.serverTickTimer.startTiming(); // Spigot
250 250 long i = System.nanoTime();
251 251
252 252 ++this.ticks;
253 -@@ -659,10 +662,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
253 +@@ -660,10 +663,12 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
254 254 }
255 255
256 256 if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
257 257 + SpigotTimings.worldSaveTimer.startTiming(); // Spigot
258 258 this.methodProfiler.a("save");
259 259 this.v.savePlayers();
260 260 this.saveChunks(true);
261 261 this.methodProfiler.b();
262 262 + SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
263 263 }
264 264
265 265 this.methodProfiler.a("tallying");
266 -@@ -679,6 +684,8 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
266 +@@ -680,10 +685,14 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
267 267
268 268 this.methodProfiler.b();
269 269 this.methodProfiler.b();
270 270 + SpigotTimings.serverTickTimer.stopTiming(); // Spigot
271 271 + org.spigotmc.CustomTimingsHandler.tick(); // Spigot
272 272 }
273 273
274 274 public void D() {
275 -@@ -693,16 +700,23 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
276 -
277 - this.methodProfiler.c("levels");
278 -
279 275 + SpigotTimings.schedulerTimer.startTiming(); // Spigot
280 - // CraftBukkit start
281 - this.server.getScheduler().mainThreadHeartbeat(this.ticks);
276 + this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
282 277 + SpigotTimings.schedulerTimer.stopTiming(); // Spigot
278 + this.methodProfiler.a("jobs");
279 + Queue queue = this.j;
283 280
281 +@@ -697,12 +706,17 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
282 +
283 + // CraftBukkit start
284 284 // Run tasks that are waiting on processing
285 285 + SpigotTimings.processQueueTimer.startTiming(); // Spigot
286 286 while (!processQueue.isEmpty()) {
287 287 processQueue.remove().run();
288 288 }
289 289 + SpigotTimings.processQueueTimer.stopTiming(); // Spigot
290 290
291 291 + SpigotTimings.chunkIOTickTimer.startTiming(); // Spigot
292 292 org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick();
293 293 + SpigotTimings.chunkIOTickTimer.stopTiming(); // Spigot
349 349
350 350 + SpigotTimings.tickablesTimer.startTiming(); // Spigot
351 351 for (i = 0; i < this.o.size(); ++i) {
352 352 ((ITickable) this.o.get(i)).E_();
353 353 }
354 354 + SpigotTimings.tickablesTimer.stopTiming(); // Spigot
355 355
356 356 this.methodProfiler.b();
357 357 }
358 358 diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
359 -index 9946fb7..7bb61f0 100644
359 +index 4cee909..754fa3b 100644
360 360 --- a/src/main/java/net/minecraft/server/PlayerConnection.java
361 361 +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
362 362 @@ -1283,6 +1283,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
363 363 // CraftBukkit end
364 364
365 365 private void handleCommand(String s) {
366 366 + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
367 367 // CraftBukkit start - whole method
368 368 this.LOGGER.info(this.player.getName() + " issued server command: " + s);
369 369
567 567 this.ao();
568 568 + timings.doSounds.stopTiming(); // Spigot
569 569
570 570 + timings.doChunkGC.startTiming();// Spigot
571 571 this.getWorld().processChunkGC(); // CraftBukkit
572 572 + timings.doChunkGC.stopTiming(); // Spigot
573 573 }
574 574
575 575 @Nullable
576 576 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
577 -index f609035..b09cd94 100644
577 +index b2895b1..c855d9f 100644
578 578 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
579 579 +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
580 580 @@ -1674,6 +1674,11 @@ public final class CraftServer implements Server {
581 581 private final Spigot spigot = new Spigot()
582 582 {
583 583
584 584 + @Override
585 585 + public YamlConfiguration getConfig()
586 586 + {
587 587 + return org.spigotmc.SpigotConfig.config;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut