1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-03 14:03:52 +00:00

Only display results for a single source location match.

This commit is contained in:
Bartosz Taudul 2018-03-18 16:07:07 +01:00
parent 3207861869
commit af3559afed
2 changed files with 52 additions and 68 deletions

View File

@ -2732,14 +2732,12 @@ void View::DrawFindZone()
int idx = 0;
for( auto& v : m_findZone.match )
{
auto& srcloc = m_worker.GetSourceLocation( v.first );
bool tmp = v.second;
ImGui::PushID( idx++ );
ImGui::Checkbox( m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ), &tmp );
auto& srcloc = m_worker.GetSourceLocation( v );
ImGui::PushID( idx );
ImGui::RadioButton( m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ), &m_findZone.selMatch, idx++ );
ImGui::SameLine();
ImGui::TextColored( ImVec4( 0.5, 0.5, 0.5, 1 ), "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
ImGui::PopID();
if( v.second != tmp ) v.second = tmp;
}
ImGui::TreePop();
}
@ -2753,10 +2751,7 @@ void View::DrawFindZone()
int64_t tmin = std::numeric_limits<int64_t>::max();
int64_t tmax = std::numeric_limits<int64_t>::min();
for( auto& v : m_findZone.match )
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
for( auto& ev : zones )
{
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2766,7 +2761,6 @@ void View::DrawFindZone()
tmax = std::max( tmax, timeSpan );
}
}
}
if( tmin != std::numeric_limits<int64_t>::max() )
{
@ -2811,10 +2805,7 @@ void View::DrawFindZone()
{
const auto tMinLog = log10( tmin );
const auto idt = numBins / ( log10( tmax ) - tMinLog );
for( auto& v : m_findZone.match )
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
for( auto& ev : zones )
{
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2827,14 +2818,10 @@ void View::DrawFindZone()
}
}
}
}
else
{
const auto idt = numBins / dt;
for( auto& v : m_findZone.match )
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
for( auto& ev : zones )
{
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2848,17 +2835,13 @@ void View::DrawFindZone()
}
}
}
}
else
{
if( m_findZone.logTime )
{
const auto tMinLog = log10( tmin );
const auto idt = numBins / ( log10( tmax ) - tMinLog );
for( auto& v : m_findZone.match )
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
for( auto& ev : zones )
{
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2870,14 +2853,10 @@ void View::DrawFindZone()
}
}
}
}
else
{
const auto idt = numBins / dt;
for( auto& v : m_findZone.match )
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
for( auto& ev : zones )
{
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2890,7 +2869,6 @@ void View::DrawFindZone()
}
}
}
}
int64_t timeTotal = binTime[0];
int64_t maxVal;
@ -3488,15 +3466,19 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
#ifndef TRACY_NO_STATISTICS
void View::FindZones()
{
const auto match = m_worker.GetMatchingSourceLocation( m_findZone.pattern );
if( match.empty() ) return;
m_findZone.match = m_worker.GetMatchingSourceLocation( m_findZone.pattern );
if( m_findZone.match.empty() ) return;
m_findZone.match.reserve( match.size() );
for( auto& v : match )
auto it = m_findZone.match.begin();
while( it != m_findZone.match.end() )
{
if( !m_worker.GetZonesForSourceLocation( v ).empty() )
if( m_worker.GetZonesForSourceLocation( *it ).empty() )
{
m_findZone.match.emplace( v, true );
it = m_findZone.match.erase( it );
}
else
{
++it;
}
}
}

View File

@ -169,7 +169,8 @@ private:
struct {
bool show;
std::vector<uint32_t> counts;
flat_hash_map<int32_t, bool> match;
std::vector<int32_t> match;
int selMatch = 0;
char pattern[1024] = { "" };
bool logVal = false;
bool logTime = false;
@ -180,6 +181,7 @@ private:
{
match.clear();
counts.clear();
selMatch = 0;
highlight.active = false;
}
} m_findZone;