mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Collect child sample addresses.
This commit is contained in:
parent
2462e6cc7c
commit
a02575322f
@ -619,6 +619,15 @@ struct GhostZone
|
|||||||
|
|
||||||
enum { GhostZoneSize = sizeof( GhostZone ) };
|
enum { GhostZoneSize = sizeof( GhostZone ) };
|
||||||
|
|
||||||
|
|
||||||
|
struct ChildSample
|
||||||
|
{
|
||||||
|
Int48 time;
|
||||||
|
uint64_t addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { ChildSampleSize = sizeof( ChildSample ) };
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
|
@ -4507,9 +4507,9 @@ void SourceView::GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, c
|
|||||||
if( as.ipCountAsm.find( ip ) != as.ipCountAsm.end() ) continue;
|
if( as.ipCountAsm.find( ip ) != as.ipCountAsm.end() ) continue;
|
||||||
auto cp = worker.GetChildSamples( ip );
|
auto cp = worker.GetChildSamples( ip );
|
||||||
if( !cp ) continue;
|
if( !cp ) continue;
|
||||||
auto it = std::lower_bound( cp->begin(), cp->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.Val() < rhs; } );
|
auto it = std::lower_bound( cp->begin(), cp->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
if( it == cp->end() ) continue;
|
if( it == cp->end() ) continue;
|
||||||
auto end = std::lower_bound( it, cp->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.Val() < rhs; } );
|
auto end = std::lower_bound( it, cp->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
|
||||||
const auto ccnt = uint64_t( end - it );
|
const auto ccnt = uint64_t( end - it );
|
||||||
as.ipCountAsm.emplace( ip, AddrStat { 0, ccnt } );
|
as.ipCountAsm.emplace( ip, AddrStat { 0, ccnt } );
|
||||||
as.ipTotalAsm.ext += ccnt;
|
as.ipTotalAsm.ext += ccnt;
|
||||||
|
@ -2067,18 +2067,20 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
it->second.push_back_non_empty( SampleDataRange { time, tid, ip } );
|
it->second.push_back_non_empty( SampleDataRange { time, tid, ip } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto childAddr = GetCanonicalPointer( callstack[0] );
|
||||||
for( uint16_t i=1; i<callstack.size(); i++ )
|
for( uint16_t i=1; i<callstack.size(); i++ )
|
||||||
{
|
{
|
||||||
auto addr = GetCanonicalPointer( callstack[i] );
|
auto addr = GetCanonicalPointer( callstack[i] );
|
||||||
auto it = m_data.childSamples.find( addr );
|
auto it = m_data.childSamples.find( addr );
|
||||||
if( it == m_data.childSamples.end() )
|
if( it == m_data.childSamples.end() )
|
||||||
{
|
{
|
||||||
m_data.childSamples.emplace( addr, Vector<Int48>( time ) );
|
m_data.childSamples.emplace( addr, Vector<ChildSample>( ChildSample { time, childAddr } ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it->second.push_back_non_empty( time );
|
it->second.push_back_non_empty( ChildSample { time, childAddr } );
|
||||||
}
|
}
|
||||||
|
childAddr = addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2088,7 +2090,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
}
|
}
|
||||||
for( auto& v : m_data.childSamples )
|
for( auto& v : m_data.childSamples )
|
||||||
{
|
{
|
||||||
pdqsort_branchless( v.second.begin(), v.second.end(), []( const auto& lhs, const auto& rhs ) { return lhs.Val() < rhs.Val(); } );
|
pdqsort_branchless( v.second.begin(), v.second.end(), []( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs.time.Val(); } );
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock( m_data.lock );
|
std::lock_guard<std::mutex> lock( m_data.lock );
|
||||||
m_data.symbolSamplesReady = true;
|
m_data.symbolSamplesReady = true;
|
||||||
@ -2501,7 +2503,7 @@ const Vector<SampleDataRange>* Worker::GetSamplesForSymbol( uint64_t symAddr ) c
|
|||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vector<Int48>* Worker::GetChildSamples( uint64_t addr ) const
|
const Vector<ChildSample>* Worker::GetChildSamples( uint64_t addr ) const
|
||||||
{
|
{
|
||||||
assert( m_data.symbolSamplesReady );
|
assert( m_data.symbolSamplesReady );
|
||||||
auto it = m_data.childSamples.find( addr );
|
auto it = m_data.childSamples.find( addr );
|
||||||
@ -6353,18 +6355,20 @@ void Worker::ProcessCallstackSampleImplStats( const SampleData& sd, ThreadData&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto childAddr = GetCanonicalPointer( cs[0] );
|
||||||
for( uint16_t i=1; i<cs.size(); i++ )
|
for( uint16_t i=1; i<cs.size(); i++ )
|
||||||
{
|
{
|
||||||
auto addr = GetCanonicalPointer( cs[i] );
|
auto addr = GetCanonicalPointer( cs[i] );
|
||||||
auto it = m_data.childSamples.find( addr );
|
auto it = m_data.childSamples.find( addr );
|
||||||
if( it == m_data.childSamples.end() )
|
if( it == m_data.childSamples.end() )
|
||||||
{
|
{
|
||||||
m_data.childSamples.emplace( addr, Vector<Int48>( sd.time ) );
|
m_data.childSamples.emplace( addr, Vector<ChildSample>( ChildSample { sd.time, childAddr } ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
it->second.push_back_non_empty( sd.time );
|
it->second.push_back_non_empty( ChildSample { sd.time, childAddr } );
|
||||||
}
|
}
|
||||||
|
childAddr = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto framesKnown = UpdateSampleStatistics( callstack, 1, true );
|
const auto framesKnown = UpdateSampleStatistics( callstack, 1, true );
|
||||||
|
@ -301,7 +301,7 @@ private:
|
|||||||
unordered_flat_map<uint64_t, unordered_flat_map<CallstackFrameId, uint32_t, CallstackFrameIdHash, CallstackFrameIdCompare>> instructionPointersMap;
|
unordered_flat_map<uint64_t, unordered_flat_map<CallstackFrameId, uint32_t, CallstackFrameIdHash, CallstackFrameIdCompare>> instructionPointersMap;
|
||||||
unordered_flat_map<uint64_t, Vector<SampleDataRange>> symbolSamples;
|
unordered_flat_map<uint64_t, Vector<SampleDataRange>> symbolSamples;
|
||||||
unordered_flat_map<CallstackFrameId, Vector<SampleDataRange>, CallstackFrameIdHash, CallstackFrameIdCompare> pendingSymbolSamples;
|
unordered_flat_map<CallstackFrameId, Vector<SampleDataRange>, CallstackFrameIdHash, CallstackFrameIdCompare> pendingSymbolSamples;
|
||||||
unordered_flat_map<uint64_t, Vector<Int48>> childSamples;
|
unordered_flat_map<uint64_t, Vector<ChildSample>> childSamples;
|
||||||
bool newFramesWereReceived = false;
|
bool newFramesWereReceived = false;
|
||||||
bool callstackSamplesReady = false;
|
bool callstackSamplesReady = false;
|
||||||
bool newContextSwitchesReceived = false;
|
bool newContextSwitchesReceived = false;
|
||||||
@ -523,7 +523,7 @@ public:
|
|||||||
const VarArray<CallstackFrameId>& GetParentCallstack( uint32_t idx ) const { return *m_data.parentCallstackPayload[idx]; }
|
const VarArray<CallstackFrameId>& GetParentCallstack( uint32_t idx ) const { return *m_data.parentCallstackPayload[idx]; }
|
||||||
const CallstackFrameData* GetParentCallstackFrame( const CallstackFrameId& ptr ) const;
|
const CallstackFrameData* GetParentCallstackFrame( const CallstackFrameId& ptr ) const;
|
||||||
const Vector<SampleDataRange>* GetSamplesForSymbol( uint64_t symAddr ) const;
|
const Vector<SampleDataRange>* GetSamplesForSymbol( uint64_t symAddr ) const;
|
||||||
const Vector<Int48>* GetChildSamples( uint64_t addr ) const;
|
const Vector<ChildSample>* GetChildSamples( uint64_t addr ) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const CrashEvent& GetCrashEvent() const { return m_data.crashEvent; }
|
const CrashEvent& GetCrashEvent() const { return m_data.crashEvent; }
|
||||||
|
Loading…
Reference in New Issue
Block a user