C# Класс Nez.Analysis.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 glitches 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 DEBUG constant. * It supports up to 32 (Configurable) nested BeginMark method calls. * Multithreaded safe * Automatically changes display frames based on frame duration. How to use: 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 profiling methods has CondionalAttribute with "DEBUG". If you not specified "DEBUG" constant, it doesn't even generate method calls for BeginMark/EndMark. So, don't forget remove "DEBUG" constant when you release your game.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
enabled bool
instance TimeRuler
showLog bool
targetSampleFrames int
width int

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

Метод Описание
getAverageTime ( int barIndex, string markerName ) : float

Get average time of given bar index and marker name.

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

Метод Описание
TimeRuler ( ) : System
beginMark ( int barIndex, string markerName, Color color ) : void
beginMark ( string markerName, Color color ) : void
endMark ( int barIndex, string markerName ) : void
endMark ( string markerName ) : void
onGraphicsDeviceReset ( ) : void
render ( ) : void
render ( Vector2 position, int width ) : void
resetLog ( ) : void
startFrame ( ) : void
toggleTimeRuler ( ) : void

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

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

Get average 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

Описание свойств

enabled публичное свойство

public bool enabled
Результат bool

instance публичное статическое свойство

public static TimeRuler,Nez.Analysis instance
Результат TimeRuler

showLog публичное свойство

Gets/Set log display or no.
public bool showLog
Результат bool

targetSampleFrames публичное свойство

Gets/Sets target sample frames.
public int targetSampleFrames
Результат int

width публичное свойство

Gets/Sets timer ruler width.
public int width
Результат int