mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Extract find zone range data to a separate struct.
This commit is contained in:
parent
7e6a41e647
commit
fd5ccc16d6
@ -3077,10 +3077,10 @@ void View::DrawZones()
|
|||||||
draw->AddRect( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x4488DD88 );
|
draw->AddRect( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x4488DD88 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_findZone.show && m_findZone.limitRange )
|
if( m_findZone.show && m_findZone.range.active )
|
||||||
{
|
{
|
||||||
const auto px0 = ( m_findZone.rangeMin - m_vd.zvStart ) * pxns;
|
const auto px0 = ( m_findZone.range.min - m_vd.zvStart ) * pxns;
|
||||||
const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( m_findZone.rangeMax - m_vd.zvStart ) * pxns );
|
const auto px1 = std::max( px0 + std::max( 1.0, pxns * 0.5 ), ( m_findZone.range.max - m_vd.zvStart ) * pxns );
|
||||||
draw->AddRectFilled( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x1188DDDD );
|
draw->AddRectFilled( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x1188DDDD );
|
||||||
draw->AddRect( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x2288DDDD );
|
draw->AddRect( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x2288DDDD );
|
||||||
}
|
}
|
||||||
@ -8906,30 +8906,30 @@ void View::DrawFindZone()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Checkbox( "Ignore case", &m_findZone.ignoreCase );
|
ImGui::Checkbox( "Ignore case", &m_findZone.ignoreCase );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( ImGui::Checkbox( "Limit range", &m_findZone.limitRange ) )
|
if( ImGui::Checkbox( "Limit range", &m_findZone.range.active ) )
|
||||||
{
|
{
|
||||||
m_findZone.ResetMatch();
|
m_findZone.ResetMatch();
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
m_findZone.rangeMin = m_vd.zvStart;
|
m_findZone.range.min = m_vd.zvStart;
|
||||||
m_findZone.rangeMax = m_vd.zvEnd;
|
m_findZone.range.max = m_vd.zvEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( ICON_FA_LOCK );
|
ImGui::TextUnformatted( ICON_FA_LOCK );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextFocused( "Zone time range:", TimeToStringExact( m_findZone.rangeMin ) );
|
TextFocused( "Zone time range:", TimeToStringExact( m_findZone.range.min ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextFocused( "-", TimeToStringExact( m_findZone.rangeMax ) );
|
TextFocused( "-", TimeToStringExact( m_findZone.range.max ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextDisabled( "(%s)", TimeToString( m_findZone.rangeMax - m_findZone.rangeMin ) );
|
ImGui::TextDisabled( "(%s)", TimeToString( m_findZone.range.max - m_findZone.range.min ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( ImGui::SmallButton( "Limit to view" ) )
|
if( ImGui::SmallButton( "Limit to view" ) )
|
||||||
{
|
{
|
||||||
m_findZone.ResetMatch();
|
m_findZone.ResetMatch();
|
||||||
m_findZone.rangeMin = m_vd.zvStart;
|
m_findZone.range.min = m_vd.zvStart;
|
||||||
m_findZone.rangeMax = m_vd.zvEnd;
|
m_findZone.range.max = m_vd.zvEnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8941,8 +8941,8 @@ void View::DrawFindZone()
|
|||||||
|
|
||||||
if( !m_findZone.match.empty() )
|
if( !m_findZone.match.empty() )
|
||||||
{
|
{
|
||||||
const auto rangeMin = m_findZone.rangeMin;
|
const auto rangeMin = m_findZone.range.min;
|
||||||
const auto rangeMax = m_findZone.rangeMax;
|
const auto rangeMax = m_findZone.range.max;
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::BeginChild( "##findzone" );
|
ImGui::BeginChild( "##findzone" );
|
||||||
@ -9021,7 +9021,7 @@ void View::DrawFindZone()
|
|||||||
size_t i;
|
size_t i;
|
||||||
if( m_findZone.runningTime )
|
if( m_findZone.runningTime )
|
||||||
{
|
{
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
||||||
{
|
{
|
||||||
@ -9060,7 +9060,7 @@ void View::DrawFindZone()
|
|||||||
{
|
{
|
||||||
tmin = zoneData.selfMin;
|
tmin = zoneData.selfMin;
|
||||||
tmax = zoneData.selfMax;
|
tmax = zoneData.selfMax;
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
||||||
{
|
{
|
||||||
@ -9089,7 +9089,7 @@ void View::DrawFindZone()
|
|||||||
{
|
{
|
||||||
tmin = zoneData.min;
|
tmin = zoneData.min;
|
||||||
tmax = zoneData.max;
|
tmax = zoneData.max;
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
for( i=m_findZone.sortedNum; i<zsz; i++ )
|
||||||
{
|
{
|
||||||
@ -9147,7 +9147,7 @@ void View::DrawFindZone()
|
|||||||
int64_t total = m_findZone.selTotal;
|
int64_t total = m_findZone.selTotal;
|
||||||
if( m_findZone.runningTime )
|
if( m_findZone.runningTime )
|
||||||
{
|
{
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
||||||
{
|
{
|
||||||
@ -9185,7 +9185,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
else if( m_findZone.selfTime )
|
else if( m_findZone.selfTime )
|
||||||
{
|
{
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
||||||
{
|
{
|
||||||
@ -9217,7 +9217,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_findZone.limitRange )
|
if( m_findZone.range.active )
|
||||||
{
|
{
|
||||||
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
||||||
{
|
{
|
||||||
@ -9322,7 +9322,7 @@ void View::DrawFindZone()
|
|||||||
auto sortedEnd = sorted.end();
|
auto sortedEnd = sorted.end();
|
||||||
while( sortedBegin != sortedEnd && *sortedBegin == 0 ) ++sortedBegin;
|
while( sortedBegin != sortedEnd && *sortedBegin == 0 ) ++sortedBegin;
|
||||||
|
|
||||||
if( m_findZone.minBinVal > 1 || m_findZone.limitRange )
|
if( m_findZone.minBinVal > 1 || m_findZone.range.active )
|
||||||
{
|
{
|
||||||
if( m_findZone.logTime )
|
if( m_findZone.logTime )
|
||||||
{
|
{
|
||||||
@ -9556,7 +9556,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
TextFocused( "Mode:", TimeToString( ( t0 + t1 ) / 2 ) );
|
TextFocused( "Mode:", TimeToString( ( t0 + t1 ) / 2 ) );
|
||||||
}
|
}
|
||||||
if( !m_findZone.limitRange && m_findZone.sorted.size() > 1 )
|
if( !m_findZone.range.active && m_findZone.sorted.size() > 1 )
|
||||||
{
|
{
|
||||||
const auto sz = m_findZone.sorted.size();
|
const auto sz = m_findZone.sorted.size();
|
||||||
const auto avg = m_findZone.average;
|
const auto avg = m_findZone.average;
|
||||||
@ -10010,7 +10010,7 @@ void View::DrawFindZone()
|
|||||||
const auto hmax = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
const auto hmax = std::max( m_findZone.highlight.start, m_findZone.highlight.end );
|
||||||
const auto groupBy = m_findZone.groupBy;
|
const auto groupBy = m_findZone.groupBy;
|
||||||
const auto highlightActive = m_findZone.highlight.active;
|
const auto highlightActive = m_findZone.highlight.active;
|
||||||
const auto limitRange = m_findZone.limitRange;
|
const auto limitRange = m_findZone.range.active;
|
||||||
FindZone::Group* group = nullptr;
|
FindZone::Group* group = nullptr;
|
||||||
uint64_t lastGid = std::numeric_limits<uint64_t>::max() - 1;
|
uint64_t lastGid = std::numeric_limits<uint64_t>::max() - 1;
|
||||||
auto zptr = zones.data() + m_findZone.processed;
|
auto zptr = zones.data() + m_findZone.processed;
|
||||||
|
@ -56,6 +56,12 @@ class View
|
|||||||
uint64_t count;
|
uint64_t count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Range
|
||||||
|
{
|
||||||
|
int64_t min, max;
|
||||||
|
bool active = false;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct VisData
|
struct VisData
|
||||||
{
|
{
|
||||||
@ -487,8 +493,7 @@ private:
|
|||||||
int minBinVal = 1;
|
int minBinVal = 1;
|
||||||
int64_t tmin, tmax;
|
int64_t tmin, tmax;
|
||||||
bool showZoneInFrames = false;
|
bool showZoneInFrames = false;
|
||||||
bool limitRange = false;
|
Range range;
|
||||||
int64_t rangeMin, rangeMax;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -543,7 +548,7 @@ private:
|
|||||||
void ShowZone( int16_t srcloc, const char* name )
|
void ShowZone( int16_t srcloc, const char* name )
|
||||||
{
|
{
|
||||||
show = true;
|
show = true;
|
||||||
limitRange = false;
|
range.active = false;
|
||||||
Reset();
|
Reset();
|
||||||
match.emplace_back( srcloc );
|
match.emplace_back( srcloc );
|
||||||
strcpy( pattern, name );
|
strcpy( pattern, name );
|
||||||
@ -553,9 +558,9 @@ private:
|
|||||||
{
|
{
|
||||||
assert( limitMin <= limitMax );
|
assert( limitMin <= limitMax );
|
||||||
show = true;
|
show = true;
|
||||||
limitRange = true;
|
range.active = true;
|
||||||
rangeMin = limitMin;
|
range.min = limitMin;
|
||||||
rangeMax = limitMax;
|
range.max = limitMax;
|
||||||
Reset();
|
Reset();
|
||||||
match.emplace_back( srcloc );
|
match.emplace_back( srcloc );
|
||||||
strcpy( pattern, name );
|
strcpy( pattern, name );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user