mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Merge callstack samples with the same timestamp.
This commit is contained in:
parent
4f735e1ae2
commit
355a179678
@ -6270,22 +6270,38 @@ void Worker::ProcessCallstack()
|
|||||||
void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td )
|
void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td )
|
||||||
{
|
{
|
||||||
const auto t = sd.time.Val();
|
const auto t = sd.time.Val();
|
||||||
const auto callstack = sd.callstack.Val();
|
|
||||||
m_data.samplesCnt++;
|
|
||||||
|
|
||||||
const auto& cs = GetCallstack( callstack );
|
|
||||||
const auto& ip = cs[0];
|
|
||||||
if( GetCanonicalPointer( ip ) >> 63 != 0 ) td.kernelSampleCnt++;
|
|
||||||
|
|
||||||
if( td.samples.empty() )
|
if( td.samples.empty() )
|
||||||
{
|
{
|
||||||
td.samples.push_back( sd );
|
td.samples.push_back( sd );
|
||||||
}
|
}
|
||||||
else
|
else if( td.samples.back().time.Val() >= t )
|
||||||
|
{
|
||||||
|
m_inconsistentSamples = true;
|
||||||
|
auto it = std::lower_bound( td.samples.begin(), td.samples.end(), t, []( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
|
assert( it != td.samples.end() );
|
||||||
|
if( it->time.Val() != t )
|
||||||
{
|
{
|
||||||
if( !m_inconsistentSamples && td.samples.back().time.Val() >= t ) m_inconsistentSamples = true;
|
|
||||||
td.samples.push_back_non_empty( sd );
|
td.samples.push_back_non_empty( sd );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto mcs = MergeCallstacks( it->callstack.Val(), sd.callstack.Val() );
|
||||||
|
it->callstack.SetVal( mcs );
|
||||||
|
|
||||||
|
// This is a fixup of an already processed sample. Fixing stats is non-trivial, so just exit here.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
td.samples.push_back_non_empty( sd );
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto callstack = sd.callstack.Val();
|
||||||
|
const auto& cs = GetCallstack( callstack );
|
||||||
|
const auto& ip = cs[0];
|
||||||
|
if( GetCanonicalPointer( ip ) >> 63 != 0 ) td.kernelSampleCnt++;
|
||||||
|
m_data.samplesCnt++;
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
bool postpone = false;
|
bool postpone = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user