Paper/Bukkit-Patches/0002-Measure-Timings-Duration.patch

54 lines
2.4 KiB
Diff
Raw Normal View History

2014-03-09 23:14:45 +01:00
From febc38ac8c7a2acfef1892d6aede6b8f3515bb11 Mon Sep 17 00:00:00 2001
2013-01-19 09:28:14 +01:00
From: Aikar <aikar@aikar.co>
2013-06-02 02:39:40 +02:00
Date: Sun, 2 Jun 2013 10:42:57 +1000
Subject: [PATCH] Measure Timings Duration
2013-01-19 09:28:14 +01:00
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
2013-12-18 07:48:18 +01:00
index 05cfcb0..c2874f1 100644
2013-01-19 09:28:14 +01:00
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
2013-06-02 02:39:40 +02:00
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList;
2013-01-19 09:28:14 +01:00
public class TimingsCommand extends BukkitCommand {
private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate");
2013-06-02 02:39:40 +02:00
+ public static long timingStart = 0; // Spigot
2013-01-19 09:28:14 +01:00
public TimingsCommand(String name) {
super(name);
@@ -50,9 +51,11 @@ public class TimingsCommand extends BukkitCommand {
}
}
}
+ timingStart = System.nanoTime(); // Spigot
sender.sendMessage("Timings reset");
} else if ("merged".equals(args[0]) || separate) {
+ long sampleTime = System.nanoTime() - timingStart; // Spigot
int index = 0;
int pluginIdx = 0;
File timingFolder = new File("timings");
@@ -92,6 +95,7 @@ public class TimingsCommand extends BukkitCommand {
}
fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)");
}
2013-06-02 02:39:40 +02:00
+ fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); // Spigot
2013-01-19 09:28:14 +01:00
sender.sendMessage("Timings written to " + timings.getPath());
if (separate) sender.sendMessage("Names written to " + names.getPath());
} catch (IOException e) {
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
2014-02-12 14:48:26 +01:00
index 787dcfe..b870ecd 100644
2013-01-19 09:28:14 +01:00
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
2014-02-12 14:48:26 +01:00
@@ -280,6 +280,7 @@ public final class SimplePluginManager implements PluginManager {
2013-01-19 09:28:14 +01:00
}
}
2013-06-02 02:39:40 +02:00
+ org.bukkit.command.defaults.TimingsCommand.timingStart = System.nanoTime(); // Spigot
2013-01-19 09:28:14 +01:00
return result.toArray(new Plugin[result.size()]);
}
--
2014-03-09 23:14:45 +01:00
1.8.3.2
2013-01-19 09:28:14 +01:00