2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/MethodProfiler.java
|
|
|
|
+++ b/net/minecraft/server/MethodProfiler.java
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -13,6 +13,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public class MethodProfiler {
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2017-01-19 02:42:35 +01:00
|
|
|
+ public static final boolean ENABLED = Boolean.getBoolean("enableDebugMethodProfiler"); // CraftBukkit - disable unless specified in JVM arguments
|
|
|
|
private static final Logger b = LogManager.getLogger();
|
|
|
|
private final List<String> c = Lists.newArrayList();
|
|
|
|
private final List<Long> d = Lists.newArrayList();
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -23,12 +24,14 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
public MethodProfiler() {}
|
|
|
|
|
|
|
|
public void a() {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
this.f.clear();
|
|
|
|
this.e = "";
|
|
|
|
this.c.clear();
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(String s) {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
if (this.a) {
|
2017-05-14 04:00:00 +02:00
|
|
|
if (!this.e.isEmpty()) {
|
2017-01-19 02:42:35 +01:00
|
|
|
this.e = this.e + ".";
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -41,12 +44,14 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(Supplier<String> supplier) {
|
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
if (this.a) {
|
|
|
|
this.a((String) supplier.get());
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void b() {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
if (this.a) {
|
|
|
|
long i = System.nanoTime();
|
|
|
|
long j = ((Long) this.d.remove(this.d.size() - 1)).longValue();
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -69,7 +74,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2015-02-26 23:41:06 +01:00
|
|
|
public List<MethodProfiler.ProfilerInfo> b(String s) {
|
2014-11-25 22:32:16 +01:00
|
|
|
- if (!this.a) {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED || !this.a) { // CraftBukkit
|
|
|
|
return Collections.emptyList();
|
|
|
|
} else {
|
|
|
|
long i = this.f.containsKey("root") ? ((Long) this.f.get("root")).longValue() : 0L;
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -135,11 +140,13 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void c(String s) {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED) return; // CraftBukkit
|
|
|
|
this.b();
|
|
|
|
this.a(s);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public String c() {
|
2017-01-19 02:42:35 +01:00
|
|
|
+ if (!ENABLED) return "[DISABLED]"; // CraftBukkit
|
2017-05-14 04:00:00 +02:00
|
|
|
return this.c.isEmpty() ? "[UNKNOWN]" : (String) this.c.get(this.c.size() - 1);
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|
|
|
|
|
2017-08-03 15:00:00 +02:00
|
|
|
@@ -159,7 +166,7 @@
|
2015-02-26 23:41:06 +01:00
|
|
|
return methodprofiler_profilerinfo.a < this.a ? -1 : (methodprofiler_profilerinfo.a > this.a ? 1 : methodprofiler_profilerinfo.c.compareTo(this.c));
|
|
|
|
}
|
|
|
|
|
|
|
|
- public int compareTo(Object object) {
|
2016-02-29 22:32:46 +01:00
|
|
|
+ public int compareTo(MethodProfiler.ProfilerInfo object) { // CraftBukkit: decompile error
|
2015-02-26 23:41:06 +01:00
|
|
|
return this.a((MethodProfiler.ProfilerInfo) object);
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|