Cuberite Forum
TickTimer - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Releases (https://forum.cuberite.org/forum-2.html)
+--- Thread: TickTimer (/thread-838.html)

Pages: 1 2 3


TickTimer - bearbin - 04-02-2013

TickTimer is a plugin that counts the time between ticks: essentially a measure of lag on the server. The plugin also allows access via the console.

Commands:

Code:
/lag
- Gives the average TPS over the last 40 (configurable) ticks.

Permissions:

Code:
ticktimer.tps
- Allows access to the /tps command.

Download:

Github; zipfile.


RE: TickTimer - xoft - 04-03-2013

Good job! Something similar to what I've been planning for quite some time, just never got around to it.
May I suggest a second feature? If a tick takes longer than a configurable threshold (let's say half a second), log that to the server console:
"INFO: Tick took too long: 985 ms instead of 50 ms. Last such overload: 5 ticks ago". That would be quite helpful for me as a developer.

Also, there's a small mistmatch between /tps and /lag commands in the description.


RE: TickTimer - bearbin - 04-03-2013

Ah, I'll clarify (/lag and /tps both work). The extra feature sounds great, I'll add it straight away.


RE: TickTimer - xoft - 04-03-2013

Maybe for the extra feature add a command to turn it off temporarily - in case it floods the server console Wink


RE: TickTimer - bearbin - 04-03-2013

I added a config switch, I'll add a configurable delay it will wait before it says it again.

Done!


RE: TickTimer - FakeTruth - 04-03-2013

Does that even work? I thought I clamped the delta time somewhere - high delta time values can make things overshoot - or are you using other methods for measuring the time between ticks?


RE: TickTimer - bearbin - 04-03-2013

I have no idea! If the delta is clamped to 20tps, then the plugin may not work. If it's higher it may work, just not properly. Maybe you can make a new hook for the full amount of time it takes. Or maybe HOOK_TICK_FINISHED which calls OnTickFinished(TimeTaken) where timetaken is the amount of time MCServer took to compute ontick events in ms?


RE: TickTimer - xoft - 04-03-2013

There is no cap; only if a tick takes less than 50 ms, the server sleeps for whatever milliseconds are left until a full tick (Server.cpp lines 367 - 394, function ServerTickThread() )


RE: TickTimer - FakeTruth - 04-03-2013

Actually ...

bool cServer::Tick(float a_Dt)
{
    //LOG("1. Tick %0.2f", a_Dt);
	if( a_Dt > 100.f ) a_Dt = 100.f; // Don't go over 1/10 second
....



RE: TickTimer - bearbin - 04-03-2013

OkTongue Why is the tick set at max 100ms? Is there any way to get the actual duration, not capped?