2016-07-15 22:36:53 +00:00
From 154f0ef603f61f2902d211375f658b61246b350c Mon Sep 17 00:00:00 2001
2016-01-09 06:32:38 +00:00
From: Aikar <aikar@aikar.co>
2016-03-03 09:46:26 +00:00
Date: Thu, 3 Mar 2016 04:00:11 -0600
2016-01-09 06:32:38 +00:00
Subject: [PATCH] Timings v2
2016-04-01 04:18:18 +00:00
diff --git a/pom.xml b/pom.xml
2016-06-25 17:19:04 +00:00
index 4ae34c8..63aaa7a 100644
2016-04-01 04:18:18 +00:00
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,12 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>co.aikar</groupId>
+ <artifactId>fastutil-lite</artifactId>
+ <version>1.0</version>
2016-04-01 04:35:21 +00:00
+ <scope>compile</scope>
2016-04-01 04:18:18 +00:00
+ </dependency>
+ <dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
2016-04-30 01:23:40 +00:00
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
2016-01-10 07:33:27 +00:00
new file mode 100644
2016-04-30 01:23:40 +00:00
index 0000000..0f8315c
2016-01-10 07:33:27 +00:00
--- /dev/null
2016-04-30 01:23:40 +00:00
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
2016-03-18 21:11:53 +00:00
@@ -0,0 +1,110 @@
2016-01-10 07:33:27 +00:00
+package co.aikar.timings;
+
+import net.minecraft.server.*;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.scheduler.BukkitTask;
+
+import org.bukkit.craftbukkit.scheduler.CraftTask;
+
2016-04-30 01:23:40 +00:00
+public final class MinecraftTimings {
2016-01-10 07:33:27 +00:00
+
+ public static final Timing playerListTimer = Timings.ofSafe("Player List");
+ public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
+ public static final Timing tickablesTimer = Timings.ofSafe("Tickables");
2016-02-24 04:35:34 +00:00
+ public static final Timing minecraftSchedulerTimer = Timings.ofSafe("Minecraft Scheduler");
+ public static final Timing bukkitSchedulerTimer = Timings.ofSafe("Bukkit Scheduler");
2016-01-10 07:33:27 +00:00
+ public static final Timing chunkIOTickTimer = Timings.ofSafe("ChunkIOTick");
+ public static final Timing timeUpdateTimer = Timings.ofSafe("Time Update");
+ public static final Timing serverCommandTimer = Timings.ofSafe("Server Command");
+ public static final Timing worldSaveTimer = Timings.ofSafe("World Save");
+
+ public static final Timing tickEntityTimer = Timings.ofSafe("## tickEntity");
+ public static final Timing tickTileEntityTimer = Timings.ofSafe("## tickTileEntity");
+
+ public static final Timing processQueueTimer = Timings.ofSafe("processQueue");
+
+ public static final Timing playerCommandTimer = Timings.ofSafe("playerCommand");
+
+ public static final Timing entityActivationCheckTimer = Timings.ofSafe("entityActivationCheck");
+
+ public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update");
+ public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate");
+
2016-04-30 01:23:40 +00:00
+ private MinecraftTimings() {}
2016-01-10 07:33:27 +00:00
+
+ /**
+ * Gets a timer associated with a plugins tasks.
+ * @param bukkitTask
+ * @param period
+ * @return
+ */
+ public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) {
+ if (!bukkitTask.isSync()) {
+ return null;
+ }
+ Plugin plugin;
+
+ Runnable task = ((CraftTask) bukkitTask).task;
+
+ final Class<? extends Runnable> taskClass = task.getClass();
+ if (bukkitTask.getOwner() != null) {
+ plugin = bukkitTask.getOwner();
+ } else {
+ plugin = TimingsManager.getPluginByClassloader(taskClass);
+ }
+
+ final String taskname;
+ if (taskClass.isAnonymousClass()) {
+ taskname = taskClass.getName();
+ } else {
+ taskname = taskClass.getCanonicalName();
+ }
+
+ String name = "Task: " +taskname;
+ if (period > 0) {
+ name += " (interval:" + period +")";
+ } else {
+ name += " (Single)";
+ }
+
+ if (plugin == null) {
+ return Timings.ofSafe(null, name, TimingsManager.PLUGIN_GROUP_HANDLER);
+ }
+
+ return Timings.ofSafe(plugin, name);
+ }
+
+ /**
+ * Get a named timer for the specified entity type to track type specific timings.
+ * @param entity
+ * @return
+ */
+ public static Timing getEntityTimings(Entity entity) {
+ String entityType = entity.getClass().getName();
+ return Timings.ofSafe("Minecraft", "## tickEntity - " + entityType, tickEntityTimer);
+ }
+
+ /**
+ * Get a named timer for the specified tile entity type to track type specific timings.
+ * @param entity
+ * @return
+ */
+ public static Timing getTileEntityTimings(TileEntity entity) {
+ String entityType = entity.getClass().getName();
+ return Timings.ofSafe("Minecraft", "## tickTileEntity - " + entityType, tickTileEntityTimer);
+ }
+ public static Timing getCancelTasksTimer() {
+ return Timings.ofSafe("Cancel Tasks");
+ }
+ public static Timing getCancelTasksTimer(Plugin plugin) {
+ return Timings.ofSafe(plugin, "Cancel Tasks");
+ }
+
+ public static void stopServer() {
+ TimingsManager.stopServer();
+ }
+
+ public static Timing getBlockTiming(Block block) {
+ return Timings.ofSafe("## Scheduled Block: " + block.getName());
+ }
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
2016-06-05 04:10:50 +00:00
index 0000000..741da72
2016-01-10 07:33:27 +00:00
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
2016-06-05 04:10:50 +00:00
@@ -0,0 +1,85 @@
2016-01-10 07:33:27 +00:00
+package co.aikar.timings;
+
+import net.minecraft.server.World;
+
+/**
+ * Set of timers per world, to track world specific timings.
+ */
+public class WorldTimingsHandler {
+ public final Timing mobSpawn;
+ public final Timing doChunkUnload;
+ public final Timing doPortalForcer;
+ public final Timing scheduledBlocks;
+ public final Timing scheduledBlocksCleanup;
+ public final Timing scheduledBlocksTicking;
+ public final Timing chunkTicks;
+ public final Timing chunkTicksBlocks;
+ public final Timing doVillages;
+ public final Timing doChunkMap;
2016-06-05 04:10:50 +00:00
+ public final Timing doChunkMapUpdate;
+ public final Timing doChunkMapToUpdate;
+ public final Timing doChunkMapSortMissing;
+ public final Timing doChunkMapSortSendToPlayers;
+ public final Timing doChunkMapPlayersNeedingChunks;
+ public final Timing doChunkMapPendingSendToPlayers;
+ public final Timing doChunkMapUnloadChunks;
2016-01-10 07:33:27 +00:00
+ public final Timing doChunkGC;
+ public final Timing doSounds;
+ public final Timing entityRemoval;
+ public final Timing entityTick;
+ public final Timing tileEntityTick;
+ public final Timing tileEntityPending;
2016-04-30 01:23:40 +00:00
+ public final Timing tracker1;
+ public final Timing tracker2;
2016-01-10 07:33:27 +00:00
+ public final Timing doTick;
+ public final Timing tickEntities;
+
+ public final Timing syncChunkLoadTimer;
+ public final Timing syncChunkLoadDataTimer;
+ public final Timing syncChunkLoadStructuresTimer;
+ public final Timing syncChunkLoadEntitiesTimer;
+ public final Timing syncChunkLoadTileEntitiesTimer;
+ public final Timing syncChunkLoadTileTicksTimer;
+ public final Timing syncChunkLoadPostTimer;
+
+ public WorldTimingsHandler(World server) {
+ String name = server.worldData.getName() +" - ";
+
+ mobSpawn = Timings.ofSafe(name + "mobSpawn");
+ doChunkUnload = Timings.ofSafe(name + "doChunkUnload");
+ scheduledBlocks = Timings.ofSafe(name + "Scheduled Blocks");
+ scheduledBlocksCleanup = Timings.ofSafe(name + "Scheduled Blocks - Cleanup");
+ scheduledBlocksTicking = Timings.ofSafe(name + "Scheduled Blocks - Ticking");
+ chunkTicks = Timings.ofSafe(name + "Chunk Ticks");
+ chunkTicksBlocks = Timings.ofSafe(name + "Chunk Ticks - Blocks");
+ doVillages = Timings.ofSafe(name + "doVillages");
+ doChunkMap = Timings.ofSafe(name + "doChunkMap");
2016-06-05 04:10:50 +00:00
+ doChunkMapUpdate = Timings.ofSafe(name + "doChunkMap - Update");
+ doChunkMapToUpdate = Timings.ofSafe(name + "doChunkMap - To Update");
+ doChunkMapSortMissing = Timings.ofSafe(name + "doChunkMap - Sort Missing");
+ doChunkMapSortSendToPlayers = Timings.ofSafe(name + "doChunkMap - Sort Send To Players");
+ doChunkMapPlayersNeedingChunks = Timings.ofSafe(name + "doChunkMap - Players Needing Chunks");
+ doChunkMapPendingSendToPlayers = Timings.ofSafe(name + "doChunkMap - Pending Send To Players");
+ doChunkMapUnloadChunks = Timings.ofSafe(name + "doChunkMap - Unload Chunks");
2016-01-10 07:33:27 +00:00
+ doSounds = Timings.ofSafe(name + "doSounds");
+ doChunkGC = Timings.ofSafe(name + "doChunkGC");
+ doPortalForcer = Timings.ofSafe(name + "doPortalForcer");
+ entityTick = Timings.ofSafe(name + "entityTick");
+ entityRemoval = Timings.ofSafe(name + "entityRemoval");
+ tileEntityTick = Timings.ofSafe(name + "tileEntityTick");
+ tileEntityPending = Timings.ofSafe(name + "tileEntityPending");
+
+ syncChunkLoadTimer = Timings.ofSafe(name + "syncChunkLoad");
+ syncChunkLoadDataTimer = Timings.ofSafe(name + "syncChunkLoad - Data");
+ syncChunkLoadStructuresTimer = Timings.ofSafe(name + "chunkLoad - Structures");
+ syncChunkLoadEntitiesTimer = Timings.ofSafe(name + "chunkLoad - Entities");
+ syncChunkLoadTileEntitiesTimer = Timings.ofSafe(name + "chunkLoad - TileEntities");
+ syncChunkLoadTileTicksTimer = Timings.ofSafe(name + "chunkLoad - TileTicks");
+ syncChunkLoadPostTimer = Timings.ofSafe(name + "chunkLoad - Post");
+
2016-04-30 01:23:40 +00:00
+ tracker1 = Timings.ofSafe(name + "tracker stage 1");
+ tracker2 = Timings.ofSafe(name + "tracker stage 2");
2016-01-10 07:33:27 +00:00
+ doTick = Timings.ofSafe(name + "doTick");
+ tickEntities = Timings.ofSafe(name + "tickEntities");
+ }
+}
2016-02-29 23:09:49 +00:00
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2016-05-20 22:32:50 +00:00
index 0468372..7739e78 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2016-05-02 03:54:08 +00:00
@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit;
2016-02-29 23:09:49 +00:00
import java.util.logging.Level;
2016-05-02 03:54:08 +00:00
import java.util.regex.Pattern;
2016-02-29 23:09:49 +00:00
+import com.google.common.collect.Lists;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
+import co.aikar.timings.Timings;
+import co.aikar.timings.TimingsManager;
public class PaperConfig {
2016-05-02 03:54:08 +00:00
@@ -161,4 +164,24 @@ public class PaperConfig {
2016-03-25 04:59:37 +00:00
config.addDefault(path, def);
return config.getString(path, config.getString(path));
2016-02-29 23:09:49 +00:00
}
+
+ private static void timings() {
+ boolean timings = getBoolean("timings.enabled", true);
+ boolean verboseTimings = getBoolean("timings.verbose", true);
+ TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
+ TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
+ int timingHistoryInterval = getInt("timings.history-interval", 300);
+ int timingHistoryLength = getInt("timings.history-length", 3600);
+
+
+ Timings.setVerboseTimingsEnabled(verboseTimings);
+ Timings.setTimingsEnabled(timings);
+ Timings.setHistoryInterval(timingHistoryInterval * 20);
+ Timings.setHistoryLength(timingHistoryLength * 20);
+
+ Bukkit.getLogger().log(Level.INFO, "Spigot Timings: " + timings +
+ " - Verbose: " + verboseTimings +
+ " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
+ " - Length: " + timeSummary(Timings.getHistoryLength() / 20));
+ }
}
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
2016-06-09 03:57:14 +00:00
index a106e44..d17160a 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
2016-05-12 02:07:46 +00:00
@@ -33,6 +33,15 @@ public class Block {
2016-02-29 23:09:49 +00:00
protected final BlockStateList blockStateList;
private IBlockData blockData;
private String name;
+ // Paper start
2016-01-10 07:33:27 +00:00
+ public co.aikar.timings.Timing timing;
+ public co.aikar.timings.Timing getTiming() {
2016-01-09 06:32:38 +00:00
+ if (timing == null) {
2016-04-30 01:23:40 +00:00
+ timing = co.aikar.timings.MinecraftTimings.getBlockTiming(this);
2016-01-09 06:32:38 +00:00
+ }
+ return timing;
+ }
2016-02-29 23:09:49 +00:00
+ // Paper end
public static int getId(Block block) {
return Block.REGISTRY.a(block); // CraftBukkit - decompile error
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
2016-07-15 22:36:53 +00:00
index 11a49a3..e70d5c5 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
2016-07-15 22:36:53 +00:00
@@ -23,7 +23,7 @@ import java.io.PrintStream;
2016-01-09 06:32:38 +00:00
import org.apache.logging.log4j.Level;
import org.bukkit.craftbukkit.LoggerOutputStream;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-01-09 06:32:38 +00:00
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
2016-07-15 22:36:53 +00:00
@@ -428,7 +428,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
2016-04-30 01:23:40 +00:00
}
public void aL() {
- SpigotTimings.serverCommandTimer.startTiming(); // Spigot
+ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
2016-07-15 22:36:53 +00:00
@@ -443,7 +443,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
2016-04-30 01:23:40 +00:00
// CraftBukkit end
}
- SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
+ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot
}
public boolean aa() {
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
2016-06-15 22:43:51 +00:00
index 6ac7f42..e6d11ee 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
2016-02-29 23:09:49 +00:00
@@ -24,7 +24,8 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Hanging;
2016-01-09 06:32:38 +00:00
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
-import org.spigotmc.CustomTimingsHandler; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-02-29 23:09:49 +00:00
+import co.aikar.timings.Timing; // Paper
2016-01-09 06:32:38 +00:00
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
2016-02-29 23:09:49 +00:00
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
2016-06-09 03:57:14 +00:00
@@ -142,7 +143,7 @@ public abstract class Entity implements ICommandListener {
2016-02-29 23:09:49 +00:00
public boolean valid; // CraftBukkit
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949
2016-01-09 06:32:38 +00:00
- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
2016-04-30 01:23:40 +00:00
+ public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper
2016-02-29 23:09:49 +00:00
// Spigot start
2016-01-09 06:32:38 +00:00
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
2016-06-09 03:57:14 +00:00
@@ -466,7 +467,6 @@ public abstract class Entity implements ICommandListener {
2016-02-29 23:09:49 +00:00
}
2016-01-09 06:32:38 +00:00
public void move(double d0, double d1, double d2) {
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
if (this.noclip) {
this.a(this.getBoundingBox().c(d0, d1, d2));
2016-02-29 23:09:49 +00:00
this.recalcPosition();
2016-06-09 03:57:14 +00:00
@@ -804,7 +804,6 @@ public abstract class Entity implements ICommandListener {
2016-01-09 06:32:38 +00:00
this.world.methodProfiler.b();
}
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
}
2016-02-29 23:09:49 +00:00
public void recalcPosition() {
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
2016-07-15 22:36:53 +00:00
index 365b61d..0a583bc 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2016-05-12 02:07:46 +00:00
@@ -26,7 +26,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
2016-02-29 23:09:49 +00:00
import org.bukkit.event.player.PlayerItemConsumeEvent;
2016-01-09 06:32:38 +00:00
// CraftBukkit end
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-01-09 06:32:38 +00:00
public abstract class EntityLiving extends Entity {
2016-06-09 03:57:14 +00:00
@@ -1740,7 +1740,6 @@ public abstract class EntityLiving extends Entity {
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
public void m() {
2016-01-09 06:32:38 +00:00
- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
super.m();
2016-06-09 03:57:14 +00:00
this.cz();
2016-01-09 06:32:38 +00:00
if (!this.world.isClientSide) {
2016-06-09 03:57:14 +00:00
@@ -1813,9 +1812,7 @@ public abstract class EntityLiving extends Entity {
2016-01-09 06:32:38 +00:00
}
}
- SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
2016-02-29 23:09:49 +00:00
this.n();
2016-01-09 06:32:38 +00:00
- SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
2016-06-09 03:57:14 +00:00
@@ -1884,8 +1881,6 @@ public abstract class EntityLiving extends Entity {
2016-02-29 23:09:49 +00:00
} else {
2016-06-09 03:57:14 +00:00
this.bq = 0;
2016-02-29 23:09:49 +00:00
}
-
2016-01-09 06:32:38 +00:00
- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
}
protected float h(float f, float f1) {
2016-06-09 03:57:14 +00:00
@@ -1950,7 +1945,6 @@ public abstract class EntityLiving extends Entity {
2016-01-09 06:32:38 +00:00
}
this.world.methodProfiler.a("ai");
- SpigotTimings.timerEntityAI.startTiming(); // Spigot
2016-06-09 03:57:14 +00:00
if (this.cj()) {
this.be = false;
this.bf = 0.0F;
@@ -1961,7 +1955,6 @@ public abstract class EntityLiving extends Entity {
2016-01-09 06:32:38 +00:00
this.doTick();
this.world.methodProfiler.b();
}
- SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
2016-06-09 03:57:14 +00:00
@@ -1984,14 +1977,10 @@ public abstract class EntityLiving extends Entity {
this.bg *= 0.98F;
this.bh *= 0.9F;
2016-02-29 23:09:49 +00:00
this.r();
2016-01-09 06:32:38 +00:00
- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
2016-06-09 03:57:14 +00:00
this.g(this.bf, this.bg);
2016-01-09 06:32:38 +00:00
- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
2016-02-29 23:09:49 +00:00
- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
2016-06-09 03:57:14 +00:00
this.cs();
2016-02-29 23:09:49 +00:00
- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
2016-01-09 06:32:38 +00:00
this.world.methodProfiler.b();
2016-02-29 23:09:49 +00:00
}
2016-04-30 01:23:40 +00:00
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
2016-06-09 03:57:14 +00:00
index 5432e70..72cd51a 100644
2016-04-30 01:23:40 +00:00
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
2016-05-12 02:07:46 +00:00
@@ -171,7 +171,7 @@ public class EntityTracker {
2016-04-30 01:23:40 +00:00
public void updatePlayers() {
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.c.iterator();
-
+ world.timings.tracker1.startTiming(); // Spigot
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
2016-05-12 02:07:46 +00:00
@@ -184,7 +184,9 @@ public class EntityTracker {
2016-04-30 01:23:40 +00:00
}
}
}
+ world.timings.tracker1.stopTiming(); // Spigot
+ world.timings.tracker2.startTiming(); // Spigot
for (int i = 0; i < arraylist.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i);
Iterator iterator1 = this.c.iterator();
2016-05-12 02:07:46 +00:00
@@ -197,6 +199,7 @@ public class EntityTracker {
2016-04-30 01:23:40 +00:00
}
}
}
+ world.timings.tracker2.stopTiming(); // Spigot
}
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
2016-07-15 22:36:53 +00:00
index 3d76e54..0024d3d 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2016-07-15 22:36:53 +00:00
@@ -45,7 +45,7 @@ import org.bukkit.Bukkit;
2016-05-12 02:07:46 +00:00
import org.bukkit.craftbukkit.CraftServer;
2016-07-15 22:36:53 +00:00
import org.bukkit.craftbukkit.Main;
2016-01-09 06:32:38 +00:00
// CraftBukkit end
2016-02-29 23:09:49 +00:00
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-01-09 06:32:38 +00:00
public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics {
2016-02-29 23:09:49 +00:00
2016-07-15 22:36:53 +00:00
@@ -450,6 +450,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-02-29 23:09:49 +00:00
}
2016-01-09 06:32:38 +00:00
// CraftBukkit end
2016-02-29 23:09:49 +00:00
MinecraftServer.LOGGER.info("Stopping server");
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.stopServer(); // Paper
2016-03-03 09:46:26 +00:00
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
2016-07-15 22:36:53 +00:00
@@ -654,7 +655,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-06-09 03:57:14 +00:00
public void B() {}
2016-01-09 06:32:38 +00:00
2016-02-29 23:09:49 +00:00
protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws
2016-01-09 06:32:38 +00:00
- SpigotTimings.serverTickTimer.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
long i = System.nanoTime();
++this.ticks;
2016-07-15 22:36:53 +00:00
@@ -681,7 +682,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
}
if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot
+ MinecraftTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save");
this.v.savePlayers();
// Spigot Start
2016-07-15 22:36:53 +00:00
@@ -696,7 +697,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
// this.saveChunks(true);
// Spigot End
this.methodProfiler.b();
- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
+ MinecraftTimings.worldSaveTimer.stopTiming(); // Spigot
}
this.methodProfiler.a("tallying");
2016-07-15 22:36:53 +00:00
@@ -713,15 +714,16 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
2016-01-09 06:32:38 +00:00
this.methodProfiler.b();
this.methodProfiler.b();
2016-04-30 01:23:40 +00:00
+
2016-01-09 06:32:38 +00:00
org.spigotmc.WatchdogThread.tick(); // Spigot
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot
- org.spigotmc.CustomTimingsHandler.tick(); // Spigot
2016-02-29 23:09:49 +00:00
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
public void D() {
2016-06-30 05:38:53 +00:00
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Paper
this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Paper
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.minecraftSchedulerTimer.startTiming(); // Paper
2016-02-24 04:35:34 +00:00
this.methodProfiler.a("jobs");
Queue queue = this.j;
2016-07-15 22:36:53 +00:00
@@ -732,22 +734,23 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-02-24 04:35:34 +00:00
SystemUtils.a(entry, MinecraftServer.LOGGER);
}
// Spigot end
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.minecraftSchedulerTimer.stopTiming(); // Paper
2016-02-24 04:35:34 +00:00
this.methodProfiler.c("levels");
// CraftBukkit start
// Run tasks that are waiting on processing
2016-04-30 01:23:40 +00:00
- SpigotTimings.processQueueTimer.startTiming(); // Spigot
+ MinecraftTimings.processQueueTimer.startTiming(); // Spigot
while (!processQueue.isEmpty()) {
processQueue.remove().run();
}
- SpigotTimings.processQueueTimer.stopTiming(); // Spigot
+ MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
- SpigotTimings.chunkIOTickTimer.startTiming(); // Spigot
+ MinecraftTimings.chunkIOTickTimer.startTiming(); // Spigot
org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick();
- SpigotTimings.chunkIOTickTimer.stopTiming(); // Spigot
+ MinecraftTimings.chunkIOTickTimer.stopTiming(); // Spigot
- SpigotTimings.timeUpdateTimer.startTiming(); // Spigot
+ MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
2016-07-15 22:36:53 +00:00
@@ -755,7 +758,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
}
}
- SpigotTimings.timeUpdateTimer.stopTiming(); // Spigot
+ MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot
int i;
2016-07-15 22:36:53 +00:00
@@ -812,9 +815,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
this.methodProfiler.b();
this.methodProfiler.a("tracker");
- worldserver.timings.tracker.startTiming(); // Spigot
worldserver.getTracker().updatePlayers();
- worldserver.timings.tracker.stopTiming(); // Spigot
this.methodProfiler.b();
this.methodProfiler.b();
// } // CraftBukkit
2016-07-15 22:36:53 +00:00
@@ -823,20 +824,20 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
2016-04-30 01:23:40 +00:00
}
this.methodProfiler.c("connection");
- SpigotTimings.connectionTimer.startTiming(); // Spigot
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot
this.am().c();
- SpigotTimings.connectionTimer.stopTiming(); // Spigot
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot
this.methodProfiler.c("players");
- SpigotTimings.playerListTimer.startTiming(); // Spigot
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot
this.v.tick();
- SpigotTimings.playerListTimer.stopTiming(); // Spigot
+ MinecraftTimings.playerListTimer.stopTiming(); // Spigot
this.methodProfiler.c("tickables");
- SpigotTimings.tickablesTimer.startTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.startTiming(); // Spigot
for (i = 0; i < this.o.size(); ++i) {
2016-06-09 03:57:14 +00:00
((ITickable) this.o.get(i)).E_();
2016-04-30 01:23:40 +00:00
}
- SpigotTimings.tickablesTimer.stopTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot
this.methodProfiler.b();
}
2016-06-05 04:10:50 +00:00
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index b0249ff..797a84f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import co.aikar.timings.Timing;
import com.google.common.base.Predicate;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ComparisonChain;
@@ -106,6 +107,7 @@ public class PlayerChunkMap {
PlayerChunk playerchunk;
if (i - this.k > 8000L) {
+ try (Timing ignored = world.timings.doChunkMapUpdate.startTiming()) { // Paper
this.k = i;
for (j = 0; j < this.i.size(); ++j) {
@@ -113,9 +115,11 @@ public class PlayerChunkMap {
playerchunk.d();
playerchunk.c();
}
+ } // Paper timing
}
if (!this.f.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapToUpdate.startTiming()) { // Paper
Iterator iterator = this.f.iterator();
while (iterator.hasNext()) {
@@ -124,10 +128,12 @@ public class PlayerChunkMap {
}
this.f.clear();
+ } // Paper timing
}
if (this.l && i % 4L == 0L) {
this.l = false;
+ try (Timing ignored = world.timings.doChunkMapSortMissing.startTiming()) { // Paper
Collections.sort(this.h, new Comparator() {
public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) {
return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result();
@@ -137,10 +143,12 @@ public class PlayerChunkMap {
return this.a((PlayerChunk) object, (PlayerChunk) object1);
}
});
+ } // Paper timing
}
if (this.m && i % 4L == 2L) {
this.m = false;
+ try (Timing ignored = world.timings.doChunkMapSortSendToPlayers.startTiming()) { // Paper
Collections.sort(this.g, new Comparator() {
public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) {
return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result();
@@ -150,9 +158,11 @@ public class PlayerChunkMap {
return this.a((PlayerChunk) object, (PlayerChunk) object1);
}
});
+ } // Paper timing
}
if (!this.h.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapPlayersNeedingChunks.startTiming()) { // Paper
long k = System.nanoTime() + 50000000L;
int l = 49;
Iterator iterator1 = this.h.iterator();
@@ -176,10 +186,12 @@ public class PlayerChunkMap {
}
}
}
+ } // Paper timing
}
if (!this.g.isEmpty()) {
j = 81;
+ try (Timing ignored = world.timings.doChunkMapPendingSendToPlayers.startTiming()) { // Paper
Iterator iterator2 = this.g.iterator();
while (iterator2.hasNext()) {
@@ -193,14 +205,17 @@ public class PlayerChunkMap {
}
}
}
+ } // Paper timing
}
if (this.managedPlayers.isEmpty()) {
+ try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper
WorldProvider worldprovider = this.world.worldProvider;
if (!worldprovider.e()) {
this.world.getChunkProviderServer().b();
}
+ } // Paper timing
}
}
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
2016-06-30 05:23:30 +00:00
index d5dd29b..13a6cfe 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2016-05-12 02:07:46 +00:00
@@ -57,6 +57,7 @@ import org.bukkit.inventory.CraftingInventory;
2016-03-04 21:20:13 +00:00
import org.bukkit.inventory.EquipmentSlot;
2016-01-09 06:32:38 +00:00
import org.bukkit.inventory.InventoryView;
import org.bukkit.util.NumberConversions;
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-01-09 06:32:38 +00:00
// CraftBukkit end
2016-02-29 23:09:49 +00:00
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2016-06-15 22:43:51 +00:00
@@ -1332,7 +1333,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2016-01-09 06:32:38 +00:00
// CraftBukkit end
private void handleCommand(String s) {
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.playerCommandTimer.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
// CraftBukkit start - whole method
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
2016-02-29 23:09:49 +00:00
this.LOGGER.info(this.player.getName() + " issued server command: " + s);
2016-06-15 22:43:51 +00:00
@@ -1343,22 +1344,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2016-01-09 06:32:38 +00:00
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
return;
}
try {
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
return;
}
} catch (org.bukkit.command.CommandException ex) {
player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
return;
}
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
2016-04-30 01:23:40 +00:00
+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
// this.minecraftServer.getCommandHandler().a(this.player, s);
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
2016-06-09 03:57:14 +00:00
index 42f37df..2b82312 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
2016-05-12 02:07:46 +00:00
@@ -6,12 +6,13 @@ import javax.annotation.Nullable;
2016-01-09 06:32:38 +00:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.spigotmc.CustomTimingsHandler; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-02-29 23:09:49 +00:00
+import co.aikar.timings.Timing; // Paper
2016-01-09 06:32:38 +00:00
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public abstract class TileEntity {
- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
2016-04-30 01:23:40 +00:00
+ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
2016-01-09 06:32:38 +00:00
private static final Logger a = LogManager.getLogger();
2016-06-09 03:57:14 +00:00
private static final Map<String, Class<? extends TileEntity>> f = Maps.newHashMap();
private static final Map<Class<? extends TileEntity>, String> g = Maps.newHashMap();
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
2016-06-25 17:19:04 +00:00
index e649435..b73f64e 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2016-02-29 23:09:49 +00:00
@@ -18,11 +18,11 @@ import com.google.common.collect.Maps;
import java.util.Map;
import org.bukkit.Bukkit;
2016-01-09 06:32:38 +00:00
import org.bukkit.block.BlockState;
2016-02-29 23:09:49 +00:00
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
2016-01-09 06:32:38 +00:00
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
2016-02-29 23:09:49 +00:00
+import org.bukkit.craftbukkit.util.LongHashSet; // Paper
2016-01-09 06:32:38 +00:00
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
2016-03-25 04:59:37 +00:00
@@ -127,7 +127,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
2016-02-29 23:09:49 +00:00
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
2016-01-09 06:32:38 +00:00
- public final SpigotTimings.WorldTimingsHandler timings; // Spigot
2016-02-29 23:09:49 +00:00
+ public final co.aikar.timings.WorldTimingsHandler timings; // Paper
private boolean guardEntityList; // Spigot
public static boolean haveWeSilencedAPhysicsCrash;
public static String blockLocation;
2016-03-25 04:59:37 +00:00
@@ -197,7 +197,7 @@ public abstract class World implements IBlockAccess {
});
2016-03-03 09:46:26 +00:00
this.getServer().addWorld(this.world);
// CraftBukkit end
2016-02-29 23:09:49 +00:00
- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
2016-01-09 06:32:38 +00:00
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
}
2016-06-09 03:57:14 +00:00
@@ -1379,6 +1379,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
}
this.methodProfiler.c("remove");
2016-02-29 23:09:49 +00:00
+ timings.entityRemoval.startTiming(); // Paper
this.entityList.removeAll(this.f);
2016-01-09 06:32:38 +00:00
int j;
2016-06-09 03:57:14 +00:00
@@ -1399,6 +1400,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
2016-02-29 23:09:49 +00:00
this.f.clear();
this.l();
+ timings.entityRemoval.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.c("regular");
2016-02-29 23:09:49 +00:00
CrashReportSystemDetails crashreportsystemdetails1;
2016-06-09 03:57:14 +00:00
@@ -1408,6 +1410,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
timings.entityTick.startTiming(); // Spigot
guardEntityList = true; // Spigot
// CraftBukkit start - Use field for loop variable
2016-02-29 23:09:49 +00:00
+ co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper
2016-01-09 06:32:38 +00:00
int entitiesThisCycle = 0;
2016-03-25 04:59:37 +00:00
if (tickPosition < 0) tickPosition = 0;
for (entityLimiter.initTick();
2016-06-09 03:57:14 +00:00
@@ -1429,10 +1432,11 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
this.methodProfiler.a("tick");
2016-02-29 23:09:49 +00:00
if (!entity.dead && !(entity instanceof EntityPlayer)) {
2016-01-09 06:32:38 +00:00
try {
- SpigotTimings.tickEntityTimer.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ entity.tickTimer.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.g(entity);
- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ entity.tickTimer.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
} catch (Throwable throwable1) {
+ entity.tickTimer.stopTiming();
2016-03-25 04:59:37 +00:00
crashreport1 = CrashReport.a(throwable1, "Ticking entity");
crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
entity.appendEntityCrashDetails(crashreportsystemdetails1);
2016-06-15 22:43:51 +00:00
@@ -1565,6 +1569,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
}
timings.tileEntityPending.stopTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.b();
this.methodProfiler.b();
}
2016-06-25 17:19:04 +00:00
@@ -1617,7 +1622,6 @@ public abstract class World implements IBlockAccess {
2016-02-29 23:09:49 +00:00
entity.ticksLived++;
entity.inactiveTick();
2016-01-09 06:32:38 +00:00
} else {
- entity.tickTimer.startTiming(); // Spigot
// CraftBukkit end
2016-02-29 23:09:49 +00:00
entity.M = entity.locX;
entity.N = entity.locY;
2016-06-25 17:19:04 +00:00
@@ -1626,6 +1630,7 @@ public abstract class World implements IBlockAccess {
2016-01-09 06:32:38 +00:00
entity.lastPitch = entity.pitch;
2016-06-09 03:57:14 +00:00
if (flag && entity.ab) {
2016-01-09 06:32:38 +00:00
++entity.ticksLived;
2016-02-29 23:09:49 +00:00
+ ++co.aikar.timings.TimingHistory.activatedEntityTicks; // Paper
if (entity.isPassenger()) {
entity.aw();
2016-01-09 06:32:38 +00:00
} else {
2016-06-25 17:19:04 +00:00
@@ -1684,8 +1689,6 @@ public abstract class World implements IBlockAccess {
2016-02-29 23:09:49 +00:00
}
2016-01-09 06:32:38 +00:00
}
}
2016-02-29 23:09:49 +00:00
-
2016-01-09 06:32:38 +00:00
- entity.tickTimer.stopTiming(); // Spigot
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
2016-07-15 22:36:53 +00:00
index 0668887..e0f448d 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2016-05-12 02:07:46 +00:00
@@ -245,13 +245,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-01-09 06:32:38 +00:00
timings.doChunkUnload.stopTiming(); // Spigot
this.methodProfiler.c("tickPending");
- timings.doTickPending.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocks.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.a(false);
- timings.doTickPending.stopTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocks.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.c("tickBlocks");
- timings.doTickTiles.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ timings.chunkTicks.startTiming(); // Paper
this.j();
2016-01-09 06:32:38 +00:00
- timings.doTickTiles.stopTiming(); // Spigot
2016-02-29 23:09:49 +00:00
+ timings.chunkTicks.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.c("chunkMap");
timings.doChunkMap.startTiming(); // Spigot
2016-02-29 23:09:49 +00:00
this.manager.flush();
2016-05-12 02:07:46 +00:00
@@ -483,7 +483,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-02-29 23:09:49 +00:00
}
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
- this.methodProfiler.c("tickBlocks");
+ timings.chunkTicksBlocks.startTiming(); // Paper
if (i > 0) {
2016-01-09 06:32:38 +00:00
ChunkSection[] achunksection = chunk.getSections();
2016-02-29 23:09:49 +00:00
int i1 = achunksection.length;
2016-05-12 02:07:46 +00:00
@@ -511,6 +511,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-01-09 06:32:38 +00:00
}
}
}
2016-02-29 23:09:49 +00:00
+ timings.chunkTicksBlocks.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
this.methodProfiler.b();
2016-05-12 02:07:46 +00:00
@@ -706,6 +707,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-01-09 06:32:38 +00:00
this.methodProfiler.a("cleaning");
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocksCleanup.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
NextTickListEntry nextticklistentry;
for (int j = 0; j < i; ++j) {
2016-05-12 02:07:46 +00:00
@@ -719,9 +721,11 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-02-29 23:09:49 +00:00
// this.nextTickListHash.remove(nextticklistentry);
this.U.add(nextticklistentry);
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocksCleanup.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.b();
this.methodProfiler.a("ticking");
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocksTicking.startTiming(); // Paper
Iterator iterator = this.U.iterator();
2016-01-09 06:32:38 +00:00
while (iterator.hasNext()) {
2016-05-12 02:07:46 +00:00
@@ -731,6 +735,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-01-09 06:32:38 +00:00
2016-06-09 03:57:14 +00:00
if (this.areChunksLoadedBetween(nextticklistentry.a.a(0, 0, 0), nextticklistentry.a.a(0, 0, 0))) {
2016-01-09 06:32:38 +00:00
IBlockData iblockdata = this.getType(nextticklistentry.a);
2016-02-29 23:09:49 +00:00
+ co.aikar.timings.Timing timing = iblockdata.getBlock().getTiming(); // Paper
+ timing.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
2016-02-29 23:09:49 +00:00
if (iblockdata.getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) {
2016-01-09 06:32:38 +00:00
try {
2016-05-12 02:07:46 +00:00
@@ -743,10 +749,12 @@ public class WorldServer extends World implements IAsyncTaskHandler {
2016-01-09 06:32:38 +00:00
throw new ReportedException(crashreport);
}
}
2016-02-29 23:09:49 +00:00
+ timing.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
} else {
this.a(nextticklistentry.a, nextticklistentry.a(), 0);
}
}
2016-02-29 23:09:49 +00:00
+ timings.scheduledBlocksTicking.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
this.methodProfiler.b();
2016-02-29 23:09:49 +00:00
this.U.clear();
2016-01-09 06:32:38 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2016-06-30 05:23:30 +00:00
index 1ef30a3..c880d85 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2016-05-20 22:32:50 +00:00
@@ -1726,6 +1726,7 @@ public final class CraftServer implements Server {
2016-02-29 23:09:49 +00:00
private final Spigot spigot = new Spigot()
{
2016-01-09 06:32:38 +00:00
+ @Deprecated
@Override
public YamlConfiguration getConfig()
{
2016-05-20 22:32:50 +00:00
@@ -1733,6 +1734,24 @@ public final class CraftServer implements Server {
2016-02-29 23:09:49 +00:00
}
@Override
2016-01-09 06:32:38 +00:00
+ public YamlConfiguration getBukkitConfig()
+ {
+ return configuration;
+ }
+
+ @Override
+ public YamlConfiguration getSpigotConfig()
+ {
2016-02-29 23:09:49 +00:00
+ return org.spigotmc.SpigotConfig.config;
+ }
+
+ @Override
+ public YamlConfiguration getPaperConfig()
2016-01-09 06:32:38 +00:00
+ {
2016-02-29 23:09:49 +00:00
+ return com.destroystokyo.paper.PaperConfig.config;
2016-01-09 06:32:38 +00:00
+ }
+
+ @Override
public void restart() {
org.spigotmc.RestartCommand.restart();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 41d2d87..0000000
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.bukkit.craftbukkit;
-
-import com.google.common.collect.Maps;
-import net.minecraft.server.*;
-import org.bukkit.plugin.java.JavaPluginLoader;
-import org.spigotmc.CustomTimingsHandler;
-import org.bukkit.scheduler.BukkitTask;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.bukkit.craftbukkit.scheduler.CraftTask;
-
-public class SpigotTimings {
-
- public static final CustomTimingsHandler serverTickTimer = new CustomTimingsHandler("** Full Server Tick");
- public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List");
- public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Connection Handler");
- public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables");
- public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler");
- public static final CustomTimingsHandler chunkIOTickTimer = new CustomTimingsHandler("ChunkIOTick");
- public static final CustomTimingsHandler timeUpdateTimer = new CustomTimingsHandler("Time Update");
- public static final CustomTimingsHandler serverCommandTimer = new CustomTimingsHandler("Server Command");
- public static final CustomTimingsHandler worldSaveTimer = new CustomTimingsHandler("World Save");
-
- public static final CustomTimingsHandler entityMoveTimer = new CustomTimingsHandler("** entityMove");
- public static final CustomTimingsHandler tickEntityTimer = new CustomTimingsHandler("** tickEntity");
- public static final CustomTimingsHandler activatedEntityTimer = new CustomTimingsHandler("** activatedTickEntity");
- public static final CustomTimingsHandler tickTileEntityTimer = new CustomTimingsHandler("** tickTileEntity");
-
- public static final CustomTimingsHandler timerEntityBaseTick = new CustomTimingsHandler("** livingEntityBaseTick");
- public static final CustomTimingsHandler timerEntityAI = new CustomTimingsHandler("** livingEntityAI");
- public static final CustomTimingsHandler timerEntityAICollision = new CustomTimingsHandler("** livingEntityAICollision");
- public static final CustomTimingsHandler timerEntityAIMove = new CustomTimingsHandler("** livingEntityAIMove");
- public static final CustomTimingsHandler timerEntityTickRest = new CustomTimingsHandler("** livingEntityTickRest");
-
- public static final CustomTimingsHandler processQueueTimer = new CustomTimingsHandler("processQueue");
- public static final CustomTimingsHandler schedulerSyncTimer = new CustomTimingsHandler("** Scheduler - Sync Tasks", JavaPluginLoader.pluginParentTimer);
-
- public static final CustomTimingsHandler playerCommandTimer = new CustomTimingsHandler("** playerCommand");
-
- public static final CustomTimingsHandler entityActivationCheckTimer = new CustomTimingsHandler("entityActivationCheck");
- public static final CustomTimingsHandler checkIfActiveTimer = new CustomTimingsHandler("** checkIfActive");
-
- public static final HashMap<String, CustomTimingsHandler> entityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
- public static final HashMap<String, CustomTimingsHandler> tileEntityTypeTimingMap = new HashMap<String, CustomTimingsHandler>();
- public static final HashMap<String, CustomTimingsHandler> pluginTaskTimingMap = new HashMap<String, CustomTimingsHandler>();
-
- /**
- * Gets a timer associated with a plugins tasks.
- * @param task
- * @param period
- * @return
- */
- public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) {
- if (!task.isSync()) {
- return null;
- }
- String plugin;
- final CraftTask ctask = (CraftTask) task;
-
- if (task.getOwner() != null) {
- plugin = task.getOwner().getDescription().getFullName();
- } else if (ctask.timingName != null) {
- plugin = "CraftScheduler";
- } else {
- plugin = "Unknown";
- }
- String taskname = ctask.getTaskName();
-
- String name = "Task: " + plugin + " Runnable: " + taskname;
- if (period > 0) {
- name += "(interval:" + period +")";
- } else {
- name += "(Single)";
- }
- CustomTimingsHandler result = pluginTaskTimingMap.get(name);
- if (result == null) {
- result = new CustomTimingsHandler(name, SpigotTimings.schedulerSyncTimer);
- pluginTaskTimingMap.put(name, result);
- }
- return result;
- }
-
- /**
- * Get a named timer for the specified entity type to track type specific timings.
- * @param entity
- * @return
- */
- public static CustomTimingsHandler getEntityTimings(Entity entity) {
- String entityType = entity.getClass().getSimpleName();
- CustomTimingsHandler result = entityTypeTimingMap.get(entityType);
- if (result == null) {
- result = new CustomTimingsHandler("** tickEntity - " + entityType, activatedEntityTimer);
- entityTypeTimingMap.put(entityType, result);
- }
- return result;
- }
-
- /**
- * Get a named timer for the specified tile entity type to track type specific timings.
- * @param entity
- * @return
- */
- public static CustomTimingsHandler getTileEntityTimings(TileEntity entity) {
- String entityType = entity.getClass().getSimpleName();
- CustomTimingsHandler result = tileEntityTypeTimingMap.get(entityType);
- if (result == null) {
- result = new CustomTimingsHandler("** tickTileEntity - " + entityType, tickTileEntityTimer);
- tileEntityTypeTimingMap.put(entityType, result);
- }
- return result;
- }
-
- /**
- * Set of timers per world, to track world specific timings.
- */
- public static class WorldTimingsHandler {
- public final CustomTimingsHandler mobSpawn;
- public final CustomTimingsHandler doChunkUnload;
- public final CustomTimingsHandler doPortalForcer;
- public final CustomTimingsHandler doTickPending;
- public final CustomTimingsHandler doTickTiles;
- public final CustomTimingsHandler doVillages;
- public final CustomTimingsHandler doChunkMap;
- public final CustomTimingsHandler doChunkGC;
- public final CustomTimingsHandler doSounds;
- public final CustomTimingsHandler entityTick;
- public final CustomTimingsHandler tileEntityTick;
- public final CustomTimingsHandler tileEntityPending;
- public final CustomTimingsHandler tracker;
- public final CustomTimingsHandler doTick;
- public final CustomTimingsHandler tickEntities;
-
- public final CustomTimingsHandler syncChunkLoadTimer;
- public final CustomTimingsHandler syncChunkLoadDataTimer;
- public final CustomTimingsHandler syncChunkLoadStructuresTimer;
- public final CustomTimingsHandler syncChunkLoadEntitiesTimer;
- public final CustomTimingsHandler syncChunkLoadTileEntitiesTimer;
- public final CustomTimingsHandler syncChunkLoadTileTicksTimer;
- public final CustomTimingsHandler syncChunkLoadPostTimer;
-
- public WorldTimingsHandler(World server) {
- String name = server.worldData.getName() +" - ";
-
- mobSpawn = new CustomTimingsHandler("** " + name + "mobSpawn");
- doChunkUnload = new CustomTimingsHandler("** " + name + "doChunkUnload");
- doTickPending = new CustomTimingsHandler("** " + name + "doTickPending");
- doTickTiles = new CustomTimingsHandler("** " + name + "doTickTiles");
- doVillages = new CustomTimingsHandler("** " + name + "doVillages");
- doChunkMap = new CustomTimingsHandler("** " + name + "doChunkMap");
- doSounds = new CustomTimingsHandler("** " + name + "doSounds");
- doChunkGC = new CustomTimingsHandler("** " + name + "doChunkGC");
- doPortalForcer = new CustomTimingsHandler("** " + name + "doPortalForcer");
- entityTick = new CustomTimingsHandler("** " + name + "entityTick");
- tileEntityTick = new CustomTimingsHandler("** " + name + "tileEntityTick");
- tileEntityPending = new CustomTimingsHandler("** " + name + "tileEntityPending");
-
- syncChunkLoadTimer = new CustomTimingsHandler("** " + name + "syncChunkLoad");
- syncChunkLoadDataTimer = new CustomTimingsHandler("** " + name + "syncChunkLoad - Data");
- syncChunkLoadStructuresTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Structures");
- syncChunkLoadEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Entities");
- syncChunkLoadTileEntitiesTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileEntities");
- syncChunkLoadTileTicksTimer = new CustomTimingsHandler("** " + name + "chunkLoad - TileTicks");
- syncChunkLoadPostTimer = new CustomTimingsHandler("** " + name + "chunkLoad - Post");
-
-
- tracker = new CustomTimingsHandler(name + "tracker");
- doTick = new CustomTimingsHandler(name + "doTick");
- tickEntities = new CustomTimingsHandler(name + "tickEntities");
- }
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2016-07-04 23:49:14 +00:00
index d61065c..d6cf997 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2016-02-29 23:09:49 +00:00
@@ -37,15 +37,9 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
-import org.bukkit.craftbukkit.CraftParticle;
+import org.bukkit.craftbukkit.*;
import org.bukkit.craftbukkit.block.CraftSign;
import org.bukkit.craftbukkit.conversations.ConversationTracker;
-import org.bukkit.craftbukkit.CraftEffect;
-import org.bukkit.craftbukkit.CraftOfflinePlayer;
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.CraftSound;
-import org.bukkit.craftbukkit.CraftStatistic;
-import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.craftbukkit.map.RenderData;
import org.bukkit.craftbukkit.scoreboard.CraftScoreboard;
2016-07-04 23:49:14 +00:00
@@ -1564,6 +1558,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2016-02-29 23:09:49 +00:00
packet.components = components;
getHandle().playerConnection.sendPacket(packet);
2016-01-09 06:32:38 +00:00
}
+
+ @Override
+ public int getPing()
+ {
+ return getHandle().ping;
+ }
};
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
2016-04-30 01:23:40 +00:00
index 93d8d42..2a22697 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -186,7 +186,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
return false;
- }});
2016-04-30 01:23:40 +00:00
+ }}){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}; // Paper
2016-01-09 06:32:38 +00:00
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -219,7 +219,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
}
- });
2016-04-30 01:23:40 +00:00
+ }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer(plugin);}}; // Paper
2016-01-09 06:32:38 +00:00
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -251,7 +251,7 @@ public class CraftScheduler implements BukkitScheduler {
CraftScheduler.this.pending.clear();
CraftScheduler.this.temp.clear();
}
- });
2016-04-30 01:23:40 +00:00
+ }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}; // Paper
2016-01-09 06:32:38 +00:00
handle(task, 0l);
for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -346,9 +346,7 @@ public class CraftScheduler implements BukkitScheduler {
}
if (task.isSync()) {
try {
- task.timings.startTiming(); // Spigot
task.run();
- task.timings.stopTiming(); // Spigot
} catch (final Throwable throwable) {
task.getOwner().getLogger().log(
Level.WARNING,
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
2016-04-30 01:23:40 +00:00
index 220e39a..afc6c17 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,8 +1,8 @@
package org.bukkit.craftbukkit.scheduler;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
-import org.spigotmc.CustomTimingsHandler; // Spigot
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings; // Paper
2016-02-29 23:09:49 +00:00
+import co.aikar.timings.Timing; // Paper
2016-01-09 06:32:38 +00:00
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
@@ -20,11 +20,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
*/
private volatile long period;
private long nextRun;
- private final Runnable task;
2016-02-29 23:09:49 +00:00
+ public final Runnable task; // Paper
+ public Timing timings; // Paper
2016-01-09 06:32:38 +00:00
private final Plugin plugin;
private final int id;
- final CustomTimingsHandler timings; // Spigot
CraftTask() {
this(null, null, -1, -1);
}
2016-02-29 23:09:49 +00:00
@@ -33,26 +33,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
this(null, task, -1, -1);
2016-01-09 06:32:38 +00:00
}
2016-02-29 23:09:49 +00:00
- // Spigot start
2016-01-09 06:32:38 +00:00
- public String timingName = null;
- CraftTask(String timingName) {
- this(timingName, null, null, -1, -1);
- }
- CraftTask(String timingName, final Runnable task) {
- this(timingName, null, task, -1, -1);
- }
- CraftTask(String timingName, final Plugin plugin, final Runnable task, final int id, final long period) {
2016-02-29 23:09:49 +00:00
+ CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) { // Paper
2016-01-09 06:32:38 +00:00
this.plugin = plugin;
this.task = task;
this.id = id;
this.period = period;
- this.timingName = timingName == null && task == null ? "Unknown" : timingName;
- timings = this.isSync() ? SpigotTimings.getPluginTaskTimings(this, period) : null;
- }
-
- CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) {
- this(null, plugin, task, id, period);
- // Spigot end
2016-04-30 01:23:40 +00:00
+ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : null; // Paper
2016-01-09 06:32:38 +00:00
}
public final int getTaskId() {
2016-02-29 23:09:49 +00:00
@@ -68,7 +54,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
2016-01-09 06:32:38 +00:00
}
public void run() {
2016-02-29 23:09:49 +00:00
+ if (timings != null && isSync()) timings.startTiming(); // Paper
2016-01-09 06:32:38 +00:00
task.run();
2016-02-29 23:09:49 +00:00
+ if (timings != null && isSync()) timings.stopTiming(); // Paper
2016-01-09 06:32:38 +00:00
}
long getPeriod() {
2016-02-29 23:09:49 +00:00
@@ -112,13 +100,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
setPeriod(-2l);
2016-01-09 06:32:38 +00:00
return true;
}
2016-02-29 23:09:49 +00:00
-
2016-01-09 06:32:38 +00:00
- // Spigot start
- public String getTaskName() {
- if (timingName != null) {
- return timingName;
- }
- return task.getClass().getName();
- }
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
2016-02-29 23:09:49 +00:00
index e52ef47..3d90b34 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon;
public class CraftIconCache implements CachedServerIcon {
public final String value;
2016-02-29 23:09:49 +00:00
+ public String getData() { return value; } // Paper
2016-01-09 06:32:38 +00:00
public CraftIconCache(final String value) {
this.value = value;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
2016-06-09 03:57:14 +00:00
index 30efc99..eb30abe 100644
2016-01-09 06:32:38 +00:00
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
2016-03-25 04:59:37 +00:00
@@ -29,7 +29,7 @@ import net.minecraft.server.EntityWither;
import net.minecraft.server.MathHelper;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.World;
2016-01-09 06:32:38 +00:00
-import org.bukkit.craftbukkit.SpigotTimings;
2016-04-30 01:23:40 +00:00
+import co.aikar.timings.MinecraftTimings;
2016-01-09 06:32:38 +00:00
public class ActivationRange
{
2016-04-30 01:23:40 +00:00
@@ -63,8 +63,8 @@ public class ActivationRange
/**
* These entities are excluded from Activation range checks.
*
- * @param entity
- * @param world
+ * @param entity Entity to initialize
+ * @param config Spigot config to determine ranges
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
@@ -97,7 +97,7 @@ public class ActivationRange
*/
public static void activateEntities(World world)
{
- SpigotTimings.entityActivationCheckTimer.startTiming();
+ MinecraftTimings.entityActivationCheckTimer.startTiming();
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
@@ -131,7 +131,7 @@ public class ActivationRange
}
}
}
- SpigotTimings.entityActivationCheckTimer.stopTiming();
+ MinecraftTimings.entityActivationCheckTimer.stopTiming();
}
/**
2016-03-25 04:59:37 +00:00
@@ -245,11 +245,9 @@ public class ActivationRange
2016-03-18 21:11:53 +00:00
*/
public static boolean checkIfActive(Entity entity)
{
- SpigotTimings.checkIfActiveTimer.startTiming();
// Never safe to skip fireworks or entities not yet added to chunk
// PAIL: inChunk
2016-06-09 03:57:14 +00:00
if ( !entity.ab || entity instanceof EntityFireworks ) {
2016-03-18 21:11:53 +00:00
- SpigotTimings.checkIfActiveTimer.stopTiming();
return true;
}
2016-03-25 04:59:37 +00:00
@@ -281,7 +279,6 @@ public class ActivationRange
2016-03-18 21:11:53 +00:00
{
isActive = false;
}
- SpigotTimings.checkIfActiveTimer.stopTiming();
return isActive;
}
}
2016-01-09 06:32:38 +00:00
--
2016-07-04 23:49:14 +00:00
2.9.0.windows.1
2016-01-09 06:32:38 +00:00