CavePVP-Stuff/cSpigot-master/spigot-api-Patches/0011-Add-lag-spike-logger.patch
2023-05-01 19:59:40 +01:00

53 lines
2.0 KiB
Diff

From b6eb9cede72ab309e6eb71db42972badd731c126 Mon Sep 17 00:00:00 2001
From: Poweruser <poweruser.rs@hotmail.com>
Date: Wed, 25 May 2016 22:00:48 +0200
Subject: [PATCH] Add lag spike logger
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
index 040a556a..7ccd45f3 100644
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
@@ -22,7 +22,7 @@ import java.util.ArrayDeque; // Poweruser
public class CustomTimingsHandler
{
- private static Queue<CustomTimingsHandler> HANDLERS = new ConcurrentLinkedQueue<CustomTimingsHandler>();
+ protected static Queue<CustomTimingsHandler> HANDLERS = new ConcurrentLinkedQueue<CustomTimingsHandler>(); // Poweruser - protected
/*========================================================================*/
private final String name;
private final CustomTimingsHandler parent;
@@ -111,9 +111,9 @@ public class CustomTimingsHandler
for ( CustomTimingsHandler timings : HANDLERS )
{
timings.updateAverageCalculation(); // Poweruser
- if ( timings.curTickTotal > 50000000 )
+ if ( timings.curTickTotal > 50000000L ) // Poweruser - add L, mark number as long
{
- timings.violations += Math.ceil( timings.curTickTotal / 50000000 );
+ timings.violations += Math.ceil( timings.curTickTotal / 50000000L ); // Poweruser - add L, mark number as long
}
timings.curTickTotal = 0;
timings.timingDepth = 0; // incase reset messes this up
@@ -196,5 +196,17 @@ public class CustomTimingsHandler
}
return 0L;
}
+
+ public long getCurrentTickTotal() {
+ return this.curTickTotal;
+ }
+
+ public long getCurrentCount() {
+ return this.count;
+ }
+
+ public String getName() {
+ return this.name;
+ }
// Poweruser end
}
--
2.11.0.windows.3