mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 06:34:36 +00:00
Process memory pool discard events.
This commit is contained in:
parent
cacd71c401
commit
872367f068
@ -4625,6 +4625,12 @@ bool Worker::Process( const QueueItem& ev )
|
|||||||
case QueueType::MemFreeCallstackNamed:
|
case QueueType::MemFreeCallstackNamed:
|
||||||
ProcessMemFreeCallstackNamed( ev.memFree );
|
ProcessMemFreeCallstackNamed( ev.memFree );
|
||||||
break;
|
break;
|
||||||
|
case QueueType::MemDiscard:
|
||||||
|
ProcessMemDiscard( ev.memDiscard );
|
||||||
|
break;
|
||||||
|
case QueueType::MemDiscardCallstack:
|
||||||
|
ProcessMemDiscardCallstack( ev.memDiscard );
|
||||||
|
break;
|
||||||
case QueueType::CallstackSerial:
|
case QueueType::CallstackSerial:
|
||||||
ProcessCallstackSerial();
|
ProcessCallstackSerial();
|
||||||
break;
|
break;
|
||||||
@ -6154,6 +6160,65 @@ void Worker::ProcessMemFreeCallstackNamed( const QueueMemFree& ev )
|
|||||||
m_serialNextCallstack = 0;
|
m_serialNextCallstack = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Worker::ProcessMemDiscard( const QueueMemDiscard& ev )
|
||||||
|
{
|
||||||
|
assert( m_memNamePayload == 0 );
|
||||||
|
auto it = m_data.memNameMap.find( ev.name );
|
||||||
|
if( it == m_data.memNameMap.end() ) return;
|
||||||
|
|
||||||
|
const auto refTime = RefTime( m_refTimeSerial, ev.time );
|
||||||
|
auto& memdata = *it->second;
|
||||||
|
|
||||||
|
const auto time = TscTime( refTime );
|
||||||
|
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||||
|
NoticeThread( ev.thread );
|
||||||
|
const auto thread = CompressThread( ev.thread );
|
||||||
|
|
||||||
|
for( auto& v : memdata.active )
|
||||||
|
{
|
||||||
|
memdata.frees.push_back( v.second );
|
||||||
|
auto& mem = memdata.data[v.second];
|
||||||
|
mem.SetTimeThreadFree( time, thread );
|
||||||
|
memdata.usage -= mem.Size();
|
||||||
|
MemAllocChanged( memdata, time );
|
||||||
|
}
|
||||||
|
|
||||||
|
memdata.active.clear();
|
||||||
|
assert( memdata.usage == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Worker::ProcessMemDiscardCallstack( const QueueMemDiscard& ev )
|
||||||
|
{
|
||||||
|
assert( m_serialNextCallstack != 0 );
|
||||||
|
auto cs = m_serialNextCallstack;
|
||||||
|
m_serialNextCallstack = 0;
|
||||||
|
|
||||||
|
assert( m_memNamePayload == 0 );
|
||||||
|
auto it = m_data.memNameMap.find( ev.name );
|
||||||
|
if( it == m_data.memNameMap.end() ) return;
|
||||||
|
|
||||||
|
const auto refTime = RefTime( m_refTimeSerial, ev.time );
|
||||||
|
auto& memdata = *it->second;
|
||||||
|
|
||||||
|
const auto time = TscTime( refTime );
|
||||||
|
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||||
|
NoticeThread( ev.thread );
|
||||||
|
const auto thread = CompressThread( ev.thread );
|
||||||
|
|
||||||
|
for( auto& v : memdata.active )
|
||||||
|
{
|
||||||
|
memdata.frees.push_back( v.second );
|
||||||
|
auto& mem = memdata.data[v.second];
|
||||||
|
mem.SetTimeThreadFree( time, thread );
|
||||||
|
mem.csFree.SetVal( cs );
|
||||||
|
memdata.usage -= mem.Size();
|
||||||
|
MemAllocChanged( memdata, time );
|
||||||
|
}
|
||||||
|
|
||||||
|
memdata.active.clear();
|
||||||
|
assert( memdata.usage == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
void Worker::ProcessCallstackSerial()
|
void Worker::ProcessCallstackSerial()
|
||||||
{
|
{
|
||||||
assert( m_pendingCallstackId != 0 );
|
assert( m_pendingCallstackId != 0 );
|
||||||
|
@ -745,10 +745,12 @@ private:
|
|||||||
tracy_force_inline MemEvent* ProcessMemAllocNamed( const QueueMemAlloc& ev );
|
tracy_force_inline MemEvent* ProcessMemAllocNamed( const QueueMemAlloc& ev );
|
||||||
tracy_force_inline MemEvent* ProcessMemFree( const QueueMemFree& ev );
|
tracy_force_inline MemEvent* ProcessMemFree( const QueueMemFree& ev );
|
||||||
tracy_force_inline MemEvent* ProcessMemFreeNamed( const QueueMemFree& ev );
|
tracy_force_inline MemEvent* ProcessMemFreeNamed( const QueueMemFree& ev );
|
||||||
|
tracy_force_inline void ProcessMemDiscard( const QueueMemDiscard& ev );
|
||||||
tracy_force_inline void ProcessMemAllocCallstack( const QueueMemAlloc& ev );
|
tracy_force_inline void ProcessMemAllocCallstack( const QueueMemAlloc& ev );
|
||||||
tracy_force_inline void ProcessMemAllocCallstackNamed( const QueueMemAlloc& ev );
|
tracy_force_inline void ProcessMemAllocCallstackNamed( const QueueMemAlloc& ev );
|
||||||
tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev );
|
tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev );
|
||||||
tracy_force_inline void ProcessMemFreeCallstackNamed( const QueueMemFree& ev );
|
tracy_force_inline void ProcessMemFreeCallstackNamed( const QueueMemFree& ev );
|
||||||
|
tracy_force_inline void ProcessMemDiscardCallstack( const QueueMemDiscard& ev );
|
||||||
tracy_force_inline void ProcessCallstackSerial();
|
tracy_force_inline void ProcessCallstackSerial();
|
||||||
tracy_force_inline void ProcessCallstack();
|
tracy_force_inline void ProcessCallstack();
|
||||||
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );
|
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );
|
||||||
|
Loading…
Reference in New Issue
Block a user