mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Update item counts in thread list.
This commit is contained in:
parent
3dd14c9e01
commit
f510d8d2e7
@ -2708,7 +2708,6 @@ void View::DrawFindZone()
|
|||||||
if( v.second != tmp )
|
if( v.second != tmp )
|
||||||
{
|
{
|
||||||
v.second = tmp;
|
v.second = tmp;
|
||||||
m_findZone.result.clear();
|
|
||||||
RecalcFindMatches();
|
RecalcFindMatches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3011,14 +3010,15 @@ void View::DrawFindZone()
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text( "Found zones:" );
|
ImGui::Text( "Found zones:" );
|
||||||
|
|
||||||
int idx = 0;
|
for( size_t i=0; i<m_findZone.result.size(); i++ )
|
||||||
for( auto& v : m_findZone.result )
|
|
||||||
{
|
{
|
||||||
ImGui::PushID( idx++ );
|
auto& v = m_findZone.result[i];
|
||||||
|
|
||||||
|
ImGui::PushID( int( i ) );
|
||||||
const bool expand = ImGui::TreeNode( m_worker.GetThreadString( v->id ) );
|
const bool expand = ImGui::TreeNode( m_worker.GetThreadString( v->id ) );
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( v->timeline.size(), true ) );
|
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( m_findZone.counts[i], true ) );
|
||||||
|
|
||||||
if( expand )
|
if( expand )
|
||||||
{
|
{
|
||||||
@ -3032,6 +3032,7 @@ void View::DrawFindZone()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
uint32_t cnt = 0;
|
||||||
for( auto& ev : v->timeline )
|
for( auto& ev : v->timeline )
|
||||||
{
|
{
|
||||||
const auto end = m_worker.GetZoneEnd( *ev );
|
const auto end = m_worker.GetZoneEnd( *ev );
|
||||||
@ -3069,10 +3070,29 @@ void View::DrawFindZone()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
cnt++;
|
||||||
}
|
}
|
||||||
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.GetZoneEnd( *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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3329,6 +3349,9 @@ void View::FindZones()
|
|||||||
|
|
||||||
void View::RecalcFindMatches()
|
void View::RecalcFindMatches()
|
||||||
{
|
{
|
||||||
|
m_findZone.result.clear();
|
||||||
|
m_findZone.counts.clear();
|
||||||
|
|
||||||
for( const auto& v : m_worker.GetThreadData() )
|
for( const auto& v : m_worker.GetThreadData() )
|
||||||
{
|
{
|
||||||
auto thrOut = std::make_unique<ThreadData>();
|
auto thrOut = std::make_unique<ThreadData>();
|
||||||
@ -3337,7 +3360,8 @@ void View::RecalcFindMatches()
|
|||||||
if( !thrOut->timeline.empty() )
|
if( !thrOut->timeline.empty() )
|
||||||
{
|
{
|
||||||
thrOut->id = v->id;
|
thrOut->id = v->id;
|
||||||
m_findZone.result.push_back( std::move( thrOut ) );
|
m_findZone.counts.emplace_back( thrOut->timeline.size() );
|
||||||
|
m_findZone.result.emplace_back( std::move( thrOut ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,6 +169,7 @@ private:
|
|||||||
struct {
|
struct {
|
||||||
bool show;
|
bool show;
|
||||||
std::vector<std::unique_ptr<ThreadData>> result;
|
std::vector<std::unique_ptr<ThreadData>> result;
|
||||||
|
std::vector<uint32_t> counts;
|
||||||
flat_hash_map<int32_t, bool> match;
|
flat_hash_map<int32_t, bool> match;
|
||||||
char pattern[1024] = { "" };
|
char pattern[1024] = { "" };
|
||||||
int maxZonesPerThread = -1;
|
int maxZonesPerThread = -1;
|
||||||
@ -181,6 +182,7 @@ private:
|
|||||||
{
|
{
|
||||||
result.clear();
|
result.clear();
|
||||||
match.clear();
|
match.clear();
|
||||||
|
counts.clear();
|
||||||
highlight.active = false;
|
highlight.active = false;
|
||||||
}
|
}
|
||||||
} m_findZone;
|
} m_findZone;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user