mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Narrow down search region.
This commit is contained in:
parent
22352dd29b
commit
a9a16b4d94
@ -2137,6 +2137,7 @@ void Worker::GetCpuUsage( int64_t t0, double tstep, size_t num, std::vector<std:
|
|||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
if( !m_data.ctxUsage.empty() )
|
if( !m_data.ctxUsage.empty() )
|
||||||
{
|
{
|
||||||
|
auto itBegin = m_data.ctxUsage.begin();
|
||||||
for( size_t i=0; i<num; i++ )
|
for( size_t i=0; i<num; i++ )
|
||||||
{
|
{
|
||||||
const auto time = int64_t( t0 + tstep * i );
|
const auto time = int64_t( t0 + tstep * i );
|
||||||
@ -2148,7 +2149,7 @@ void Worker::GetCpuUsage( int64_t t0, double tstep, size_t num, std::vector<std:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto test = ( time << 16 ) | 0xFFFF;
|
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; } );
|
auto it = std::upper_bound( itBegin, 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() )
|
if( it == m_data.ctxUsage.begin() || it == m_data.ctxUsage.end() )
|
||||||
{
|
{
|
||||||
ptr->first = 0;
|
ptr->first = 0;
|
||||||
@ -2160,6 +2161,7 @@ void Worker::GetCpuUsage( int64_t t0, double tstep, size_t num, std::vector<std:
|
|||||||
ptr->first = it->Own();
|
ptr->first = it->Own();
|
||||||
ptr->second = it->Other();
|
ptr->second = it->Other();
|
||||||
}
|
}
|
||||||
|
itBegin = it;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user