Updated Timings to better detail saves

This commit is contained in:
Aikar 2016-10-20 00:21:35 -04:00
parent 59eb1231b5
commit 4708920d8d
5 changed files with 112 additions and 13 deletions

View file

@ -114,7 +114,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
try { try (co.aikar.timings.Timing timed = world.timings.chunkSaveNop.startTiming()) {
this.chunkLoader.b(this.world, chunk); this.chunkLoader.b(this.world, chunk);
} catch (Exception exception) { } catch (Exception exception) {
- ChunkProviderServer.a.error("Couldn\'t save entities", exception); - ChunkProviderServer.a.error("Couldn\'t save entities", exception);

View file

@ -91,7 +91,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
- if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit - if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
MinecraftTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save"); this.methodProfiler.a("save");
+ +
+ serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper + serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper
@ -112,7 +111,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// this.saveChunks(true); // this.saveChunks(true);
// Spigot End // Spigot End
this.methodProfiler.b(); this.methodProfiler.b();
MinecraftTimings.worldSaveTimer.stopTiming(); // Spigot
- } - }
+ //} // Paper - Incremental Auto Saving + //} // Paper - Incremental Auto Saving
@ -128,13 +126,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (chunkproviderserver.e()) { if (chunkproviderserver.e()) {
- org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit - org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
+ if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit // Paper - Incremental Auto Saving - Only fire event on full save + if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit // Paper - Incremental Auto Saving - Only fire event on full save
timings.worldSave.startTiming(); // Paper
+ if (flag || server.serverAutoSave) { // Paper
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.a("Saving level"); iprogressupdate.a("Saving level");
} }
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
- this.a();
+ if (flag || server.serverAutoSave) this.a(); // Paper
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.c("Saving chunks"); iprogressupdate.c("Saving chunks");
} }
+ } // Paper
timings.worldSaveChunks.startTiming(); // Paper
chunkproviderserver.a(flag);
-- --

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
chunkproviderserver.a(flag); chunkproviderserver.a(flag);
timings.worldSaveChunks.stopTiming(); // Paper
// CraftBukkit - ArrayList -> Collection // CraftBukkit - ArrayList -> Collection
- Collection arraylist = chunkproviderserver.a(); - Collection arraylist = chunkproviderserver.a();
+ /* //Paper start Collection arraylist = chunkproviderserver.a(); + /* //Paper start Collection arraylist = chunkproviderserver.a();
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- } - }
+ }*/ + }*/
+ // Paper end + // Paper end
timings.worldSave.stopTiming(); // Paper
} }
} }
-- --

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -0,0 +0,0 @@ public class WorldTimingsHandler {
public final Timing chunkIOStage1; public final Timing chunkSaveNop;
public final Timing chunkIOStage2; public final Timing chunkSaveData;
+ public final Timing lightingQueueTimer; + public final Timing lightingQueueTimer;
+ +

View file

@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final Timing chunkIOTickTimer = Timings.ofSafe("ChunkIOTick"); + public static final Timing chunkIOTickTimer = Timings.ofSafe("ChunkIOTick");
+ public static final Timing timeUpdateTimer = Timings.ofSafe("Time Update"); + public static final Timing timeUpdateTimer = Timings.ofSafe("Time Update");
+ public static final Timing serverCommandTimer = Timings.ofSafe("Server Command"); + public static final Timing serverCommandTimer = Timings.ofSafe("Server Command");
+ public static final Timing worldSaveTimer = Timings.ofSafe("World Save"); + public static final Timing savePlayers = Timings.ofSafe("Save Players");
+ +
+ public static final Timing tickEntityTimer = Timings.ofSafe("## tickEntity"); + public static final Timing tickEntityTimer = Timings.ofSafe("## tickEntity");
+ public static final Timing tickTileEntityTimer = Timings.ofSafe("## tickTileEntity"); + public static final Timing tickTileEntityTimer = Timings.ofSafe("## tickTileEntity");
@ -325,6 +325,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final Timing chunkGeneration; + public final Timing chunkGeneration;
+ public final Timing chunkIOStage1; + public final Timing chunkIOStage1;
+ public final Timing chunkIOStage2; + public final Timing chunkIOStage2;
+ public final Timing worldSave;
+ public final Timing worldSaveChunks;
+ public final Timing worldSaveLevel;
+ public final Timing chunkSaveNop;
+ public final Timing chunkSaveData;
+ +
+ public WorldTimingsHandler(World server) { + public WorldTimingsHandler(World server) {
+ String name = server.worldData.getName() +" - "; + String name = server.worldData.getName() +" - ";
@ -363,6 +368,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ chunkGeneration = Timings.ofSafe(name + "chunkGeneration"); + chunkGeneration = Timings.ofSafe(name + "chunkGeneration");
+ chunkIOStage1 = Timings.ofSafe(name + "ChunkIO Stage 1 - DiskIO"); + chunkIOStage1 = Timings.ofSafe(name + "ChunkIO Stage 1 - DiskIO");
+ chunkIOStage2 = Timings.ofSafe(name + "ChunkIO Stage 2 - Post Load"); + chunkIOStage2 = Timings.ofSafe(name + "ChunkIO Stage 2 - Post Load");
+ worldSave = Timings.ofSafe(name + "World Save");
+ worldSaveLevel = Timings.ofSafe(name + "World Save - Level");
+ worldSaveChunks = Timings.ofSafe(name + "World Save - Chunks");
+ chunkSaveNop = Timings.ofSafe(name + "Chunk Save - NOP");
+ chunkSaveData = Timings.ofSafe(name + "Chunk Save - Data");
+ +
+ tracker1 = Timings.ofSafe(name + "tracker stage 1"); + tracker1 = Timings.ofSafe(name + "tracker stage 1");
+ tracker2 = Timings.ofSafe(name + "tracker stage 2"); + tracker2 = Timings.ofSafe(name + "tracker stage 2");
@ -482,6 +492,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
private void z() { private void z() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
}
public void saveChunkNOP(Chunk chunk) {
- try {
+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveNop.startTiming()) {
this.chunkLoader.b(this.world, chunk);
} catch (Exception exception) {
ChunkProviderServer.a.error("Couldn\'t save entities", exception);
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
}
public void saveChunk(Chunk chunk) {
- try {
+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) {
chunk.setLastSaved(this.world.getTime());
this.chunkLoader.a(this.world, chunk);
} catch (IOException ioexception) {
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@ -729,7 +761,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot - SpigotTimings.worldSaveTimer.startTiming(); // Spigot
+ MinecraftTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save"); this.methodProfiler.a("save");
this.v.savePlayers(); this.v.savePlayers();
// Spigot Start // Spigot Start
@ -738,7 +769,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot End // Spigot End
this.methodProfiler.b(); this.methodProfiler.b();
- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot - SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
+ MinecraftTimings.worldSaveTimer.stopTiming(); // Spigot
} }
this.methodProfiler.a("tallying"); this.methodProfiler.a("tallying");
@ -986,6 +1016,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// this.minecraftServer.getCommandHandler().a(this.player, s); // this.minecraftServer.getCommandHandler().a(this.player, s);
// CraftBukkit end // CraftBukkit end
} }
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -0,0 +0,0 @@
package net.minecraft.server;
+import co.aikar.timings.MinecraftTimings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
public void savePlayers() {
+ MinecraftTimings.savePlayers.startTiming(); // Paper
for (int i = 0; i < this.players.size(); ++i) {
this.savePlayerFile((EntityPlayer) this.players.get(i));
}
-
+ MinecraftTimings.savePlayers.stopTiming(); // Paper
}
public void addWhitelist(GameProfile gameprofile) {
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java --- a/src/main/java/net/minecraft/server/StructureGenerator.java
@ -1244,6 +1298,49 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
} }
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
if (chunkproviderserver.e()) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
+ timings.worldSave.startTiming(); // Paper
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
iprogressupdate.c("Saving chunks");
}
+ timings.worldSaveChunks.startTiming(); // Paper
chunkproviderserver.a(flag);
+ timings.worldSaveChunks.stopTiming(); // Paper
// CraftBukkit - ArrayList -> Collection
Collection arraylist = chunkproviderserver.a();
Iterator iterator = arraylist.iterator();
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
chunkproviderserver.unload(chunk);
}
}
-
+ timings.worldSave.stopTiming(); // Paper
}
}
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}
protected void a() throws ExceptionWorldConflict {
+ timings.worldSaveLevel.startTiming(); // Paper
this.checkSession();
WorldServer[] aworldserver = this.server.worldServer;
int i = aworldserver.length;
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.worldData.e(this.getWorldBorder().i());
this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().t());
this.worldMaps.a();
+ timings.worldSaveLevel.stopTiming(); // Paper
}
// CraftBukkit start
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java