diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 3b4959e5..0f229906 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6552,7 +6552,26 @@ void View::DrawFindZone() auto& vec = m_findZone.sorted; vec.reserve( zsz ); size_t i; - if( m_findZone.selfTime ) + if( m_findZone.runningTime ) + { + tmin = std::numeric_limits::max(); + tmax = std::numeric_limits::min(); + for( i=m_findZone.sortedNum; i tmax ) tmax = t; + } + } + else if( m_findZone.selfTime ) { tmin = zoneData.selfMin; tmax = zoneData.selfMax; @@ -6601,7 +6620,25 @@ void View::DrawFindZone() vec.reserve( zsz ); auto act = m_findZone.selSortActive; int64_t total = m_findZone.selTotal; - if( m_findZone.selfTime ) + if( m_findZone.runningTime ) + { + for( size_t i=m_findZone.selSortNum; i& zones ) m_worker.GetZoneEndDirect( *rhs ) - rhs->start - this->GetZoneChildTimeFast( *rhs ); } ); } + else if( m_findZone.runningTime ) + { + pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs ) { + const auto ctx0 = m_worker.GetContextSwitchData( GetZoneThread( *lhs ) ); + const auto ctx1 = m_worker.GetContextSwitchData( GetZoneThread( *rhs ) ); + int64_t t0, t1; + uint64_t c0, c1; + GetZoneRunningTime( ctx0, *lhs, t0, c0 ); + GetZoneRunningTime( ctx1, *rhs, t1, c1 ); + return t0 > t1; + } ); + } else { pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs ) { @@ -7645,8 +7716,18 @@ void View::DrawZoneList( const Vector& zones ) for( auto& ev : *zonesToIterate ) { const auto end = m_worker.GetZoneEndDirect( *ev ); - auto timespan = end - ev->start; - if( m_findZone.selfTime ) timespan -= GetZoneChildTimeFast( *ev ); + int64_t timespan; + if( m_findZone.runningTime ) + { + const auto ctx = m_worker.GetContextSwitchData( GetZoneThread( *ev ) ); + uint64_t cnt; + GetZoneRunningTime( ctx, *ev, timespan, cnt ); + } + else + { + timespan = end - ev->start; + if( m_findZone.selfTime ) timespan -= GetZoneChildTimeFast( *ev ); + } ImGui::PushID( ev ); if( ImGui::Selectable( TimeToString( ev->start - m_worker.GetTimeBegin() ), m_zoneInfoWindow == ev, ImGuiSelectableFlags_SpanAllColumns ) ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index f3b753f3..2f3ca49d 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -374,6 +374,7 @@ private: bool logTime = true; bool cumulateTime = false; bool selfTime = false; + bool runningTime = false; GroupBy groupBy = GroupBy::Thread; SortBy sortBy = SortBy::Count; TableSortBy tableSortBy = TableSortBy::Starttime;