Refine profiler, improve fluid performance

The fluid improvements reduce the number of scheduled updates queued
during terrain generation (they are not really very necessary).
This commit is contained in:
Drew DeVault 2015-09-07 16:22:20 -04:00
parent 08c313a651
commit 988d2077a2
2 changed files with 6 additions and 3 deletions

View File

@ -69,6 +69,8 @@ namespace TrueCraft.Core.Logic.Blocks
public void ScheduleNextEvent(Coordinates3D coords, IWorld world, IMultiplayerServer server)
{
if (world.GetBlockID(coords) == StillID)
return;
var chunk = world.FindChunk(coords);
server.Scheduler.ScheduleEvent("fluid", chunk,
TimeSpan.FromSeconds(SecondsBetweenUpdates), (_server) =>

View File

@ -42,7 +42,7 @@ namespace TrueCraft.Profiling
{
ActiveTimers.Push(new ActiveTimer
{
Started = Stopwatch.ElapsedMilliseconds,
Started = Stopwatch.ElapsedTicks,
Finished = -1,
Bucket = bucket
});
@ -54,12 +54,13 @@ namespace TrueCraft.Profiling
if (ActiveTimers.Count > 0)
{
var timer = ActiveTimers.Pop();
timer.Finished = Stopwatch.ElapsedMilliseconds;
timer.Finished = Stopwatch.ElapsedTicks;
for (int i = 0; i < EnabledBuckets.Count; i++)
{
if (Match(EnabledBuckets[i], timer.Bucket))
{
Console.WriteLine("{0} took {1}ms", timer.Bucket, timer.Finished - timer.Started);
Console.WriteLine("{0} took {1}ms", timer.Bucket,
(timer.Finished - timer.Started) / 10000.0);
break;
}
}