mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-23 01:00:54 +00:00
Fix memory events not being attributed to fibers.
Alloc and free events stored the OS thread, so the memory view's Zone alloc/Zone free columns resolved the zone on the OS thread's timeline instead of the currently-running fiber. Attribute them to the active fiber the same way zone and message events are (follow ThreadData::fiber).
This commit is contained in:
@@ -6302,14 +6302,19 @@ MemEvent* Worker::ProcessMemAllocImpl( MemData& memdata, const QueueMemAlloc& ev
|
||||
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||
NoticeThread( ev.thread );
|
||||
|
||||
const auto thread = CompressThread( ev.thread );
|
||||
uint64_t tid = ev.thread;
|
||||
auto td = RetrieveThread( tid, m_data.threadDataLast );
|
||||
assert( td );
|
||||
if( td->fiber ) tid = td->fiber->id;
|
||||
|
||||
const auto thread = CompressThread( tid );
|
||||
|
||||
auto it = memdata.active.find( ev.ptr );
|
||||
if( it != memdata.active.end() )
|
||||
{
|
||||
if( !m_ignoreMemAllocFaults )
|
||||
{
|
||||
MemAllocTwiceFailure( ev.thread );
|
||||
MemAllocTwiceFailure( tid );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -6369,7 +6374,12 @@ MemEvent* Worker::ProcessMemFreeImpl( MemData& memdata, const QueueMemFree& ev )
|
||||
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||
NoticeThread( ev.thread );
|
||||
|
||||
auto mem = MemDataFree( memdata, it, time, CompressThread( ev.thread ) );
|
||||
uint64_t tid = ev.thread;
|
||||
auto td = RetrieveThread( tid, m_data.threadDataLast );
|
||||
assert( td );
|
||||
if( td->fiber ) tid = td->fiber->id;
|
||||
|
||||
auto mem = MemDataFree( memdata, it, time, CompressThread( tid ) );
|
||||
MemAllocChanged( memdata, time );
|
||||
return mem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user