Attempt to smooth out timer usage.

Add extra sign metrics.
This commit is contained in:
KHobbits 2013-04-21 23:39:50 +01:00
parent c2eb7b05b3
commit f48871ff29
5 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,4 @@
build.xml.data.CRC32=b4df970c
build.xml.data.CRC32=cab45985
build.xml.script.CRC32=7a797370
build.xml.stylesheet.CRC32=28e38971@1.50.3.46
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.

View File

@ -217,7 +217,7 @@ public class Essentials extends JavaPlugin implements IEssentials
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
scheduleSyncRepeatingTask(timer, 1000, 50);
Economy.setEss(this);
execTimer.mark("RegHandler");

View File

@ -14,8 +14,8 @@ public class EssentialsTimer implements Runnable
private final transient Set<User> onlineUsers = new HashSet<User>();
private transient long lastPoll = System.currentTimeMillis();
private final transient LinkedList<Float> history = new LinkedList<Float>();
private final int skip1 = 0;
private final int skip2 = 0;
private int skip1 = 0;
private int skip2 = 0;
private final long maxTime = 10 * 1000000;
EssentialsTimer(final IEssentials ess)

View File

@ -5,6 +5,7 @@ import com.earth2me.essentials.metrics.Metrics.Graph;
import com.earth2me.essentials.metrics.Metrics.Plotter;
import com.earth2me.essentials.register.payment.Method;
import com.earth2me.essentials.register.payment.methods.VaultEco;
import com.earth2me.essentials.signs.EssentialsSign;
import java.util.Locale;
import java.util.logging.Level;
import org.bukkit.configuration.ConfigurationSection;
@ -101,8 +102,11 @@ public class MetricsStarter implements Runnable
@Override
public int getValue()
{
ConfigurationSection kits = ess.getSettings().getKits();
if (kits == null) { return 0; }
ConfigurationSection kits = ess.getSettings().getKits();
if (kits == null)
{
return 0;
}
return kits.getKeys(false).size();
}
});
@ -189,6 +193,12 @@ public class MetricsStarter implements Runnable
}
depGraph.addPlotter(new SimplePlotter(ess.getPermissionsHandler().getName()));
final Graph signGraph = metrics.createGraph("Signs");
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
signGraph.addPlotter(new SimplePlotter(sign.getName()));
}
metrics.start();
}

View File

@ -67,6 +67,10 @@ public class EssentialsSign
{
return _("signFormatTemplate", this.signName);
}
public String getName() {
return this.signName;
}
private String getUsername(final User user)
{