Example #1
0
        public override void Draw(GameTime gameTime)
        {
            // Reset update count.
            Interlocked.Exchange(ref _updateCount, 0);

            TimeRuler.Draw(_prevLog);
            PerformanceGraph.Draw(_internalLabeler, _prevLog);
            ProfilerSummary.Draw(_internalLabeler, _prevLog);
        }
Example #2
0
        public ProfilerManager(IUserInterface userInterface)
            : base(GearsetSettings.Instance.ProfilerConfig)
        {
            _userInterface = userInterface;
            _userInterface.CreateProfiler(Config, 0, 0, 0);
            _userInterface.LevelItemChanged += (sender, args) =>
            {
                switch (args.Name)
                {
                case "TimeRuler":
                    TimeRuler.SetLevel(args.LevelId, args.Enabled);
                    Config.TimeRulerConfig.VisibleLevelsFlags = TimeRuler.VisibleLevelsFlags;
                    break;

                case "PerformanceGraph":
                    PerformanceGraph.SetLevel(args.LevelId, args.Enabled);
                    Config.PerformanceGraphConfig.VisibleLevelsFlags = PerformanceGraph.VisibleLevelsFlags;
                    break;

                case "ProfilerSummary":
                    ProfilerSummary.SetLevel(args.LevelId, args.Enabled);
                    Config.ProfilerSummaryConfig.VisibleLevelsFlags = ProfilerSummary.VisibleLevelsFlags;
                    break;
                }
            };

            RefreshSummary = true;

            LineDrawer = new InternalLineDrawer(64);
            Children.Add(LineDrawer);

            Children.Add(_internalLabeler);
            Children.Add(TempBoxDrawer);

            _logs = new FrameLog[2];
            for (var i = 0; i < _logs.Length; ++i)
            {
                _logs[i] = new FrameLog();
            }

            CreateTimeRuler();
            CreatePerformanceGraph();
            CreateProfilerSummary();
        }
Example #3
0
        void CreateTimeRuler()
        {
            TargetSampleFrames = 1;

            var minSize = new Vector2(100, 16);
            var size    = Vector2.Max(minSize, Config.TimeRulerConfig.Size);

            TimeRuler = new TimeRuler(this, Config.TimeRulerConfig, size, TargetSampleFrames);

            TimeRuler.Visible = Config.TimeRulerConfig.Visible;

            TimeRuler.VisibleChanged += (sender, args) => { Config.TimeRulerConfig.Visible = TimeRuler.Visible; };

            TimeRuler.LevelsEnabledChanged += (sender, args) => { Config.TimeRulerConfig.VisibleLevelsFlags = TimeRuler.VisibleLevelsFlags; };

            TimeRuler.Dragged += (object sender, ref Vector2 args) => { Config.TimeRulerConfig.Position = TimeRuler.Position; };

            TimeRuler.ScaleNob.Dragged += (object sender, ref Vector2 args) => { Config.TimeRulerConfig.Size = TimeRuler.Size; };
        }