Adjust TPS command to start at 20tps, show * for catchup TPS, and round to 2 decimal places.
This commit is contained in:
parent
8832052c84
commit
fa94a8a99a
@ -1,11 +1,11 @@
|
||||
From 21c8405f31d7d07ddd80fad5950ef608936a492c Mon Sep 17 00:00:00 2001
|
||||
From e6bbddc5d64a0888b7e55a9b59485224c722c265 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sat, 25 Jan 2014 14:08:35 +1100
|
||||
Subject: [PATCH] Highly Optimized Tick Loop
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 588ce0a..a549a95 100644
|
||||
index 588ce0a..022e032 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -101,6 +101,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
@ -34,11 +34,12 @@ index 588ce0a..a549a95 100644
|
||||
public void run() {
|
||||
try {
|
||||
if (this.init()) {
|
||||
@@ -429,38 +441,32 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
@@ -429,38 +441,33 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
this.p.setServerInfo(new ServerPingServerData("1.7.2", 4));
|
||||
this.a(this.p);
|
||||
|
||||
+ // Spigot start
|
||||
+ Arrays.fill( recentTps, 20 );
|
||||
+ long lastTick = 0, catchupTime = 0, curTime, wait;
|
||||
while (this.isRunning) {
|
||||
- long k = ap();
|
||||
@ -108,10 +109,10 @@ index 205249e..6634292 100755
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
new file mode 100644
|
||||
index 0000000..a101b52
|
||||
index 0000000..2b8343d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
@@ -0,0 +1,44 @@
|
||||
@@ -0,0 +1,45 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import com.google.common.base.Joiner;
|
||||
@ -143,7 +144,7 @@ index 0000000..a101b52
|
||||
+ StringBuilder sb = new StringBuilder( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " );
|
||||
+ for ( double tps : MinecraftServer.getServer().recentTps )
|
||||
+ {
|
||||
+ sb.append( format( Math.min( tps, 20.0 ) ) );
|
||||
+ sb.append( format( tps ) );
|
||||
+ sb.append( ", " );
|
||||
+ }
|
||||
+ sender.sendMessage( sb.substring( 0, sb.length() - 2 ) );
|
||||
@ -153,7 +154,8 @@ index 0000000..a101b52
|
||||
+
|
||||
+ private String format(double tps)
|
||||
+ {
|
||||
+ return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() + tps;
|
||||
+ return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
|
||||
+ + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user