Optimize Profiler window update to refresh only visible tab UI
This commit is contained in:
@@ -174,14 +174,6 @@ namespace FlaxEditor.Windows.Profiler
|
||||
// Gather CPU events
|
||||
var events = sharedData.GetEventsCPU();
|
||||
_events.Add(events);
|
||||
|
||||
// Update timeline if using the last frame
|
||||
if (_mainChart.SelectedSampleIndex == -1)
|
||||
{
|
||||
var viewRange = GetEventsViewRange();
|
||||
UpdateTimeline(ref viewRange);
|
||||
UpdateTable(ref viewRange);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -131,13 +131,6 @@ namespace FlaxEditor.Windows.Profiler
|
||||
// Peek draw time
|
||||
_drawTimeCPU.AddSample(sharedData.Stats.DrawCPUTimeMs);
|
||||
_drawTimeGPU.AddSample(sharedData.Stats.DrawGPUTimeMs);
|
||||
|
||||
// Update timeline if using the last frame
|
||||
if (_drawTimeCPU.SelectedSampleIndex == -1)
|
||||
{
|
||||
UpdateTimeline();
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace FlaxEditor.Windows.Profiler
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the selected frame to view (note: some view modes may not use it).
|
||||
/// Gets or sets the index of the selected frame to view (note: some view modes may not use it). -1 for the last frame.
|
||||
/// </summary>
|
||||
public int ViewFrameIndex
|
||||
{
|
||||
@@ -188,7 +188,7 @@ namespace FlaxEditor.Windows.Profiler
|
||||
for (int i = 0; i < _tabs.ChildrenCount; i++)
|
||||
{
|
||||
if (_tabs.Children[i] is ProfilerMode mode)
|
||||
mode.UpdateView(ViewFrameIndex, _showOnlyLastUpdateEvents);
|
||||
mode.UpdateView(_frameIndex, _showOnlyLastUpdateEvents);
|
||||
}
|
||||
|
||||
UpdateButtons();
|
||||
@@ -208,6 +208,10 @@ namespace FlaxEditor.Windows.Profiler
|
||||
if (_tabs.Children[i] is ProfilerMode mode)
|
||||
mode.Update(ref sharedData);
|
||||
}
|
||||
{
|
||||
if (_tabs.SelectedTab is ProfilerMode mode)
|
||||
mode.UpdateView(_frameIndex, _showOnlyLastUpdateEvents);
|
||||
}
|
||||
sharedData.End();
|
||||
|
||||
_framesCount = Mathf.Min(_framesCount + 1, ProfilerMode.MaxSamples);
|
||||
|
||||
Reference in New Issue
Block a user