Allow grouping zones by parent.

This commit is contained in:
Bartosz Taudul 2019-10-31 14:50:29 +01:00
parent c0df3dd965
commit 978071f2ba
2 changed files with 32 additions and 1 deletions

View File

@ -7601,6 +7601,11 @@ uint64_t View::GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::G
return ev.Zone()->text.Active() ? ev.Zone()->text.Idx() : std::numeric_limits<uint64_t>::max();
case FindZone::GroupBy::Callstack:
return ev.Zone()->callstack.Val();
case FindZone::GroupBy::Parent:
{
const auto parent = GetZoneParent( *ev.Zone(), m_worker.DecompressThread( ev.Thread() ) );
return parent ? uint64_t( parent->SrcLoc() ) : 0;
}
case FindZone::GroupBy::NoGrouping:
return 0;
default:
@ -8561,6 +8566,8 @@ void View::DrawFindZone()
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 );
ImGui::SameLine();
groupChanged |= ImGui::RadioButton( "No grouping", (int*)( &m_findZone.groupBy ), (int)FindZone::GroupBy::NoGrouping );
if( groupChanged )
{
@ -8635,6 +8642,19 @@ void View::DrawFindZone()
case FindZone::GroupBy::Callstack:
group = &m_findZone.groups[ev.Zone()->callstack.Val()];
break;
case FindZone::GroupBy::Parent:
{
const auto parent = GetZoneParent( *ev.Zone(), m_worker.DecompressThread( ev.Thread() ) );
if( parent )
{
group = &m_findZone.groups[uint64_t( parent->SrcLoc() )];
}
else
{
group = &m_findZone.groups[0];
}
break;
}
case FindZone::GroupBy::NoGrouping:
group = &m_findZone.groups[0];
break;
@ -8828,6 +8848,17 @@ void View::DrawFindZone()
hdrString = m_worker.GetString( frameData.data[frameData.size-1].name );
}
break;
case FindZone::GroupBy::Parent:
if( v->first == 0 )
{
hdrString = "<no parent>";
}
else
{
auto srcloc = m_worker.GetSourceLocation( int16_t( v->first ) );
hdrString = m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function );
}
break;
case FindZone::GroupBy::NoGrouping:
hdrString = "Zone list";
break;

View File

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