mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add ability to group zones by user text.
This commit is contained in:
parent
05eb4b7ebc
commit
0d831e452b
@ -3154,6 +3154,23 @@ void View::DrawFindZone()
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text( "Found zones:" );
|
ImGui::Text( "Found zones:" );
|
||||||
|
ImGui::SameLine();
|
||||||
|
if( m_findZone.showThreads )
|
||||||
|
{
|
||||||
|
if( ImGui::SmallButton( "Group by user text" ) )
|
||||||
|
{
|
||||||
|
m_findZone.showThreads = false;
|
||||||
|
m_findZone.ResetThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ImGui::SmallButton( "Group by threads" ) )
|
||||||
|
{
|
||||||
|
m_findZone.showThreads = true;
|
||||||
|
m_findZone.ResetThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] ).zones;
|
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] ).zones;
|
||||||
auto sz = zones.size();
|
auto sz = zones.size();
|
||||||
@ -3183,23 +3200,39 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
m_findZone.threads[ev.thread].push_back( ev.zone );
|
if( m_findZone.showThreads )
|
||||||
|
{
|
||||||
|
m_findZone.threads[ev.thread].push_back( ev.zone );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const uint64_t id = ev.zone->text.active ? ev.zone->text.idx : std::numeric_limits<uint64_t>::max();
|
||||||
|
m_findZone.threads[id].push_back( ev.zone );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_findZone.processed = processed;
|
m_findZone.processed = processed;
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for( auto& v : m_findZone.threads )
|
for( auto& v : m_findZone.threads )
|
||||||
{
|
{
|
||||||
auto threadString = m_worker.GetThreadString( m_worker.DecompressThread( v.first ) );
|
const char* hdrString;
|
||||||
|
if( m_findZone.showThreads )
|
||||||
|
{
|
||||||
|
hdrString = m_worker.GetThreadString( m_worker.DecompressThread( v.first ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hdrString = v.first == std::numeric_limits<uint64_t>::max() ? "No user text" : m_worker.GetString( StringIdx( v.first ) );
|
||||||
|
}
|
||||||
ImGui::PushID( idx++ );
|
ImGui::PushID( idx++ );
|
||||||
const bool expand = ImGui::TreeNode( threadString );
|
const bool expand = ImGui::TreeNode( hdrString );
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( v.second.size(), 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, threadString );
|
ImGui::Columns( 3, hdrString );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text( "Name" );
|
ImGui::Text( "Name" );
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
|
|||||||
@ -177,6 +177,7 @@ private:
|
|||||||
bool logVal = false;
|
bool logVal = false;
|
||||||
bool logTime = false;
|
bool logTime = false;
|
||||||
bool cumulateTime = false;
|
bool cumulateTime = false;
|
||||||
|
bool showThreads = true;
|
||||||
Region highlight;
|
Region highlight;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user