diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 718bee47..d5d31d1a 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4638,19 +4638,26 @@ void View::DrawFindZone() auto& vec = m_findZone.selSort; vec.reserve( zsz ); auto act = m_findZone.selSortActive; + int64_t total = m_findZone.selTotal; size_t i; for( i=m_findZone.selSortNum; iend - ev.zone->start ); + const auto t = ev.zone->end - ev.zone->start; + vec.emplace_back( t ); act++; + total += t; } } auto mid = vec.begin() + m_findZone.selSortActive; pdqsort_branchless( mid, vec.end() ); std::inplace_merge( vec.begin(), mid, vec.end() ); + + m_findZone.selAverage = float( total ) / act; + m_findZone.selMedian = vec[act/2]; + m_findZone.selTotal = total; m_findZone.selSortNum = m_findZone.sortedNum; m_findZone.selSortActive = act; } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index b450a23b..17b21bc2 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -294,9 +294,9 @@ private: std::unique_ptr bins, binTime, selBin; std::vector sorted, selSort; size_t sortedNum, selSortNum, selSortActive; - float average; - float median; - int64_t total; + float average, selAverage; + float median, selMedian; + int64_t total, selTotal; void Reset() { @@ -324,6 +324,9 @@ private: selSort.clear(); selSortNum = 0; selSortActive = 0; + selAverage = 0; + selMedian = 0; + selTotal = 0; } void ShowZone( int32_t srcloc, const char* name )