Support dynamic recalculation of min, max and total time.

This commit is contained in:
Bartosz Taudul 2019-08-14 21:10:58 +02:00
parent ee77ff020a
commit 9ec0724ffb
2 changed files with 12 additions and 7 deletions

View File

@ -6543,19 +6543,19 @@ void View::DrawFindZone()
const auto ty = ImGui::GetFontSize(); const auto ty = ImGui::GetFontSize();
auto& zones = zoneData.zones; auto& zones = zoneData.zones;
auto tmin = m_findZone.selfTime ? zoneData.selfMin : zoneData.min; int64_t tmin = m_findZone.tmin;
auto tmax = m_findZone.selfTime ? zoneData.selfMax : zoneData.max; int64_t tmax = m_findZone.tmax;
auto timeTotal = m_findZone.selfTime ? zoneData.selfTotal : zoneData.total; int64_t total = m_findZone.total;
const auto zsz = zones.size(); const auto zsz = zones.size();
if( m_findZone.sortedNum != zsz ) if( m_findZone.sortedNum != zsz )
{ {
auto& vec = m_findZone.sorted; auto& vec = m_findZone.sorted;
vec.reserve( zsz ); vec.reserve( zsz );
int64_t total = m_findZone.total;
size_t i; size_t i;
if( m_findZone.selfTime ) if( m_findZone.selfTime )
{ {
tmin = zoneData.selfMin;
tmax = zoneData.selfMax;
for( i=m_findZone.sortedNum; i<zsz; i++ ) for( i=m_findZone.sortedNum; i<zsz; i++ )
{ {
auto& zone = *zones[i].zone; auto& zone = *zones[i].zone;
@ -6567,6 +6567,8 @@ void View::DrawFindZone()
} }
else else
{ {
tmin = zoneData.min;
tmax = zoneData.max;
for( i=m_findZone.sortedNum; i<zsz; i++ ) for( i=m_findZone.sortedNum; i<zsz; i++ )
{ {
auto& zone = *zones[i].zone; auto& zone = *zones[i].zone;
@ -6584,6 +6586,8 @@ void View::DrawFindZone()
m_findZone.median = vec[i/2]; m_findZone.median = vec[i/2];
m_findZone.total = total; m_findZone.total = total;
m_findZone.sortedNum = i; m_findZone.sortedNum = i;
m_findZone.tmin = tmin;
m_findZone.tmax = tmax;
} }
if( m_findZone.selGroup != m_findZone.Unselected ) if( m_findZone.selGroup != m_findZone.Unselected )
@ -6734,7 +6738,7 @@ void View::DrawFindZone()
tmin = *sortedBegin; tmin = *sortedBegin;
tmax = *(sortedEnd-1); tmax = *(sortedEnd-1);
timeTotal = tmax - tmin; total = tmax - tmin;
} }
if( numBins > m_findZone.numBins ) if( numBins > m_findZone.numBins )
@ -6875,7 +6879,7 @@ void View::DrawFindZone()
} }
} }
TextFocused( "Total time:", TimeToString( timeTotal ) ); TextFocused( "Total time:", TimeToString( total ) );
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();

View File

@ -391,6 +391,7 @@ private:
bool scheduleResetMatch = false; bool scheduleResetMatch = false;
int selCs = 0; int selCs = 0;
int minBinVal = 1; int minBinVal = 1;
int64_t tmin, tmax;
struct struct
{ {