mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Restore per-thread zone list functionality.
This commit is contained in:
parent
d08c10c5b6
commit
77fa8f54a6
@ -2729,6 +2729,7 @@ void View::DrawFindZone()
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if( ImGui::TreeNode( "Matched source locations" ) )
|
if( ImGui::TreeNode( "Matched source locations" ) )
|
||||||
{
|
{
|
||||||
|
auto prev = m_findZone.selMatch;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for( auto& v : m_findZone.match )
|
for( auto& v : m_findZone.match )
|
||||||
{
|
{
|
||||||
@ -2741,6 +2742,11 @@ void View::DrawFindZone()
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
|
|
||||||
|
if( m_findZone.selMatch != prev )
|
||||||
|
{
|
||||||
|
m_findZone.ResetThreads();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@ -3091,6 +3097,7 @@ void View::DrawFindZone()
|
|||||||
if( ImGui::IsMouseClicked( 1 ) )
|
if( ImGui::IsMouseClicked( 1 ) )
|
||||||
{
|
{
|
||||||
m_findZone.highlight.active = false;
|
m_findZone.highlight.active = false;
|
||||||
|
m_findZone.ResetThreads();
|
||||||
}
|
}
|
||||||
else if( ImGui::IsMouseClicked( 0 ) )
|
else if( ImGui::IsMouseClicked( 0 ) )
|
||||||
{
|
{
|
||||||
@ -3101,6 +3108,7 @@ void View::DrawFindZone()
|
|||||||
else if( ImGui::IsMouseDragging( 0, 0 ) )
|
else if( ImGui::IsMouseDragging( 0, 0 ) )
|
||||||
{
|
{
|
||||||
m_findZone.highlight.end = t1 > m_findZone.highlight.start ? t1 : t0;
|
m_findZone.highlight.end = t1 > m_findZone.highlight.start ? t1 : t0;
|
||||||
|
m_findZone.ResetThreads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3134,24 +3142,45 @@ void View::DrawFindZone()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
#if 0
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text( "Found zones:" );
|
ImGui::Text( "Found zones:" );
|
||||||
|
|
||||||
for( size_t i=0; i<m_findZone.result.size(); i++ )
|
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] );
|
||||||
|
auto sz = zones.size();
|
||||||
|
for( size_t i=m_findZone.processed; i<sz; i++ )
|
||||||
{
|
{
|
||||||
auto& v = m_findZone.result[i];
|
auto& ev = zones[i];
|
||||||
|
|
||||||
ImGui::PushID( int( i ) );
|
const auto end = m_worker.GetZoneEndDirect( *ev );
|
||||||
const bool expand = ImGui::TreeNode( m_worker.GetThreadString( v->id ) );
|
const auto timespan = end - ev->start;
|
||||||
|
|
||||||
|
if( m_findZone.highlight.active )
|
||||||
|
{
|
||||||
|
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
|
||||||
|
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
||||||
|
if( timespan < s || timespan > e ) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto thread = GetZoneThread( *ev );
|
||||||
|
if( thread != 0 )
|
||||||
|
{
|
||||||
|
m_findZone.threads[thread].emplace_back( ev );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_findZone.processed = sz;
|
||||||
|
|
||||||
|
int idx = 0;
|
||||||
|
for( auto& v : m_findZone.threads )
|
||||||
|
{
|
||||||
|
ImGui::PushID( idx++ );
|
||||||
|
const bool expand = ImGui::TreeNode( m_worker.GetThreadString( v.first ) );
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( m_findZone.counts[i], true ) );
|
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( v.second.size(), true ) );
|
||||||
|
|
||||||
if( expand )
|
if( expand )
|
||||||
{
|
{
|
||||||
ImGui::Columns( 3, m_worker.GetThreadString( v->id ) );
|
ImGui::Columns( 3, m_worker.GetThreadString( v.first ) );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text( "Name" );
|
ImGui::Text( "Name" );
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
@ -3162,18 +3191,11 @@ void View::DrawFindZone()
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
uint32_t cnt = 0;
|
uint32_t cnt = 0;
|
||||||
for( auto& ev : v->timeline )
|
for( auto& ev : v.second )
|
||||||
{
|
{
|
||||||
const auto end = m_worker.GetZoneEndDirect( *ev );
|
const auto end = m_worker.GetZoneEndDirect( *ev );
|
||||||
const auto timespan = end - ev->start;
|
const auto timespan = end - ev->start;
|
||||||
|
|
||||||
if( m_findZone.highlight.active )
|
|
||||||
{
|
|
||||||
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
|
|
||||||
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
|
||||||
if( timespan < s || timespan > e ) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::PushID( ev );
|
ImGui::PushID( ev );
|
||||||
|
|
||||||
auto& srcloc = m_worker.GetSourceLocation( ev->srcloc );
|
auto& srcloc = m_worker.GetSourceLocation( ev->srcloc );
|
||||||
@ -3204,27 +3226,8 @@ void View::DrawFindZone()
|
|||||||
ImGui::Columns( 1 );
|
ImGui::Columns( 1 );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
|
|
||||||
m_findZone.counts[i] = cnt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto cnt = uint32_t( v->timeline.size() );
|
|
||||||
if( m_findZone.highlight.active )
|
|
||||||
{
|
|
||||||
for( auto& ev : v->timeline )
|
|
||||||
{
|
|
||||||
const auto end = m_worker.GetZoneEndDirect( *ev );
|
|
||||||
const auto timespan = end - ev->start;
|
|
||||||
const auto s = std::min( m_findZone.highlight.start, m_findZone.highlight.end );
|
|
||||||
const auto e = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
|
||||||
if( timespan < s || timespan > e ) cnt--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_findZone.counts[i] = cnt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -169,8 +169,9 @@ private:
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool show;
|
bool show;
|
||||||
std::vector<uint32_t> counts;
|
|
||||||
std::vector<int32_t> match;
|
std::vector<int32_t> match;
|
||||||
|
std::map<uint64_t, std::vector<ZoneEvent*>> threads;
|
||||||
|
size_t processed;
|
||||||
int selMatch = 0;
|
int selMatch = 0;
|
||||||
char pattern[1024] = { "" };
|
char pattern[1024] = { "" };
|
||||||
bool logVal = false;
|
bool logVal = false;
|
||||||
@ -180,11 +181,17 @@ private:
|
|||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
|
ResetThreads();
|
||||||
match.clear();
|
match.clear();
|
||||||
counts.clear();
|
|
||||||
selMatch = 0;
|
selMatch = 0;
|
||||||
highlight.active = false;
|
highlight.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetThreads()
|
||||||
|
{
|
||||||
|
threads.clear();
|
||||||
|
processed = 0;
|
||||||
|
}
|
||||||
} m_findZone;
|
} m_findZone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user