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
Afficher le fichier Open project: vchelaru/FlatRedBall

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode Description
LoadContent ( ) : void

Private Methods

Méthode 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 méthode

public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Résultat void

GetAverageTime() public méthode

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
Résultat float

Initialize() public méthode

public Initialize ( ) : void
Résultat void

LoadContent() protected méthode

protected LoadContent ( ) : void
Résultat void

TimeRuler() public méthode

public TimeRuler ( Microsoft.Xna.Framework.Game game ) : System
game Microsoft.Xna.Framework.Game
Résultat System