mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 14:54:34 +00:00
Calculate group average and median times.
This commit is contained in:
parent
5733b420a1
commit
2d3ce1bf25
@ -4638,19 +4638,26 @@ void View::DrawFindZone()
|
|||||||
auto& vec = m_findZone.selSort;
|
auto& vec = m_findZone.selSort;
|
||||||
vec.reserve( zsz );
|
vec.reserve( zsz );
|
||||||
auto act = m_findZone.selSortActive;
|
auto act = m_findZone.selSortActive;
|
||||||
|
int64_t total = m_findZone.selTotal;
|
||||||
size_t i;
|
size_t i;
|
||||||
for( i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
for( i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
||||||
{
|
{
|
||||||
auto& ev = zones[i];
|
auto& ev = zones[i];
|
||||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||||
{
|
{
|
||||||
vec.emplace_back( ev.zone->end - ev.zone->start );
|
const auto t = ev.zone->end - ev.zone->start;
|
||||||
|
vec.emplace_back( t );
|
||||||
act++;
|
act++;
|
||||||
|
total += t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto mid = vec.begin() + m_findZone.selSortActive;
|
auto mid = vec.begin() + m_findZone.selSortActive;
|
||||||
pdqsort_branchless( mid, vec.end() );
|
pdqsort_branchless( mid, vec.end() );
|
||||||
std::inplace_merge( vec.begin(), 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.selSortNum = m_findZone.sortedNum;
|
||||||
m_findZone.selSortActive = act;
|
m_findZone.selSortActive = act;
|
||||||
}
|
}
|
||||||
|
@ -294,9 +294,9 @@ private:
|
|||||||
std::unique_ptr<int64_t[]> bins, binTime, selBin;
|
std::unique_ptr<int64_t[]> bins, binTime, selBin;
|
||||||
std::vector<int64_t> sorted, selSort;
|
std::vector<int64_t> sorted, selSort;
|
||||||
size_t sortedNum, selSortNum, selSortActive;
|
size_t sortedNum, selSortNum, selSortActive;
|
||||||
float average;
|
float average, selAverage;
|
||||||
float median;
|
float median, selMedian;
|
||||||
int64_t total;
|
int64_t total, selTotal;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
@ -324,6 +324,9 @@ private:
|
|||||||
selSort.clear();
|
selSort.clear();
|
||||||
selSortNum = 0;
|
selSortNum = 0;
|
||||||
selSortActive = 0;
|
selSortActive = 0;
|
||||||
|
selAverage = 0;
|
||||||
|
selMedian = 0;
|
||||||
|
selTotal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowZone( int32_t srcloc, const char* name )
|
void ShowZone( int32_t srcloc, const char* name )
|
||||||
|
Loading…
Reference in New Issue
Block a user