more perf diagnostics
This commit is contained in:
@@ -145,6 +145,10 @@ namespace OpenRa.Game
|
|||||||
public static double RenderTime = 0.0;
|
public static double RenderTime = 0.0;
|
||||||
public static double TickTime = 0.0;
|
public static double TickTime = 0.0;
|
||||||
public static double OreTime = 0.0;
|
public static double OreTime = 0.0;
|
||||||
|
public static double PathToPathTime = 0.0;
|
||||||
|
public static double NormalPathTime = 0.0;
|
||||||
|
public static int PathToPathCount = 0;
|
||||||
|
public static int NormalPathCount = 0;
|
||||||
|
|
||||||
public static Stopwatch sw;
|
public static Stopwatch sw;
|
||||||
|
|
||||||
@@ -155,6 +159,10 @@ namespace OpenRa.Game
|
|||||||
if( dt >= timestep )
|
if( dt >= timestep )
|
||||||
{
|
{
|
||||||
sw.Reset();
|
sw.Reset();
|
||||||
|
PathToPathTime = 0;
|
||||||
|
NormalPathTime = 0;
|
||||||
|
PathToPathCount = 0;
|
||||||
|
NormalPathCount = 0;
|
||||||
lastTime += timestep;
|
lastTime += timestep;
|
||||||
|
|
||||||
if( orderManager.Tick() )
|
if( orderManager.Tick() )
|
||||||
|
|||||||
@@ -99,12 +99,17 @@ namespace OpenRa.Game.Graphics
|
|||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
|
|
||||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}",
|
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\nNormal Pathing ({5:F1} ms\t[{9} paths])\nPathToPath ({6:F1}\t[{8} paths])\n$ {7}",
|
||||||
Game.RenderFrame, Game.orderManager.FrameNumber,
|
Game.RenderFrame, Game.orderManager.FrameNumber,
|
||||||
Game.RenderTime * 1000,
|
Game.RenderTime * 1000,
|
||||||
Game.TickTime * 1000,
|
Game.TickTime * 1000,
|
||||||
Game.OreTime * 1000,
|
Game.OreTime * 1000,
|
||||||
Game.LocalPlayer.Cash), new int2(5, 5), Color.White);
|
Game.NormalPathTime * 1000,
|
||||||
|
Game.PathToPathTime * 1000,
|
||||||
|
Game.LocalPlayer.Cash,
|
||||||
|
Game.PathToPathCount,
|
||||||
|
Game.NormalPathCount
|
||||||
|
), new int2(5, 5), Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
||||||
|
|||||||
@@ -28,7 +28,16 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
public List<int2> FindUnitPath(int2 src, int2 dest, UnitMovementType umt)
|
public List<int2> FindUnitPath(int2 src, int2 dest, UnitMovementType umt)
|
||||||
{
|
{
|
||||||
return FindUnitPath(src, DefaultEstimator(dest), umt);
|
var sw = new Stopwatch();
|
||||||
|
/*if (passableCost[(int)umt][dest.X, dest.Y] == double.PositiveInfinity)
|
||||||
|
return new List<int2>();
|
||||||
|
if (!Game.BuildingInfluence.CanMoveHere(dest))
|
||||||
|
return new List<int2>();*/
|
||||||
|
|
||||||
|
var result = FindUnitPath(src, DefaultEstimator(dest), umt);
|
||||||
|
Game.NormalPathTime += sw.ElapsedTime();
|
||||||
|
Game.NormalPathCount++;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<int2> FindUnitPathToRange(int2 src, int2 dest, UnitMovementType umt, int range)
|
public List<int2> FindUnitPathToRange(int2 src, int2 dest, UnitMovementType umt, int range)
|
||||||
@@ -43,6 +52,8 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
public List<int2> FindPathToPath( int2 from, List<int2> path, UnitMovementType umt )
|
public List<int2> FindPathToPath( int2 from, List<int2> path, UnitMovementType umt )
|
||||||
{
|
{
|
||||||
|
var sw = new Stopwatch();
|
||||||
|
|
||||||
var cellInfo = InitCellInfo();
|
var cellInfo = InitCellInfo();
|
||||||
var queue = new PriorityQueue<PathDistance>();
|
var queue = new PriorityQueue<PathDistance>();
|
||||||
var estimator = DefaultEstimator( from );
|
var estimator = DefaultEstimator( from );
|
||||||
@@ -63,6 +74,8 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
var ret = FindPath( cellInfo, queue, estimator, umt, true );
|
var ret = FindPath( cellInfo, queue, estimator, umt, true );
|
||||||
ret.Reverse();
|
ret.Reverse();
|
||||||
|
Game.PathToPathTime += sw.ElapsedTime();
|
||||||
|
Game.PathToPathCount++;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user