Do not include task id in timings handler name

Plugins that spam use repeating task timers are filling up the CustomTimingHandler list, which can degrade performance over time
Considering Essentials does this, and many servers use Essentials... def need to stop this.
This commit is contained in:
Aikar 2013-02-27 00:39:53 -05:00 committed by md_5
parent 44927fdaa6
commit b5230a3857
2 changed files with 14 additions and 14 deletions

View file

@ -1,4 +1,4 @@
From 7d318ee4bf7783ec9bca927195e5ee11d4490964 Mon Sep 17 00:00:00 2001 From 9808bdb02bc1e375a8f809a3b8b553104b242daa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 10 Jan 2013 00:18:11 -0500 Date: Thu, 10 Jan 2013 00:18:11 -0500
Subject: [PATCH] Improved Timings System Subject: [PATCH] Improved Timings System
@ -407,7 +407,7 @@ index 4aa2a19..6cb3e24 100644
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
new file mode 100644 new file mode 100644
index 0000000..df837a3 index 0000000..dec3110
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
@@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
@ -455,18 +455,18 @@ index 0000000..df837a3
+ */ + */
+ public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) { + public static CustomTimingsHandler getPluginTaskTimings(BukkitTask task, long period) {
+ String plugin = task.getOwner().getDescription().getFullName(); + String plugin = task.getOwner().getDescription().getFullName();
+ String name = "Task: " + plugin +" Id:";
+ if (period > 0) { + if (period > 0) {
+ String name = "Task: " + plugin +" Id:(interval:" + period + ":id:"+task.getTaskId()+")"; + name += "(interval:" + period +")";
+ return new CustomTimingsHandler(name);
+ } else { + } else {
+ String name = "Task: " + plugin + " Id:(Single)"; + name += "(Single)";
+ CustomTimingsHandler result = pluginTaskTimingMap.get(name);
+ if (result == null) {
+ result = new CustomTimingsHandler(name);
+ pluginTaskTimingMap.put(name, result);
+ }
+ return result;
+ } + }
+ CustomTimingsHandler result = pluginTaskTimingMap.get(name);
+ if (result == null) {
+ result = new CustomTimingsHandler(name);
+ pluginTaskTimingMap.put(name, result);
+ }
+ return result;
+ } + }
+ +
+ /** + /**

View file

@ -1,4 +1,4 @@
From 9f7d30b2630ab0b4f7f3f650456f08dd6c6409b6 Mon Sep 17 00:00:00 2001 From ef3c54902fe9772967964f6c7ad03b9d4d803379 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 14 Feb 2013 17:32:20 +1100 Date: Thu, 14 Feb 2013 17:32:20 +1100
Subject: [PATCH] Netty Subject: [PATCH] Netty
@ -223,7 +223,7 @@ index 58d30eb..e4e5049 100644
// CraftBukkit end // CraftBukkit end
this.pendingConnection = pendingconnection; this.pendingConnection = pendingconnection;
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 6f54f7e..2ba6c14 100644 index c0335fa..8ecaeeb 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -23,6 +23,8 @@ public class Spigot { @@ -23,6 +23,8 @@ public class Spigot {
@ -235,7 +235,7 @@ index 6f54f7e..2ba6c14 100644
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) { public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps")); commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
@@ -58,6 +60,12 @@ public class Spigot { @@ -60,6 +62,12 @@ public class Spigot {
tabPing = configuration.getBoolean("settings.tab-ping", tabPing); tabPing = configuration.getBoolean("settings.tab-ping", tabPing);