1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Directly compare time, with data piggybacked in low bits.

This commit is contained in:
Bartosz Taudul 2021-05-01 15:04:56 +02:00
parent a688d24665
commit 0e6a25fdd8
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2028,7 +2028,8 @@ void Worker::GetCpuUsageAtTime( int64_t time, int& own, int& other ) const
// Remove this check when real-time ctxUsage contruction is implemented. // Remove this check when real-time ctxUsage contruction is implemented.
if( !m_data.ctxUsage.empty() ) if( !m_data.ctxUsage.empty() )
{ {
auto it = std::upper_bound( m_data.ctxUsage.begin(), m_data.ctxUsage.end(), time, [] ( const auto& l, const auto& r ) { return l < r.Time(); } ); const auto test = ( time << 16 ) | 0xFFFF;
auto it = std::upper_bound( m_data.ctxUsage.begin(), m_data.ctxUsage.end(), test, [] ( const auto& l, const auto& r ) { return l < r._time_other_own; } );
if( it == m_data.ctxUsage.begin() || it == m_data.ctxUsage.end() ) return; if( it == m_data.ctxUsage.begin() || it == m_data.ctxUsage.end() ) return;
--it; --it;
own = it->Own(); own = it->Own();