mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 20:33:52 +00:00
Avoid useless work when there aren't any samples
This commit is contained in:
parent
1233b39b69
commit
41130d2a69
@ -10699,7 +10699,8 @@ void View::DrawFindZone()
|
|||||||
SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames );
|
SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if( ImGui::TreeNodeEx( "Samples", ImGuiTreeNodeFlags_None ) )
|
const bool hasSamples = m_worker.AreCallstackSamplesReady() && m_worker.GetCallstackSampleCount() > 0;
|
||||||
|
if( hasSamples && ImGui::TreeNodeEx( "Samples", ImGuiTreeNodeFlags_None ) )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
ImGui::Checkbox( ICON_FA_STOPWATCH " Show time", &m_statSampleTime );
|
ImGui::Checkbox( ICON_FA_STOPWATCH " Show time", &m_statSampleTime );
|
||||||
@ -10724,6 +10725,12 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !m_findZone.samplesCache.needZonesPerThread )
|
||||||
|
{
|
||||||
|
m_findZone.samplesCache.needZonesPerThread = true;
|
||||||
|
m_findZone.scheduleResetMatch = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( m_findZone.samplesCache.scheduleUpdate && !m_findZone.scheduleResetMatch )
|
if( m_findZone.samplesCache.scheduleUpdate && !m_findZone.scheduleResetMatch )
|
||||||
{
|
{
|
||||||
m_findZone.samplesCache.scheduleUpdate = false;
|
m_findZone.samplesCache.scheduleUpdate = false;
|
||||||
@ -10793,6 +10800,16 @@ void View::DrawFindZone()
|
|||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_findZone.samplesCache.needZonesPerThread )
|
||||||
|
{
|
||||||
|
m_findZone.samplesCache.needZonesPerThread = false;
|
||||||
|
m_findZone.samplesCache.scheduleUpdate = false;
|
||||||
|
m_findZone.samplesCache.counts = Vector<SymList>();
|
||||||
|
m_findZone.samplesCache.threads = unordered_flat_map<uint16_t, Vector<short_ptr<ZoneEvent>> >();
|
||||||
|
}
|
||||||
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::TextUnformatted( "Found zones:" );
|
ImGui::TextUnformatted( "Found zones:" );
|
||||||
@ -10953,6 +10970,9 @@ void View::DrawFindZone()
|
|||||||
group->time += timespan;
|
group->time += timespan;
|
||||||
group->zones.push_back_non_empty( ev.Zone() );
|
group->zones.push_back_non_empty( ev.Zone() );
|
||||||
|
|
||||||
|
|
||||||
|
if( m_findZone.samplesCache.needZonesPerThread )
|
||||||
|
{
|
||||||
if( lastTid != ev.Thread() )
|
if( lastTid != ev.Thread() )
|
||||||
{
|
{
|
||||||
lastTid = ev.Thread();
|
lastTid = ev.Thread();
|
||||||
@ -10962,6 +10982,7 @@ void View::DrawFindZone()
|
|||||||
threadZones->push_back_non_empty( ev.Zone() );
|
threadZones->push_back_non_empty( ev.Zone() );
|
||||||
m_findZone.samplesCache.scheduleUpdate = true;
|
m_findZone.samplesCache.scheduleUpdate = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_findZone.processed = zptr - zones.data();
|
m_findZone.processed = zptr - zones.data();
|
||||||
|
|
||||||
Vector<decltype( m_findZone.groups )::iterator> groups;
|
Vector<decltype( m_findZone.groups )::iterator> groups;
|
||||||
|
@ -567,6 +567,7 @@ private:
|
|||||||
Vector<SymList> counts;
|
Vector<SymList> counts;
|
||||||
int64_t timeRange = 0;
|
int64_t timeRange = 0;
|
||||||
bool scheduleUpdate = false;
|
bool scheduleUpdate = false;
|
||||||
|
bool needZonesPerThread = false;
|
||||||
} samplesCache;
|
} samplesCache;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user