Perform cheaper check first.

This commit is contained in:
Bartosz Taudul 2020-02-19 22:43:37 +01:00
parent 9b1fe23b03
commit d4f99e4459

View File

@ -1795,7 +1795,7 @@ void Worker::GetCpuUsageAtTime( int64_t time, int& own, int& other ) const
if( !cs.empty() ) if( !cs.empty() )
{ {
auto it = std::lower_bound( cs.begin(), cs.end(), time, [] ( const auto& l, const auto& r ) { return (uint64_t)l.End() < (uint64_t)r; } ); 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->Start() <= time && it->IsEndValid() ) if( it != cs.end() && it->IsEndValid() && it->Start() <= time )
{ {
if( GetPidFromTid( DecompressThreadExternal( it->Thread() ) ) == m_pid ) if( GetPidFromTid( DecompressThreadExternal( it->Thread() ) ) == m_pid )
{ {