mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Time range limits for wait stacks.
This commit is contained in:
parent
94d4272c9c
commit
0c7c3ae641
@ -1123,6 +1123,12 @@ bool View::DrawImpl()
|
|||||||
m_statRange.min = s;
|
m_statRange.min = s;
|
||||||
m_statRange.max = e;
|
m_statRange.max = e;
|
||||||
}
|
}
|
||||||
|
if( ImGui::Selectable( ICON_FA_HOURGLASS_HALF " Limit wait stack range" ) )
|
||||||
|
{
|
||||||
|
m_waitStackRange.active = true;
|
||||||
|
m_waitStackRange.min = s;
|
||||||
|
m_waitStackRange.max = e;
|
||||||
|
}
|
||||||
if( ImGui::Selectable( ICON_FA_STICKY_NOTE " Add annotation" ) )
|
if( ImGui::Selectable( ICON_FA_STICKY_NOTE " Add annotation" ) )
|
||||||
{
|
{
|
||||||
auto ann = std::make_unique<Annotation>();
|
auto ann = std::make_unique<Annotation>();
|
||||||
@ -2850,6 +2856,7 @@ void View::DrawZones()
|
|||||||
m_zoneHover2.Decay( nullptr );
|
m_zoneHover2.Decay( nullptr );
|
||||||
m_findZone.range.StartFrame();
|
m_findZone.range.StartFrame();
|
||||||
m_statRange.StartFrame();
|
m_statRange.StartFrame();
|
||||||
|
m_waitStackRange.StartFrame();
|
||||||
m_yDelta = 0;
|
m_yDelta = 0;
|
||||||
|
|
||||||
if( m_vd.zvStart == m_vd.zvEnd ) return;
|
if( m_vd.zvStart == m_vd.zvEnd ) return;
|
||||||
@ -2888,6 +2895,7 @@ void View::DrawZones()
|
|||||||
{
|
{
|
||||||
HandleRange( m_findZone.range, timespan, ImGui::GetCursorScreenPos(), w );
|
HandleRange( m_findZone.range, timespan, ImGui::GetCursorScreenPos(), w );
|
||||||
HandleRange( m_statRange, timespan, ImGui::GetCursorScreenPos(), w );
|
HandleRange( m_statRange, timespan, ImGui::GetCursorScreenPos(), w );
|
||||||
|
HandleRange( m_waitStackRange, timespan, ImGui::GetCursorScreenPos(), w );
|
||||||
for( auto& v : m_annotations )
|
for( auto& v : m_annotations )
|
||||||
{
|
{
|
||||||
v->range.StartFrame();
|
v->range.StartFrame();
|
||||||
@ -3713,6 +3721,15 @@ void View::DrawZones()
|
|||||||
DrawLine( draw, ImVec2( dpos.x + px1, linepos.y + 0.5f ), ImVec2( dpos.x + px1, linepos.y + lineh + 0.5f ), m_statRange.hiMax ? 0x998888EE : 0x338888EE, m_statRange.hiMax ? 2 : 1 );
|
DrawLine( draw, ImVec2( dpos.x + px1, linepos.y + 0.5f ), ImVec2( dpos.x + px1, linepos.y + lineh + 0.5f ), m_statRange.hiMax ? 0x998888EE : 0x338888EE, m_statRange.hiMax ? 2 : 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_waitStackRange.active && ( m_showWaitStacks || m_showRanges ) )
|
||||||
|
{
|
||||||
|
const auto px0 = ( m_waitStackRange.min - m_vd.zvStart ) * pxns;
|
||||||
|
const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( m_waitStackRange.max - m_vd.zvStart ) * pxns );
|
||||||
|
DrawStripedRect( draw, wpos.x + px0, linepos.y, wpos.x + px1, linepos.y + lineh, 10 * ImGui::GetTextLineHeight() / 15.f, 0x22EEB588, true, false );
|
||||||
|
DrawLine( draw, ImVec2( dpos.x + px0, linepos.y + 0.5f ), ImVec2( dpos.x + px0, linepos.y + lineh + 0.5f ), m_waitStackRange.hiMin ? 0x99EEB588 : 0x33EEB588, m_waitStackRange.hiMin ? 2 : 1 );
|
||||||
|
DrawLine( draw, ImVec2( dpos.x + px1, linepos.y + 0.5f ), ImVec2( dpos.x + px1, linepos.y + lineh + 0.5f ), m_waitStackRange.hiMax ? 0x99EEB588 : 0x33EEB588, m_waitStackRange.hiMax ? 2 : 1 );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_setRangePopup.active || m_setRangePopupOpen )
|
if( m_setRangePopup.active || m_setRangePopupOpen )
|
||||||
{
|
{
|
||||||
const auto s = std::min( m_setRangePopup.min, m_setRangePopup.max );
|
const auto s = std::min( m_setRangePopup.min, m_setRangePopup.max );
|
||||||
@ -16251,10 +16268,12 @@ void View::DrawSampleParents()
|
|||||||
|
|
||||||
void View::DrawRanges()
|
void View::DrawRanges()
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowSize( ImVec2( 400, 100 ), ImGuiCond_FirstUseEver );
|
ImGui::Begin( "Time range limits", &m_showRanges, ImGuiWindowFlags_AlwaysAutoResize );
|
||||||
ImGui::Begin( "Time range limits", &m_showRanges );
|
|
||||||
DrawRangeEntry( m_findZone.range, ICON_FA_SEARCH " Find zone", 0x4488DD88, "RangeFindZoneCopyFrom", 0 );
|
DrawRangeEntry( m_findZone.range, ICON_FA_SEARCH " Find zone", 0x4488DD88, "RangeFindZoneCopyFrom", 0 );
|
||||||
|
ImGui::Separator();
|
||||||
DrawRangeEntry( m_statRange, ICON_FA_SORT_AMOUNT_UP " Statistics", 0x448888EE, "RangeStatisticsCopyFrom", 1 );
|
DrawRangeEntry( m_statRange, ICON_FA_SORT_AMOUNT_UP " Statistics", 0x448888EE, "RangeStatisticsCopyFrom", 1 );
|
||||||
|
ImGui::Separator();
|
||||||
|
DrawRangeEntry( m_waitStackRange, ICON_FA_HOURGLASS_HALF " Wait stacks", 0x44EEB588, "RangeWaitStackCopyFrom", 2 );
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16314,6 +16333,11 @@ void View::DrawRangeEntry( Range& range, const char* label, uint32_t color, cons
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( SmallButtonDisablable( ICON_FA_SORT_AMOUNT_UP " Copy from statistics", m_statRange.min == 0 && m_statRange.max == 0 ) ) range = m_statRange;
|
if( SmallButtonDisablable( ICON_FA_SORT_AMOUNT_UP " Copy from statistics", m_statRange.min == 0 && m_statRange.max == 0 ) ) range = m_statRange;
|
||||||
}
|
}
|
||||||
|
if( id != 2 )
|
||||||
|
{
|
||||||
|
ImGui::SameLine();
|
||||||
|
if( SmallButtonDisablable( ICON_FA_HOURGLASS_HALF " Copy from wait stacks", m_waitStackRange.min == 0 && m_waitStackRange.max == 0 ) ) range = m_waitStackRange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16330,19 +16354,27 @@ void View::DrawWaitStacks()
|
|||||||
{
|
{
|
||||||
if( WaitStackThread( t->id ) )
|
if( WaitStackThread( t->id ) )
|
||||||
{
|
{
|
||||||
totalCount += t->ctxSwitchSamples.size();
|
auto it = t->ctxSwitchSamples.begin();
|
||||||
for( auto& sd : t->ctxSwitchSamples )
|
auto end = t->ctxSwitchSamples.end();
|
||||||
|
if( m_waitStackRange.active )
|
||||||
{
|
{
|
||||||
auto cs = sd.callstack.Val();
|
it = std::lower_bound( it, end, m_waitStackRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
auto it = stacks.find( cs );
|
end = std::lower_bound( it, end, m_waitStackRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
if( it == stacks.end() )
|
}
|
||||||
|
totalCount += std::distance( it, end );
|
||||||
|
while( it != end )
|
||||||
|
{
|
||||||
|
auto cs = it->callstack.Val();
|
||||||
|
auto cit = stacks.find( cs );
|
||||||
|
if( cit == stacks.end() )
|
||||||
{
|
{
|
||||||
stacks.emplace( cs, 1 );
|
stacks.emplace( cs, 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it->second++;
|
cit->second++;
|
||||||
}
|
}
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16352,6 +16384,24 @@ void View::DrawWaitStacks()
|
|||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextFocused( "Selected:", RealToString( totalCount ) );
|
TextFocused( "Selected:", RealToString( totalCount ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Spacing();
|
||||||
|
ImGui::SameLine();
|
||||||
|
if( SmallCheckbox( "Limit range", &m_waitStackRange.active ) )
|
||||||
|
{
|
||||||
|
if( m_waitStackRange.active && m_waitStackRange.min == 0 && m_waitStackRange.max == 0 )
|
||||||
|
{
|
||||||
|
m_waitStackRange.min = m_vd.zvStart;
|
||||||
|
m_waitStackRange.max = m_vd.zvEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( m_waitStackRange.active )
|
||||||
|
{
|
||||||
|
ImGui::SameLine();
|
||||||
|
TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
|
||||||
|
ImGui::SameLine();
|
||||||
|
SmallToggleButton( ICON_FA_RULER " Limits", m_showRanges );
|
||||||
|
}
|
||||||
|
|
||||||
bool threadsChanged = false;
|
bool threadsChanged = false;
|
||||||
auto expand = ImGui::TreeNode( ICON_FA_RANDOM " Visible threads:" );
|
auto expand = ImGui::TreeNode( ICON_FA_RANDOM " Visible threads:" );
|
||||||
|
@ -115,6 +115,7 @@ public:
|
|||||||
|
|
||||||
bool m_showRanges = false;
|
bool m_showRanges = false;
|
||||||
Range m_statRange;
|
Range m_statRange;
|
||||||
|
Range m_waitStackRange;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Namespace : uint8_t
|
enum class Namespace : uint8_t
|
||||||
|
Loading…
Reference in New Issue
Block a user