diff --git a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs index 50516ee730..3edc0e88e0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs @@ -23,11 +23,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Perf text var perfText = perfRoot.Get("TEXT"); + perfText.IsVisible = () => Game.Settings.Debug.PerfText; perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F( Game.RenderFrame, Game.NetFrameNumber, - PerfHistory.items["render"].LastValue, - PerfHistory.items["tick_time"].LastValue, + PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), + PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), Game.LocalTick, PerfHistory.items["batches"].LastValue); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs index f9181555ad..b221a1b809 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs @@ -195,14 +195,30 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Debug var debug = bg.Get("DEBUG_PANE"); - var perfgraphCheckbox = debug.Get("PERFDEBUG_CHECKBOX"); + var perfgraphCheckbox = debug.Get("PERFGRAPH_CHECKBOX"); perfgraphCheckbox.IsChecked = () => Game.Settings.Debug.PerfGraph; perfgraphCheckbox.OnClick = () => Game.Settings.Debug.PerfGraph ^= true; + var perftextCheckbox = debug.Get("PERFTEXT_CHECKBOX"); + perftextCheckbox.IsChecked = () => Game.Settings.Debug.PerfText; + perftextCheckbox.OnClick = () => Game.Settings.Debug.PerfText ^= true; + + var sampleSlider = debug.Get("PERFTEXT_SAMPLE_AMOUNT"); + sampleSlider.Value = sampleSlider.MaximumValue-Game.Settings.Debug.Samples; + sampleSlider.OnChange += x => Game.Settings.Debug.Samples = (int)sampleSlider.MaximumValue-(int)Math.Round(x); + var checkunsyncedCheckbox = debug.Get("CHECKUNSYNCED_CHECKBOX"); checkunsyncedCheckbox.IsChecked = () => Game.Settings.Debug.SanityCheckUnsyncedCode; checkunsyncedCheckbox.OnClick = () => Game.Settings.Debug.SanityCheckUnsyncedCode ^= true; + var botdebugCheckbox = debug.Get("BOTDEBUG_CHECKBOX"); + botdebugCheckbox.IsChecked = () => Game.Settings.Debug.BotDebug; + botdebugCheckbox.OnClick = () => Game.Settings.Debug.BotDebug ^= true; + + var longTickThreshold = debug.Get("LONG_TICK_THRESHOLD"); + longTickThreshold.Value = Game.Settings.Debug.LongTickThreshold; + longTickThreshold.OnChange += x => Game.Settings.Debug.LongTickThreshold = x; + bg.Get("BUTTON_CLOSE").OnClick = () => { int x, y; diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index 4932645382..faad83f65e 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -332,15 +332,51 @@ Background@SETTINGS_MENU: Height:PARENT_BOTTOM - 100 Visible: false Children: - Checkbox@PERFDEBUG_CHECKBOX: + Checkbox@PERFGRAPH_CHECKBOX: X:0 Y:0 Width:300 Height:20 - Text:Show Performance Information - Checkbox@CHECKUNSYNCED_CHECKBOX: + Text:Show Performance Graph + Checkbox@PERFTEXT_CHECKBOX: X:0 Y:30 Width:300 Height:20 + Text:Show Performance Text + Label@PERFTEXT_SAMPLE_LABEL: + X:30 + Y:70 + Text:Update Rate + Slider@PERFTEXT_SAMPLE_AMOUNT: + X:130 + Y:60 + Width:250 + Height:20 + Ticks:5 + MinimumValue: 1 + MaximumValue: 50 + Checkbox@CHECKUNSYNCED_CHECKBOX: + X:0 + Y:90 + Width:300 + Height:20 Text:Check Sync around Unsynced Code + Checkbox@BOTDEBUG_CHECKBOX: + X:0 + Y:120 + Width:300 + Height:20 + Text:Show Bot Debug Messages + Label@PERFTEXT_SAMPLE_LABEL: + X:0 + Y:160 + Text:Slow Trait Report Threshold in (mili)seconds + Slider@LONG_TICK_THRESHOLD: + X:0 + Y:170 + Width:380 + Height:20 + Ticks:25 + MinimumValue: 0.0001 + MaximumValue: 0.01