Timings says goodbye

This commit is contained in:
Riley Park 2024-07-20 20:01:46 -07:00
parent 3a47518b4b
commit 38e61d072f

View file

@ -3,8 +3,6 @@ From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
TODO: Add #isStopping to FullServerTickHandler#stopTiming in patch 191
expose isRunning
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
new file mode 100644
@ -274,10 +272,10 @@ index 0000000000000000000000000000000000000000..a3ad690691eb5537a565d7ba684354ac
+}
diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java
new file mode 100644
index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2ca7c44f0
index 0000000000000000000000000000000000000000..421be8a6f9a65596ac8eab071e6ee57533d02718
--- /dev/null
+++ b/src/main/java/co/aikar/timings/Timing.java
@@ -0,0 +1,86 @@
@@ -0,0 +1,94 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -319,14 +317,17 @@ index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2
+ * @return Timing
+ */
+ @NotNull
+ Timing startTiming();
+ default Timing startTiming() {
+ return this;
+ }
+
+ /**
+ * <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
+ *
+ * Will automatically be called when this Timing is used with try-with-resources
+ */
+ void stopTiming();
+ default void stopTiming() {
+ }
+
+ /**
+ * Starts timing the execution until {@link #stopTiming()} is called.
@ -336,7 +337,9 @@ index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2
+ * @return Timing
+ */
+ @NotNull
+ Timing startTimingIfSync();
+ default Timing startTimingIfSync() {
+ return this;
+ }
+
+ /**
+ * <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
@ -345,13 +348,15 @@ index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2
+ *
+ * But only if we are on the primary thread.
+ */
+ void stopTimingIfSync();
+ default void stopTimingIfSync() {
+ }
+
+ /**
+ * @deprecated Doesn't do anything - Removed
+ */
+ @Deprecated
+ void abort();
+ default void abort() {
+ }
+
+ /**
+ * Used internally to get the actual backing Handler in the case of delegated Handlers
@ -362,7 +367,8 @@ index 0000000000000000000000000000000000000000..4195efcfe044618052bb03dea34a4fb2
+ TimingHandler getTimingHandler();
+
+ @Override
+ void close();
+ default void close() {
+ }
+}
diff --git a/src/main/java/co/aikar/timings/TimingData.java b/src/main/java/co/aikar/timings/TimingData.java
new file mode 100644