C# Class PerformanceMeasuring.GameDebugTools.TimeRuler

Realtime CPU measuring tool
You can visually find bottle neck, and know how much you can put more CPU jobs by using this tool. Because of this is real time profile, you can find gritches in the game too. TimeRuler provide the following features: * Up to 8 bars (Configurable) * Change colors for each markers * Marker logging. * It won't even generate BeginMark/EndMark method calls when you got rid of the TRACE constant. * It supports up to 32 (Configurable) nested BeginMark method calls. * Multithreaded safe * Automatically changes display frames based on fram duration. How to use: Added TimerRuler instance to Game.Components and call timerRuler.StartFrame in top of the Game.Update method. Then, surround the code that you want measure by BeginMark and EndMark. timeRuler.BeginMark( "Update", Color.Blue ); // process that you want to measure. timerRuler.EndMark( "Update" ); Also, you can specify bar index of marker (default value is 0) timeRuler.BeginMark( 1, "Update", Color.Blue ); All profilring methods has CondionalAttribute with "TRACE". If you not specified "TRACE" constant, it doesn't even generate method calls for BeginMark/EndMark. So, don't forget remove "TRACE" constant when you release your game.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Datei anzeigen Open project: vchelaru/FlatRedBall

Public Methods

Method Description
Draw ( GameTime gameTime ) : void
GetAverageTime ( int barIndex, string markerName ) : float

Get avarage time of given bar index and marker name.

Initialize ( ) : void
TimeRuler ( Microsoft.Xna.Framework.Game game ) : System

Protected Methods

Method Description
LoadContent ( ) : void

Private Methods

Method Description
BeginMark ( int barIndex, string markerName, Color color ) : void
BeginMark ( string markerName, Color color ) : void
CommandExecute ( IDebugCommandHost host, string command, IList arguments ) : void

'tr' command execution.

Draw ( Vector2 position, int width ) : void
EndMark ( int barIndex, string markerName ) : void
EndMark ( string markerName ) : void
ResetLog ( ) : void
StartFrame ( ) : void

Method Details

Draw() public method

public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

GetAverageTime() public method

Get avarage time of given bar index and marker name.
public GetAverageTime ( int barIndex, string markerName ) : float
barIndex int Index of bar
markerName string name of marker
return float

Initialize() public method

public Initialize ( ) : void
return void

LoadContent() protected method

protected LoadContent ( ) : void
return void

TimeRuler() public method

public TimeRuler ( Microsoft.Xna.Framework.Game game ) : System
game Microsoft.Xna.Framework.Game
return System