mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
54 lines
2.4 KiB
Diff
54 lines
2.4 KiB
Diff
From 0dd63da31dd4362f247137dfeae4d430f6748f88 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 2 Jun 2013 10:42:57 +1000
|
|
Subject: [PATCH] Measure Timings Duration
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
|
index 29ebbe0..3c4ef89 100644
|
|
--- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
|
+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
|
|
@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList;
|
|
|
|
public class TimingsCommand extends BukkitCommand {
|
|
private static final List<String> TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate");
|
|
+ public static long timingStart = 0; // Spigot
|
|
|
|
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)");
|
|
}
|
|
+ fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); // Spigot
|
|
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
|
|
index 93fb4f5..a96a33b 100644
|
|
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
@@ -274,6 +274,7 @@ public final class SimplePluginManager implements PluginManager {
|
|
}
|
|
}
|
|
|
|
+ org.bukkit.command.defaults.TimingsCommand.timingStart = System.nanoTime(); // Spigot
|
|
return result.toArray(new Plugin[result.size()]);
|
|
}
|
|
|
|
--
|
|
1.8.1.2
|
|
|