From ed9aaba05570c6a427af9761a094ca31d4e8ae9f Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 17 Aug 2024 00:10:03 +0200 Subject: [PATCH] Fix profiler window tabs layout for charts --- Source/Editor/Windows/Profiler/Assets.cs | 2 ++ Source/Editor/Windows/Profiler/CPU.cs | 2 ++ Source/Editor/Windows/Profiler/GPU.cs | 2 ++ Source/Editor/Windows/Profiler/MemoryGPU.cs | 4 +++- Source/Editor/Windows/Profiler/SingleChart.cs | 3 ++- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Windows/Profiler/Assets.cs b/Source/Editor/Windows/Profiler/Assets.cs index d5b735fa3..3cd66e4eb 100644 --- a/Source/Editor/Windows/Profiler/Assets.cs +++ b/Source/Editor/Windows/Profiler/Assets.cs @@ -50,6 +50,8 @@ namespace FlaxEditor.Windows.Profiler { Title = "Assets Memory Usage (CPU)", AnchorPreset = AnchorPresets.HorizontalStretchTop, + Offsets = Margin.Zero, + Height = SingleChart.DefaultHeight, FormatSample = v => Utilities.Utils.FormatBytesCount((int)v), Parent = mainPanel, }; diff --git a/Source/Editor/Windows/Profiler/CPU.cs b/Source/Editor/Windows/Profiler/CPU.cs index 5246957f6..ff9b0e253 100644 --- a/Source/Editor/Windows/Profiler/CPU.cs +++ b/Source/Editor/Windows/Profiler/CPU.cs @@ -69,6 +69,8 @@ namespace FlaxEditor.Windows.Profiler { Title = "Update", AnchorPreset = AnchorPresets.HorizontalStretchTop, + Offsets = Margin.Zero, + Height = SingleChart.DefaultHeight, FormatSample = v => (Mathf.RoundToInt(v * 10.0f) / 10.0f) + " ms", Parent = mainPanel, }; diff --git a/Source/Editor/Windows/Profiler/GPU.cs b/Source/Editor/Windows/Profiler/GPU.cs index dd90f891b..7b837768f 100644 --- a/Source/Editor/Windows/Profiler/GPU.cs +++ b/Source/Editor/Windows/Profiler/GPU.cs @@ -37,6 +37,8 @@ namespace FlaxEditor.Windows.Profiler { Title = "Draw (CPU)", AnchorPreset = AnchorPresets.HorizontalStretchTop, + Offsets = Margin.Zero, + Height = SingleChart.DefaultHeight, FormatSample = v => (Mathf.RoundToInt(v * 10.0f) / 10.0f) + " ms", Parent = mainPanel, }; diff --git a/Source/Editor/Windows/Profiler/MemoryGPU.cs b/Source/Editor/Windows/Profiler/MemoryGPU.cs index 00f24821a..dd3c6d6ea 100644 --- a/Source/Editor/Windows/Profiler/MemoryGPU.cs +++ b/Source/Editor/Windows/Profiler/MemoryGPU.cs @@ -51,7 +51,9 @@ namespace FlaxEditor.Windows.Profiler { Title = "GPU Memory Usage", AnchorPreset = AnchorPresets.HorizontalStretchTop, - FormatSample = v => Utilities.Utils.FormatBytesCount((int)v), + Offsets = Margin.Zero, + Height = SingleChart.DefaultHeight, + FormatSample = v => Utilities.Utils.FormatBytesCount((ulong)v), Parent = mainPanel, }; _memoryUsageChart.SelectedSampleChanged += OnSelectedSampleChanged; diff --git a/Source/Editor/Windows/Profiler/SingleChart.cs b/Source/Editor/Windows/Profiler/SingleChart.cs index 4985d88e1..cd24ac635 100644 --- a/Source/Editor/Windows/Profiler/SingleChart.cs +++ b/Source/Editor/Windows/Profiler/SingleChart.cs @@ -12,6 +12,7 @@ namespace FlaxEditor.Windows.Profiler /// internal class SingleChart : Control { + internal const float DefaultHeight = TitleHeight + 60; private const float TitleHeight = 20; private const float PointsOffset = 4; private readonly SamplesBuffer _samples; @@ -63,7 +64,7 @@ namespace FlaxEditor.Windows.Profiler /// /// The maximum samples to collect. public SingleChart(int maxSamples = ProfilerMode.MaxSamples) - : base(0, 0, 100, 60 + TitleHeight) + : base(0, 0, 100, DefaultHeight) { _samples = new SamplesBuffer(maxSamples); _sample = string.Empty;