removing a no-time-at-all timer; logging long-running trait Tick()

This commit is contained in:
Bob
2010-04-11 22:10:26 +12:00
parent fa56be799b
commit 32713036d8
2 changed files with 16 additions and 4 deletions

View File

@@ -144,8 +144,18 @@ namespace OpenRA
public void Tick()
{
var sw = new Stopwatch();
foreach (var a in actors) a.Tick();
Queries.WithTraitMultiple<ITick>().Do( x => x.Trait.Tick( x.Actor ) );
Queries.WithTraitMultiple<ITick>().Do( x =>
{
var t = sw.ElapsedTime();
x.Trait.Tick( x.Actor );
var dt = sw.ElapsedTime() - t;
if( dt > 0.001 )
Log.Write( "expensive tick: {0}->{1}", x.Actor.Info.Name, x.Trait.GetType() );
} );
foreach (var e in effects) e.Tick( this );