Fix avg tick times

This commit is contained in:
William Blake Galbreath
2020-02-17 20:26:12 -06:00
parent 5e068999e9
commit 0179d5196f
7 changed files with 77 additions and 72 deletions

View File

@@ -1,26 +1,27 @@
From cf027551379cf75f6751acda9b3e8d1dc5b75dc1 Mon Sep 17 00:00:00 2001
From 06db9bc6c7dd75c551ed8572bf924e0e6a149067 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 30 Jan 2020 00:41:08 -0600
Subject: [PATCH] Add tick times API
---
src/main/java/org/bukkit/Bukkit.java | 20 ++++++++++++++++++++
src/main/java/org/bukkit/Bukkit.java | 21 +++++++++++++++++++++
src/main/java/org/bukkit/Server.java | 17 +++++++++++++++++
2 files changed, 37 insertions(+)
2 files changed, 38 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 50415189..36e48723 100644
index 50415189c..8fbda2aee 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1620,4 +1620,24 @@ public final class Bukkit {
@@ -1620,4 +1620,25 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
+
+ // Purpur start
+ /**
+ * Get the last 100 tick times (in nanos)
+ * @return Last 100 tick times (in nanos)
+ * Get a sample of the servers last tick times (in nanos)
+ *
+ * @return A sample of the servers last tick times (in nanos)
+ */
+ @NotNull
+ public static long[] getTickTimes() {
@@ -28,7 +29,7 @@ index 50415189..36e48723 100644
+ }
+
+ /**
+ * Get the average tick time (in millis) of the last 100 ticks
+ * Get the average tick time (in millis)
+ *
+ * @return Average tick time (in millis)
+ */
@@ -38,7 +39,7 @@ index 50415189..36e48723 100644
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 248c32b0..c28cc59c 100644
index 248c32b03..7d631ac27 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1413,4 +1413,21 @@ public interface Server extends PluginMessageRecipient {
@@ -48,15 +49,15 @@ index 248c32b0..c28cc59c 100644
+
+ // Purpur start
+ /**
+ * Get the last 100 tick times (in nanos)
+ * Get a sample of the servers last tick times (in nanos)
+ *
+ * @return Last 100 tick times (in nanos)
+ * @return A sample of the servers last tick times (in nanos)
+ */
+ @NotNull
+ long[] getTickTimes();
+
+ /**
+ * Get the average tick time (in millis) of the last 100 ticks
+ * Get the average tick time (in millis)
+ *
+ * @return Average tick time (in millis)
+ */

View File

@@ -1,4 +1,4 @@
From 9c988f7504d9e12aca27e2835286ef100b5a4b43 Mon Sep 17 00:00:00 2001
From 2c39363f1617d348182d18c4ef1ba4b60e904140 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 26 May 2019 15:18:40 -0500
Subject: [PATCH] Bring back server name
@@ -9,7 +9,7 @@ Subject: [PATCH] Bring back server name
2 files changed, 16 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 36e48723..451dc570 100644
index 8fbda2aee..a2cf8e29b 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1622,6 +1622,15 @@ public final class Bukkit {
@@ -26,10 +26,10 @@ index 36e48723..451dc570 100644
+ }
+
/**
* Get the last 100 tick times (in nanos)
* @return Last 100 tick times (in nanos)
* Get a sample of the servers last tick times (in nanos)
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c28cc59c..57bb2dde 100644
index 7d631ac27..92df8f8cd 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1415,6 +1415,13 @@ public interface Server extends PluginMessageRecipient {
@@ -44,7 +44,7 @@ index c28cc59c..57bb2dde 100644
+ String getServerName();
+
/**
* Get the last 100 tick times (in nanos)
* Get a sample of the servers last tick times (in nanos)
*
--
2.24.0

View File

@@ -1,4 +1,4 @@
From ae537506a49446a9f91e2fec2bfc636debe99fe4 Mon Sep 17 00:00:00 2001
From 4e1039edb300dd6fe96d0879f7e08d8a73f1f844 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 23 Jul 2019 10:07:24 -0500
Subject: [PATCH] Implement lagging threshold
@@ -9,7 +9,7 @@ Subject: [PATCH] Implement lagging threshold
2 files changed, 16 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 451dc570..7bdd962b 100644
index a2cf8e29b..220cc96c0 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1631,6 +1631,15 @@ public final class Bukkit {
@@ -26,10 +26,10 @@ index 451dc570..7bdd962b 100644
+ }
+
/**
* Get the last 100 tick times (in nanos)
* @return Last 100 tick times (in nanos)
* Get a sample of the servers last tick times (in nanos)
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 57bb2dde..ca195120 100644
index 92df8f8cd..3714f2f55 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1422,6 +1422,13 @@ public interface Server extends PluginMessageRecipient {
@@ -44,7 +44,7 @@ index 57bb2dde..ca195120 100644
+ boolean isLagging();
+
/**
* Get the last 100 tick times (in nanos)
* Get a sample of the servers last tick times (in nanos)
*
--
2.24.0