diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 51087456..2d968a48 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1844,6 +1844,30 @@ uint64_t Worker::GetPidFromTid( uint64_t tid ) const return it->second; } +void Worker::GetCpuUsageAtTime( int64_t time, int& own, int& other ) const +{ + own = other = 0; + for( int i=0; iStart() <= time && it->End() != -1 ) + { + if( GetPidFromTid( DecompressThreadExternal( it->Thread() ) ) == m_pid ) + { + own++; + } + else + { + other++; + } + } + } + } +} + const ContextSwitch* const Worker::GetContextSwitchDataImpl( uint64_t thread ) { auto it = m_data.ctxSwitch.find( thread ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index c7139c75..c83bc6cf 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -309,6 +309,7 @@ public: int GetCpuDataCpuCount() const { return m_data.cpuDataCount; } uint64_t GetPidFromTid( uint64_t tid ) const; const flat_hash_map>& GetCpuThreadData() const { return m_data.cpuThreadData; } + void GetCpuUsageAtTime( int64_t time, int& own, int& other ) const; int64_t GetFrameTime( const FrameData& fd, size_t idx ) const; int64_t GetFrameBegin( const FrameData& fd, size_t idx ) const;