1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-03 22:13:51 +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; int idx = 0;
for( auto& v : m_findZone.match ) for( auto& v : m_findZone.match )
{ {
auto& srcloc = m_worker.GetSourceLocation( v.first ); auto& srcloc = m_worker.GetSourceLocation( v );
bool tmp = v.second; ImGui::PushID( idx );
ImGui::PushID( idx++ ); ImGui::RadioButton( m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ), &m_findZone.selMatch, idx++ );
ImGui::Checkbox( m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ), &tmp );
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextColored( ImVec4( 0.5, 0.5, 0.5, 1 ), "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); ImGui::TextColored( ImVec4( 0.5, 0.5, 0.5, 1 ), "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
ImGui::PopID(); ImGui::PopID();
if( v.second != tmp ) v.second = tmp;
} }
ImGui::TreePop(); ImGui::TreePop();
} }
@ -2753,10 +2751,7 @@ void View::DrawFindZone()
int64_t tmin = std::numeric_limits<int64_t>::max(); int64_t tmin = std::numeric_limits<int64_t>::max();
int64_t tmax = std::numeric_limits<int64_t>::min(); int64_t tmax = std::numeric_limits<int64_t>::min();
for( auto& v : m_findZone.match ) auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
for( auto& ev : zones ) for( auto& ev : zones )
{ {
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start; const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2766,7 +2761,6 @@ void View::DrawFindZone()
tmax = std::max( tmax, timeSpan ); tmax = std::max( tmax, timeSpan );
} }
} }
}
if( tmin != std::numeric_limits<int64_t>::max() ) if( tmin != std::numeric_limits<int64_t>::max() )
{ {
@ -2811,10 +2805,7 @@ void View::DrawFindZone()
{ {
const auto tMinLog = log10( tmin ); const auto tMinLog = log10( tmin );
const auto idt = numBins / ( log10( tmax ) - tMinLog ); const auto idt = numBins / ( log10( tmax ) - tMinLog );
for( auto& v : m_findZone.match ) auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
for( auto& ev : zones ) for( auto& ev : zones )
{ {
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start; const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2827,14 +2818,10 @@ void View::DrawFindZone()
} }
} }
} }
}
else else
{ {
const auto idt = numBins / dt; const auto idt = numBins / dt;
for( auto& v : m_findZone.match ) auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
for( auto& ev : zones ) for( auto& ev : zones )
{ {
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start; const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2848,17 +2835,13 @@ void View::DrawFindZone()
} }
} }
} }
}
else else
{ {
if( m_findZone.logTime ) if( m_findZone.logTime )
{ {
const auto tMinLog = log10( tmin ); const auto tMinLog = log10( tmin );
const auto idt = numBins / ( log10( tmax ) - tMinLog ); const auto idt = numBins / ( log10( tmax ) - tMinLog );
for( auto& v : m_findZone.match ) auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
for( auto& ev : zones ) for( auto& ev : zones )
{ {
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start; const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2870,14 +2853,10 @@ void View::DrawFindZone()
} }
} }
} }
}
else else
{ {
const auto idt = numBins / dt; const auto idt = numBins / dt;
for( auto& v : m_findZone.match ) auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
{
if( !v.second ) continue;
auto& zones = m_worker.GetZonesForSourceLocation( v.first );
for( auto& ev : zones ) for( auto& ev : zones )
{ {
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start; const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
@ -2890,7 +2869,6 @@ void View::DrawFindZone()
} }
} }
} }
}
int64_t timeTotal = binTime[0]; int64_t timeTotal = binTime[0];
int64_t maxVal; int64_t maxVal;
@ -3488,15 +3466,19 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
#ifndef TRACY_NO_STATISTICS #ifndef TRACY_NO_STATISTICS
void View::FindZones() void View::FindZones()
{ {
const auto match = m_worker.GetMatchingSourceLocation( m_findZone.pattern ); m_findZone.match = m_worker.GetMatchingSourceLocation( m_findZone.pattern );
if( match.empty() ) return; if( m_findZone.match.empty() ) return;
m_findZone.match.reserve( match.size() ); auto it = m_findZone.match.begin();
for( auto& v : match ) 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 { struct {
bool show; bool show;
std::vector<uint32_t> counts; std::vector<uint32_t> counts;
flat_hash_map<int32_t, bool> match; std::vector<int32_t> match;
int selMatch = 0;
char pattern[1024] = { "" }; char pattern[1024] = { "" };
bool logVal = false; bool logVal = false;
bool logTime = false; bool logTime = false;
@ -180,6 +181,7 @@ private:
{ {
match.clear(); match.clear();
counts.clear(); counts.clear();
selMatch = 0;
highlight.active = false; highlight.active = false;
} }
} m_findZone; } m_findZone;