mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Process callstack sample data.
This commit is contained in:
parent
054a6f8563
commit
437771ea85
@ -202,6 +202,15 @@ struct ZoneExtra
|
||||
enum { ZoneExtraSize = sizeof( ZoneExtra ) };
|
||||
|
||||
|
||||
struct SampleData
|
||||
{
|
||||
Int48 time;
|
||||
Int24 callstack;
|
||||
};
|
||||
|
||||
enum { SampleDataSize = sizeof( SampleData ) };
|
||||
|
||||
|
||||
struct LockEvent
|
||||
{
|
||||
enum class Type : uint8_t
|
||||
@ -475,6 +484,7 @@ struct ThreadData
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
Vector<int64_t> childTimeStack;
|
||||
#endif
|
||||
Vector<SampleData> samples;
|
||||
};
|
||||
|
||||
struct GpuCtxThreadData
|
||||
|
@ -3391,6 +3391,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::CallstackAlloc:
|
||||
ProcessCallstackAlloc( ev.callstackAlloc );
|
||||
break;
|
||||
case QueueType::CallstackSample:
|
||||
ProcessCallstackSample( ev.callstackSample );
|
||||
break;
|
||||
case QueueType::CallstackFrameSize:
|
||||
ProcessCallstackFrameSize( ev.callstackFrameSize );
|
||||
m_serverQuerySpaceLeft++;
|
||||
@ -4572,6 +4575,39 @@ void Worker::ProcessCallstackAlloc( const QueueCallstackAlloc& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ProcessCallstackSample( const QueueCallstackSample& ev )
|
||||
{
|
||||
assert( m_pendingCallstackPtr == ev.ptr );
|
||||
m_pendingCallstackPtr = 0;
|
||||
m_data.samplesCnt++;
|
||||
|
||||
const auto refTime = m_refTimeCtx + ev.time;
|
||||
m_refTimeCtx = refTime;
|
||||
const auto t = TscTime( refTime - m_data.baseTime );
|
||||
|
||||
SampleData sd;
|
||||
sd.time.SetVal( t );
|
||||
sd.callstack.SetVal( m_pendingCallstackId );
|
||||
|
||||
auto td = NoticeThread( ev.thread );
|
||||
if( td->samples.empty() )
|
||||
{
|
||||
td->samples.push_back( sd );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( td->samples.back().time.Val() <= t )
|
||||
{
|
||||
td->samples.push_back_non_empty( sd );
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto it = std::lower_bound( td->samples.begin(), td->samples.end(), t, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
|
||||
td->samples.insert( it, sd );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev )
|
||||
{
|
||||
assert( !m_callstackFrameStaging );
|
||||
|
@ -190,6 +190,7 @@ private:
|
||||
MemData memory;
|
||||
uint64_t zonesCnt = 0;
|
||||
uint64_t gpuCnt = 0;
|
||||
uint64_t samplesCnt = 0;
|
||||
int64_t baseTime = 0;
|
||||
int64_t lastTime = 0;
|
||||
uint64_t frameOffset = 0;
|
||||
@ -511,6 +512,7 @@ private:
|
||||
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev );
|
||||
tracy_force_inline void ProcessCallstack( const QueueCallstack& ev );
|
||||
tracy_force_inline void ProcessCallstackAlloc( const QueueCallstackAlloc& ev );
|
||||
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );
|
||||
tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev );
|
||||
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
|
||||
tracy_force_inline void ProcessCrashReport( const QueueCrashReport& ev );
|
||||
|
Loading…
Reference in New Issue
Block a user