diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index ab82f056..af1cf330 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2133,10 +2133,10 @@ void Worker::GetCpuUsage( int64_t t0, double tstep, size_t num, std::vector m_data.lastTime ) + auto& cs = m_data.cpuData[i].cs; + if( !cs.empty() ) { - ptr->first = 0; - ptr->second = 0; - } - else - { - int cntOwn = 0; - int cntOther = 0; - for( int i=0; i= 0 && time <= m_data.lastTime ) { auto it = std::lower_bound( cs.begin(), cs.end(), time, [] ( const auto& l, const auto& r ) { return (uint64_t)l.End() < (uint64_t)r; } ); if( it != cs.end() && it->IsEndValid() && it->Start() <= time ) { if( GetPidFromTid( DecompressThreadExternal( it->Thread() ) ) == m_pid ) { - cntOwn++; + ptr->first++; } else { - cntOther++; + ptr->second++; } } } + ptr++; } - ptr->first = cntOwn; - ptr->second = cntOther; } - ptr++; } } }