Implement grouping zones by zone name.

This commit is contained in:
Bartosz Taudul 2020-07-04 12:36:04 +02:00
parent 1975c1897d
commit 925bf7e638
2 changed files with 35 additions and 1 deletions

View File

@ -8730,6 +8730,13 @@ uint64_t View::GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::G
const auto& extra = m_worker.GetZoneExtra( zone );
return extra.text.Active() ? extra.text.Idx() : std::numeric_limits<uint64_t>::max();
}
case FindZone::GroupBy::ZoneName:
{
const auto& zone = *ev.Zone();
if( !m_worker.HasZoneExtra( zone ) ) return std::numeric_limits<uint64_t>::max();
const auto& extra = m_worker.GetZoneExtra( zone );
return extra.name.Active() ? extra.name.Idx() : std::numeric_limits<uint64_t>::max();
}
case FindZone::GroupBy::Callstack:
return m_worker.GetZoneExtra( *ev.Zone() ).callstack.Val();
case FindZone::GroupBy::Parent:
@ -9875,6 +9882,8 @@ void View::DrawFindZone()
ImGui::SameLine();
groupChanged |= ImGui::RadioButton( "User text", (int*)( &m_findZone.groupBy ), (int)FindZone::GroupBy::UserText );
ImGui::SameLine();
groupChanged |= ImGui::RadioButton( "Zone name", (int*)( &m_findZone.groupBy ), (int)FindZone::GroupBy::ZoneName );
ImGui::SameLine();
groupChanged |= ImGui::RadioButton( "Call stacks", (int*)( &m_findZone.groupBy ), (int)FindZone::GroupBy::Callstack );
ImGui::SameLine();
groupChanged |= ImGui::RadioButton( "Parent", (int*)( &m_findZone.groupBy ), (int)FindZone::GroupBy::Parent );
@ -9965,6 +9974,20 @@ void View::DrawFindZone()
}
break;
}
case FindZone::GroupBy::ZoneName:
{
const auto& zone = *ev.Zone();
if( !m_worker.HasZoneExtra( zone ) )
{
gid = std::numeric_limits<uint64_t>::max();
}
else
{
const auto& extra = m_worker.GetZoneExtra( zone );
gid = extra.name.Active() ? extra.name.Idx() : std::numeric_limits<uint64_t>::max();
}
break;
}
case FindZone::GroupBy::Callstack:
gid = m_worker.GetZoneExtra( *ev.Zone() ).callstack.Val();
break;
@ -10150,6 +10173,17 @@ void View::DrawFindZone()
case FindZone::GroupBy::UserText:
hdrString = v->first == std::numeric_limits<uint64_t>::max() ? "No user text" : m_worker.GetString( StringIdx( v->first ) );
break;
case FindZone::GroupBy::ZoneName:
if( v->first == std::numeric_limits<uint64_t>::max() )
{
auto& srcloc = m_worker.GetSourceLocation( m_findZone.match[m_findZone.selMatch] );
hdrString = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function );
}
else
{
hdrString = m_worker.GetString( StringIdx( v->first ) );
}
break;
case FindZone::GroupBy::Callstack:
if( v->first == 0 )
{

View File

@ -439,7 +439,7 @@ private:
struct FindZone {
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
enum class GroupBy : int { Thread, UserText, Callstack, Parent, NoGrouping };
enum class GroupBy : int { Thread, UserText, ZoneName, Callstack, Parent, NoGrouping };
enum class SortBy : int { Order, Count, Time, Mtpc };
enum class TableSortBy : int { Starttime, Runtime, Name };