Report slow events in milliseconds

nanoseconds is an overly accurate measurement for event handers, and
only ends up confusing and overly worrying people.

milliseconds is a much more normal and expected measurement in the
community, especially when we do not care about nanosecond level
accuracy.
This commit is contained in:
Shane Freeder 2019-03-26 04:37:26 +00:00
parent ae319ce090
commit c331e7fd00

View File

@ -0,0 +1,31 @@
From 2f6ad505879900bc8504ae63336e67f17b8cac8a Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 26 Mar 2019 04:28:18 +0000
Subject: [PATCH] Report slow events in milliseconds
nanoseconds is an overly accurate measurement for event handers, and
only ends up confusing and overly worrying people.
milliseconds is a much more normal and expected measurement in the
community, especially when we do not care about nanosecond level
accuracy.
diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
index 81bd18f0..9408e6c2 100644
--- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
+++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
@@ -435,9 +435,9 @@ public class PluginManager
long elapsed = System.nanoTime() - start;
if ( elapsed > 250000000 )
{
- ProxyServer.getInstance().getLogger().log( Level.WARNING, "Event {0} took {1}ns to process!", new Object[]
+ ProxyServer.getInstance().getLogger().log( Level.WARNING, "Event {0} took {1}ms to process!", new Object[] // Waterfall - human values
{
- event, elapsed
+ event, elapsed / 1000000 // Waterfall - human values
} );
}
return event;
--
2.21.0