gut perf logging - only record expensive ticks. perf.log is small enough to be useful now.
This commit is contained in:
@@ -49,9 +49,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
viewport = new Viewport(new float2(Renderer.Resolution), map.TopLeft, map.BottomRight, Renderer);
|
viewport = new Viewport(new float2(Renderer.Resolution), map.TopLeft, map.BottomRight, Renderer);
|
||||||
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
||||||
Timer.Time("viewport: {0}");
|
|
||||||
world = new World(modData.Manifest, map);
|
world = new World(modData.Manifest, map);
|
||||||
Timer.Time("world: {0}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MoveViewport(int2 loc)
|
public static void MoveViewport(int2 loc)
|
||||||
|
|||||||
@@ -90,26 +90,20 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public void DrawRegions( World world )
|
public void DrawRegions( World world )
|
||||||
{
|
{
|
||||||
Timer.Time( "DrawRegions start" );
|
|
||||||
|
|
||||||
renderer.BeginFrame(scrollPosition);
|
renderer.BeginFrame(scrollPosition);
|
||||||
world.WorldRenderer.Draw();
|
world.WorldRenderer.Draw();
|
||||||
Timer.Time( "worldRenderer: {0}" );
|
|
||||||
|
|
||||||
Widget.DoDraw(world);
|
Widget.DoDraw(world);
|
||||||
Timer.Time( "widgets: {0}" );
|
|
||||||
|
|
||||||
var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default";
|
var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default";
|
||||||
var c = new Cursor(cursorName);
|
var c = new Cursor(cursorName);
|
||||||
c.Draw((int)cursorFrame, Viewport.LastMousePos + Location);
|
c.Draw((int)cursorFrame, Viewport.LastMousePos + Location);
|
||||||
Timer.Time( "cursors: {0}" );
|
|
||||||
|
|
||||||
renderer.RgbaSpriteRenderer.Flush();
|
renderer.RgbaSpriteRenderer.Flush();
|
||||||
renderer.SpriteRenderer.Flush();
|
renderer.SpriteRenderer.Flush();
|
||||||
renderer.WorldSpriteRenderer.Flush();
|
renderer.WorldSpriteRenderer.Flush();
|
||||||
|
|
||||||
renderer.EndFrame();
|
renderer.EndFrame();
|
||||||
Timer.Time( "endFrame: {0}" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshPalette()
|
public void RefreshPalette()
|
||||||
|
|||||||
@@ -59,21 +59,15 @@ namespace OpenRA
|
|||||||
if (!AvailableMaps.ContainsKey(uid))
|
if (!AvailableMaps.ContainsKey(uid))
|
||||||
throw new InvalidDataException("Invalid map uid: {0}".F(uid));
|
throw new InvalidDataException("Invalid map uid: {0}".F(uid));
|
||||||
|
|
||||||
Timer.Time("----PrepareMap");
|
|
||||||
var map = new Map(AvailableMaps[uid].Package);
|
var map = new Map(AvailableMaps[uid].Package);
|
||||||
Timer.Time( "Map: {0}" );
|
|
||||||
|
|
||||||
Rules.LoadRules(Manifest, map);
|
Rules.LoadRules(Manifest, map);
|
||||||
Timer.Time( "Rules: {0}" );
|
|
||||||
|
|
||||||
if (map.Theater != cachedTheatre)
|
if (map.Theater != cachedTheatre)
|
||||||
{
|
{
|
||||||
SpriteSheetBuilder.Initialize( Rules.TileSets[map.Tileset] );
|
SpriteSheetBuilder.Initialize( Rules.TileSets[map.Tileset] );
|
||||||
SequenceProvider.Initialize(Manifest.Sequences);
|
SequenceProvider.Initialize(Manifest.Sequences);
|
||||||
Timer.Time("SSB, SeqProv: {0}");
|
|
||||||
cachedTheatre = map.Theater;
|
cachedTheatre = map.Theater;
|
||||||
}
|
}
|
||||||
Timer.Time("----end PrepareMap");
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,15 +78,12 @@ namespace OpenRA
|
|||||||
|
|
||||||
public World(Manifest manifest, Map map)
|
public World(Manifest manifest, Map map)
|
||||||
{
|
{
|
||||||
Timer.Time( "----World.ctor" );
|
|
||||||
Map = map;
|
Map = map;
|
||||||
|
|
||||||
TileSet = Rules.TileSets[Map.Tileset];
|
TileSet = Rules.TileSets[Map.Tileset];
|
||||||
TileSet.LoadTiles();
|
TileSet.LoadTiles();
|
||||||
Timer.Time( "Tileset: {0}" );
|
|
||||||
|
|
||||||
WorldRenderer = new WorldRenderer(this);
|
WorldRenderer = new WorldRenderer(this);
|
||||||
Timer.Time("renderer: {0}");
|
|
||||||
|
|
||||||
WorldActor = CreateActor( "World", new TypeDictionary() );
|
WorldActor = CreateActor( "World", new TypeDictionary() );
|
||||||
Queries = new AllQueries(this);
|
Queries = new AllQueries(this);
|
||||||
@@ -101,16 +98,10 @@ namespace OpenRA
|
|||||||
if (!p.Stances.ContainsKey(q))
|
if (!p.Stances.ContainsKey(q))
|
||||||
p.Stances[q] = Stance.Neutral;
|
p.Stances[q] = Stance.Neutral;
|
||||||
|
|
||||||
Timer.Time( "worldActor, players: {0}" );
|
|
||||||
|
|
||||||
PathFinder = new PathFinder(this);
|
PathFinder = new PathFinder(this);
|
||||||
|
|
||||||
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
|
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
|
||||||
wlh.WorldLoaded(this);
|
wlh.WorldLoaded(this);
|
||||||
|
|
||||||
Timer.Time( "hooks, pathing: {0}" );
|
|
||||||
|
|
||||||
Timer.Time( "----end World.ctor" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor CreateActor( string name, TypeDictionary initDict )
|
public Actor CreateActor( string name, TypeDictionary initDict )
|
||||||
@@ -155,31 +146,19 @@ namespace OpenRA
|
|||||||
if (DisableTick)
|
if (DisableTick)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Timer.Time("----World Tick");
|
actors.DoTimed( x => x.Tick(), "expensive actor tick: {0} ({1:0.000} ms)", 0.001 );
|
||||||
|
|
||||||
actors.DoTimed( x => x.Tick(), "expensive actor tick: {0} ({1:0.000})", 0.001 );
|
|
||||||
Timer.Time(" actors: {0:0.000}");
|
|
||||||
|
|
||||||
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
|
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
|
||||||
{
|
{
|
||||||
x.Trait.Tick( x.Actor );
|
x.Trait.Tick( x.Actor );
|
||||||
Timer.Time( "trait tick \"{0}\": {{0}}".F( x.Trait.GetType().Name ) );
|
}, "expensive trait tick: {0} ({1:0.000} ms)", 0.001 );
|
||||||
}, "expensive trait tick: {0} ({1:0.000})", 0.001 );
|
|
||||||
Timer.Time(" traits: {0:0.000}");
|
|
||||||
|
|
||||||
effects.DoTimed( e => e.Tick( this ), "expensive effect tick: {0} ({1:0.000})", 0.001 );
|
|
||||||
Timer.Time(" effects: {0:0.000}");
|
|
||||||
|
|
||||||
|
effects.DoTimed( e => e.Tick( this ), "expensive effect tick: {0} ({1:0.000} ms)", 0.001 );
|
||||||
Game.viewport.Tick();
|
Game.viewport.Tick();
|
||||||
Timer.Time(" viewport: {0:0.000}");
|
|
||||||
|
|
||||||
while (frameEndActions.Count != 0)
|
while (frameEndActions.Count != 0)
|
||||||
frameEndActions.Dequeue()(this);
|
frameEndActions.Dequeue()(this);
|
||||||
|
|
||||||
Timer.Time(" frameEndActions: {0:0.000}");
|
|
||||||
|
|
||||||
WorldRenderer.Tick();
|
WorldRenderer.Tick();
|
||||||
Timer.Time(" worldrenderer: {0:0.000}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user