+ * The times are measured in nanoseconds.
+ */
+ public static final class ArgumentTiming {
+
+ private long start;
+ private long end;
+ private boolean success;
+
+ /**
+ * Created a new argument timing instance
+ *
+ * @param start Start time (in nanoseconds)
+ * @param end End time (in nanoseconds)
+ * @param success Whether or not the argument was parsed successfully
+ */
+ public ArgumentTiming(final long start, final long end, final boolean success) {
+ this.start = start;
+ this.end = end;
+ this.success = success;
+ }
+
+ /**
+ * Created a new argument timing instance without an end time
+ *
+ * @param start Start time (in nanoseconds)
+ */
+ public ArgumentTiming(final long start) {
+ this(start, -1, false);
+ }
+
+ /**
+ * Created a new argument timing instance
+ */
+ public ArgumentTiming() {
+ this(-1, -1, false);
+ }
+
+ /**
+ * Get the elapsed time
+ *
+ * @return Elapsed time (in nanoseconds)
+ */
+ public long getElapsedTime() {
+ if (this.end == -1) {
+ throw new IllegalStateException("No end time has been registered");
+ } else if (this.start == -1) {
+ throw new IllegalStateException("No start time has been registered");
+ }
+ return this.end - this.start;
+ }
+
+ /**
+ * Set the end time
+ *
+ * @param end End time (in nanoseconds)
+ * @param success Whether or not the argument was parsed successfully
+ */
+ public void setEnd(final long end, final boolean success) {
+ this.end = end;
+ this.success = success;
+ }
+
+ /**
+ * Set the start time
+ *
+ * @param start Start time (in nanoseconds)
+ */
+ public void setStart(final long start) {
+ this.start = start;
+ }
+
+ /**
+ * Check whether or not the value was parsed successfully
+ *
+ * @return {@code true} if the value was parsed successfully, {@code false} if not
+ */
+ public boolean wasSuccess() {
+ return this.success;
+ }
+
+ }
+
}
diff --git a/cloud-core/src/test/java/com/intellectualsites/commands/CommandPerformanceTest.java b/cloud-core/src/test/java/com/intellectualsites/commands/CommandPerformanceTest.java
new file mode 100644
index 00000000..eff575f4
--- /dev/null
+++ b/cloud-core/src/test/java/com/intellectualsites/commands/CommandPerformanceTest.java
@@ -0,0 +1,91 @@
+//
+// MIT License
+//
+// Copyright (c) 2020 Alexander Söderberg
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+//
+package com.intellectualsites.commands;
+
+import com.intellectualsites.commands.context.CommandContext;
+import com.intellectualsites.commands.execution.CommandResult;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.openjdk.jmh.results.RunResult;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import java.util.Collection;
+
+final class CommandPerformanceTest {
+
+ private static CommandManager