Fix profiler window tabs layout for charts

This commit is contained in:
Wojtek Figat
2024-08-17 00:10:03 +02:00
parent cb106be710
commit ed9aaba055
5 changed files with 11 additions and 2 deletions

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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;

View File

@@ -12,6 +12,7 @@ namespace FlaxEditor.Windows.Profiler
/// <seealso cref="FlaxEngine.GUI.Control" />
internal class SingleChart : Control
{
internal const float DefaultHeight = TitleHeight + 60;
private const float TitleHeight = 20;
private const float PointsOffset = 4;
private readonly SamplesBuffer<float> _samples;
@@ -63,7 +64,7 @@ namespace FlaxEditor.Windows.Profiler
/// </summary>
/// <param name="maxSamples">The maximum samples to collect.</param>
public SingleChart(int maxSamples = ProfilerMode.MaxSamples)
: base(0, 0, 100, 60 + TitleHeight)
: base(0, 0, 100, DefaultHeight)
{
_samples = new SamplesBuffer<float>(maxSamples);
_sample = string.Empty;