Calculate sorted zone times for find zone histogram.

This commit is contained in:
Bartosz Taudul 2018-09-02 00:19:15 +02:00
parent e81218ddaf
commit f66ed00d71
2 changed files with 26 additions and 0 deletions

View File

@ -4599,6 +4599,28 @@ void View::DrawFindZone()
const auto tmax = zoneData.max;
const auto timeTotal = zoneData.total;
const auto zsz = zones.size();
if( m_findZone.sortedNum != zsz )
{
auto& vec = m_findZone.sorted;
vec.reserve( zsz );
size_t i;
for( i=m_findZone.sortedNum; i<zsz; i++ )
{
auto& zone = *zones[i].zone;
if( zone.end < 0 )
{
break;
}
const auto t = zone.end - zone.start;
m_findZone.sorted.emplace_back( t );
}
auto mid = vec.begin() + m_findZone.sortedNum;
pdqsort_branchless( mid, vec.end() );
std::inplace_merge( vec.begin(), mid, vec.end() );
m_findZone.sortedNum = i;
}
if( tmin != std::numeric_limits<int64_t>::max() )
{
ImGui::Checkbox( "Log values", &m_findZone.logVal );

View File

@ -291,6 +291,8 @@ private:
Region highlight;
int64_t numBins = -1;
std::unique_ptr<int64_t[]> bins, binTime, selBin;
std::vector<int64_t> sorted;
size_t sortedNum;
void Reset()
{
@ -299,6 +301,8 @@ private:
selMatch = 0;
selGroup = Unselected;
highlight.active = false;
sorted.clear();
sortedNum = 0;
}
void ResetGroups()