C# Класс TimeRulerLibrary.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.
Наследование: Microsoft.Xna.Framework.DrawableGameComponent
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
BeginMark void
BeginMark void
CommandExecute void
Draw void
EndMark void
EndMark void
ResetLog void
StartFrame void

Открытые методы

Метод Описание
Draw ( GameTime gameTime ) : void
GetAverageTime ( int barIndex, string markerName ) : float

Get avarage time of given bar index and marker name.

Initialize ( ) : void
TimeRuler ( Game game ) : System

Защищенные методы

Метод Описание
LoadContent ( ) : void

Приватные методы

Метод Описание
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

Описание методов

Draw() публичный Метод

public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
Результат void

GetAverageTime() публичный Метод

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
Результат float

Initialize() публичный Метод

public Initialize ( ) : void
Результат void

LoadContent() защищенный Метод

protected LoadContent ( ) : void
Результат void

TimeRuler() публичный Метод

public TimeRuler ( Game game ) : System
game Game
Результат System