mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
Add time limit ranges window.
This commit is contained in:
parent
9633617810
commit
8091207d26
@ -100,6 +100,25 @@ namespace tracy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool SmallButtonDisablable( const char* label, bool disabled )
|
||||||
|
{
|
||||||
|
if( disabled )
|
||||||
|
{
|
||||||
|
ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor( 0.3f, 0.3f, 0.3f, 1.0f ) );
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
float backup_padding_y = g.Style.FramePadding.y;
|
||||||
|
g.Style.FramePadding.y = 0.0f;
|
||||||
|
ImGui::ButtonEx( label, ImVec2( 0, 0 ), ImGuiButtonFlags_Disabled | ImGuiButtonFlags_AlignTextBaseLine );
|
||||||
|
g.Style.FramePadding.y = backup_padding_y;
|
||||||
|
ImGui::PopStyleColor( 1 );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ImGui::SmallButton( label );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void DrawTextContrast( ImDrawList* draw, const ImVec2& pos, uint32_t color, const char* text )
|
static inline void DrawTextContrast( ImDrawList* draw, const ImVec2& pos, uint32_t color, const char* text )
|
||||||
{
|
{
|
||||||
draw->AddText( pos + ImVec2( 1, 1 ), 0xAA000000, text );
|
draw->AddText( pos + ImVec2( 1, 1 ), 0xAA000000, text );
|
||||||
|
@ -582,6 +582,8 @@ bool View::DrawImpl()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ToggleButton( ICON_FA_FINGERPRINT " Info", m_showInfo );
|
ToggleButton( ICON_FA_FINGERPRINT " Info", m_showInfo );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ToggleButton( ICON_FA_RULER, m_showRanges );
|
||||||
|
ImGui::SameLine();
|
||||||
if( ImGui::Button( ICON_FA_TOOLS ) ) ImGui::OpenPopup( "ToolsPopup" );
|
if( ImGui::Button( ICON_FA_TOOLS ) ) ImGui::OpenPopup( "ToolsPopup" );
|
||||||
if( ImGui::BeginPopup( "ToolsPopup" ) )
|
if( ImGui::BeginPopup( "ToolsPopup" ) )
|
||||||
{
|
{
|
||||||
@ -762,6 +764,7 @@ bool View::DrawImpl()
|
|||||||
if( m_selectedAnnotation ) DrawSelectedAnnotation();
|
if( m_selectedAnnotation ) DrawSelectedAnnotation();
|
||||||
if( m_showAnnotationList ) DrawAnnotationList();
|
if( m_showAnnotationList ) DrawAnnotationList();
|
||||||
if( m_sampleParents.symAddr != 0 ) DrawSampleParents();
|
if( m_sampleParents.symAddr != 0 ) DrawSampleParents();
|
||||||
|
if( m_showRanges ) DrawRanges();
|
||||||
|
|
||||||
if( m_zoomAnim.active )
|
if( m_zoomAnim.active )
|
||||||
{
|
{
|
||||||
@ -9016,19 +9019,6 @@ void View::DrawFindZone()
|
|||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
|
TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
|
||||||
ImGui::TextUnformatted( ICON_FA_LOCK );
|
|
||||||
ImGui::SameLine();
|
|
||||||
TextFocused( "Zone time range:", TimeToStringExact( m_findZone.range.min ) );
|
|
||||||
ImGui::SameLine();
|
|
||||||
TextFocused( "-", TimeToStringExact( m_findZone.range.max ) );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextDisabled( "(%s)", TimeToString( m_findZone.range.max - m_findZone.range.min ) );
|
|
||||||
ImGui::SameLine();
|
|
||||||
if( ImGui::SmallButton( "Limit to view" ) )
|
|
||||||
{
|
|
||||||
m_findZone.range.min = m_vd.zvStart;
|
|
||||||
m_findZone.range.max = m_vd.zvEnd;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_findZone.rangeSlim != m_findZone.range )
|
if( m_findZone.rangeSlim != m_findZone.range )
|
||||||
@ -14592,6 +14582,57 @@ void View::DrawSampleParents()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::DrawRanges()
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowSize( ImVec2( 400, 100 ), ImGuiCond_FirstUseEver );
|
||||||
|
ImGui::Begin( "Time range limits", &m_showRanges );
|
||||||
|
if( SmallCheckbox( "Find zone", &m_findZone.range.active ) )
|
||||||
|
{
|
||||||
|
if( m_findZone.range.active && m_findZone.range.min == 0 && m_findZone.range.max == 0 )
|
||||||
|
{
|
||||||
|
m_findZone.range.min = m_vd.zvStart;
|
||||||
|
m_findZone.range.max = m_vd.zvEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( m_findZone.range.active )
|
||||||
|
{
|
||||||
|
ImGui::SameLine();
|
||||||
|
if( ImGui::SmallButton( "Limit to view" ) )
|
||||||
|
{
|
||||||
|
m_findZone.range.min = m_vd.zvStart;
|
||||||
|
m_findZone.range.max = m_vd.zvEnd;
|
||||||
|
}
|
||||||
|
if( !m_findZone.show )
|
||||||
|
{
|
||||||
|
ImGui::SameLine();
|
||||||
|
TextDisabledUnformatted( ICON_FA_EXCLAMATION_TRIANGLE " Open find zone to show overlay" );
|
||||||
|
}
|
||||||
|
TextFocused( "Time range:", TimeToStringExact( m_findZone.range.min ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
TextFocused( "-", TimeToStringExact( m_findZone.range.max ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%s)", TimeToString( m_findZone.range.max - m_findZone.range.min ) );
|
||||||
|
if( SmallButtonDisablable( ICON_FA_STICKY_NOTE " Set from annotation", m_annotations.empty() ) ) ImGui::OpenPopup( "RangeFindZoneCopyFrom" );
|
||||||
|
if( ImGui::BeginPopup( "RangeFindZoneCopyFrom" ) )
|
||||||
|
{
|
||||||
|
for( auto& v : m_annotations )
|
||||||
|
{
|
||||||
|
SmallColorBox( v->color );
|
||||||
|
ImGui::SameLine();
|
||||||
|
if( ImGui::Selectable( v->text.c_str() ) )
|
||||||
|
{
|
||||||
|
m_findZone.range.min = v->start;
|
||||||
|
m_findZone.range.max = v->end;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v->start ), TimeToStringExact( v->end ), TimeToString( v->end - v->start ) );
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
void View::ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id, int64_t startTime )
|
void View::ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id, int64_t startTime )
|
||||||
{
|
{
|
||||||
if( startTime == -1 ) startTime = 0;
|
if( startTime == -1 ) startTime = 0;
|
||||||
|
@ -194,6 +194,7 @@ private:
|
|||||||
void DrawSelectedAnnotation();
|
void DrawSelectedAnnotation();
|
||||||
void DrawAnnotationList();
|
void DrawAnnotationList();
|
||||||
void DrawSampleParents();
|
void DrawSampleParents();
|
||||||
|
void DrawRanges();
|
||||||
|
|
||||||
void ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
|
void ListMemData( std::vector<const MemEvent*>& vec, std::function<void(const MemEvent*)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
|
||||||
|
|
||||||
@ -377,6 +378,7 @@ private:
|
|||||||
bool m_showPlayback = false;
|
bool m_showPlayback = false;
|
||||||
bool m_showCpuDataWindow = false;
|
bool m_showCpuDataWindow = false;
|
||||||
bool m_showAnnotationList = false;
|
bool m_showAnnotationList = false;
|
||||||
|
bool m_showRanges = false;
|
||||||
|
|
||||||
enum class CpuDataSortBy
|
enum class CpuDataSortBy
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user