mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 13:13:53 +00:00
Include threadid in SampleDataRange
TODO: maybe make lists per thread to avoid increasing the packed structure by 2 bytes?
This commit is contained in:
parent
6b901a7156
commit
e4ce9f0f41
@ -268,6 +268,7 @@ enum { SampleDataSize = sizeof( SampleData ) };
|
|||||||
struct SampleDataRange
|
struct SampleDataRange
|
||||||
{
|
{
|
||||||
Int48 time;
|
Int48 time;
|
||||||
|
uint16_t thread;
|
||||||
CallstackFrameId ip;
|
CallstackFrameId ip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1931,6 +1931,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
jobs.emplace_back( std::thread( [this] {
|
jobs.emplace_back( std::thread( [this] {
|
||||||
for( auto& t : m_data.threads )
|
for( auto& t : m_data.threads )
|
||||||
{
|
{
|
||||||
|
uint16_t tid = CompressThread( t->id );
|
||||||
for( auto& v : t->samples )
|
for( auto& v : t->samples )
|
||||||
{
|
{
|
||||||
const auto& time = v.time;
|
const auto& time = v.time;
|
||||||
@ -1944,11 +1945,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
auto it = m_data.symbolSamples.find( symAddr );
|
auto it = m_data.symbolSamples.find( symAddr );
|
||||||
if( it == m_data.symbolSamples.end() )
|
if( it == m_data.symbolSamples.end() )
|
||||||
{
|
{
|
||||||
m_data.symbolSamples.emplace( symAddr, Vector<SampleDataRange>( SampleDataRange { time, ip } ) );
|
m_data.symbolSamples.emplace( symAddr, Vector<SampleDataRange>( SampleDataRange { time, tid, ip } ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it->second.push_back_non_empty( SampleDataRange { time, ip } );
|
it->second.push_back_non_empty( SampleDataRange { time, tid, ip } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for( uint16_t i=1; i<callstack.size(); i++ )
|
for( uint16_t i=1; i<callstack.size(); i++ )
|
||||||
@ -5970,6 +5971,8 @@ void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td, i
|
|||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
{
|
{
|
||||||
|
uint16_t tid = CompressThread( td.id );
|
||||||
|
|
||||||
auto frame = GetCallstackFrame( ip );
|
auto frame = GetCallstackFrame( ip );
|
||||||
if( frame )
|
if( frame )
|
||||||
{
|
{
|
||||||
@ -5994,18 +5997,18 @@ void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td, i
|
|||||||
auto sit = m_data.symbolSamples.find( symAddr );
|
auto sit = m_data.symbolSamples.find( symAddr );
|
||||||
if( sit == m_data.symbolSamples.end() )
|
if( sit == m_data.symbolSamples.end() )
|
||||||
{
|
{
|
||||||
m_data.symbolSamples.emplace( symAddr, Vector<SampleDataRange>( SampleDataRange { sd.time, ip } ) );
|
m_data.symbolSamples.emplace( symAddr, Vector<SampleDataRange>( SampleDataRange { sd.time, tid, ip } ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( sit->second.back().time.Val() <= sd.time.Val() )
|
if( sit->second.back().time.Val() <= sd.time.Val() )
|
||||||
{
|
{
|
||||||
sit->second.push_back_non_empty( SampleDataRange { sd.time, ip } );
|
sit->second.push_back_non_empty( SampleDataRange { sd.time, tid, ip } );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto iit = std::upper_bound( sit->second.begin(), sit->second.end(), sd.time.Val(), [] ( const auto& lhs, const auto& rhs ) { return lhs < rhs.time.Val(); } );
|
auto iit = std::upper_bound( sit->second.begin(), sit->second.end(), sd.time.Val(), [] ( const auto& lhs, const auto& rhs ) { return lhs < rhs.time.Val(); } );
|
||||||
sit->second.insert( iit, SampleDataRange { sd.time, ip } );
|
sit->second.insert( iit, SampleDataRange { sd.time, tid, ip } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6023,11 +6026,11 @@ void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td, i
|
|||||||
auto sit = m_data.pendingSymbolSamples.find( ip );
|
auto sit = m_data.pendingSymbolSamples.find( ip );
|
||||||
if( sit == m_data.pendingSymbolSamples.end() )
|
if( sit == m_data.pendingSymbolSamples.end() )
|
||||||
{
|
{
|
||||||
m_data.pendingSymbolSamples.emplace( ip, Vector<SampleDataRange>( SampleDataRange { sd.time, ip } ) );
|
m_data.pendingSymbolSamples.emplace( ip, Vector<SampleDataRange>( SampleDataRange { sd.time, tid, ip } ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sit->second.push_back_non_empty( SampleDataRange { sd.time, ip } );
|
sit->second.push_back_non_empty( SampleDataRange { sd.time, tid, ip } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user