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
Пример #1
0
 public TimeHistory(Game game, TimeRuler ruler)
     : base(game)
 {
     _ruler = ruler;
 }
Пример #2
0
        public static void Initialize(Game g)
        {
            _debugManager = new DebugManager(g);
            g.Components.Add(_debugManager);

            _debugCommandUI = new DebugCommandUI(g);
            _debugCommandUI.DrawOrder = int.MaxValue;
            g.Components.Add(_debugCommandUI);

            _fpsCounter = new FpsCounter(g);
            g.Components.Add(_fpsCounter);

            _memTracker = new MemoryTracker(g);
            g.Components.Add(_memTracker);

            _currentRuler = new TimeRuler(g);
            g.Components.Add(_currentRuler);

            _timeHistory = new TimeHistory(g, _currentRuler);
            g.Components.Add(_timeHistory);
        }
Пример #3
0
    public static void InitializeWithGame(Game g)
    {
        // Initialize debug manager and add it to components.
        _debugManager = new DebugManager(g);
        g.Components.Add(_debugManager);

        // Initialize debug command UI and add it to compoents.
        _debugCommandUI = new DebugCommandUI(g);

        // Change DrawOrder for render debug command UI on top of other compoents.
        _debugCommandUI.DrawOrder = int.MaxValue;

        g.Components.Add(_debugCommandUI);

        // Initialize FPS counter and add it to compoentns.
        _fpsCounter = new FpsCounter(g);
        g.Components.Add(_fpsCounter);

        // Initialize TimeRuler and add it to compoentns.
        _currentRuler = new TimeRuler(g);
        g.Components.Add(_currentRuler);
    }