Store memory event time and thread data together.

This commit is contained in:
Bartosz Taudul 2020-02-13 00:52:29 +01:00
parent f9b19631c0
commit cc0f1f514c
2 changed files with 6 additions and 5 deletions

View File

@ -291,6 +291,9 @@ struct MemEvent
tracy_force_inline uint16_t ThreadFree() const { return uint16_t( _time_thread_free ); } tracy_force_inline uint16_t ThreadFree() const { return uint16_t( _time_thread_free ); }
tracy_force_inline void SetThreadFree( uint16_t thread ) { memcpy( &_time_thread_free, &thread, 2 ); } tracy_force_inline void SetThreadFree( uint16_t thread ) { memcpy( &_time_thread_free, &thread, 2 ); }
tracy_force_inline void SetTimeThreadAlloc( int64_t time, uint16_t thread ) { time <<= 16; time |= thread; memcpy( &_time_thread_alloc, &time, 8 ); }
tracy_force_inline void SetTimeThreadFree( int64_t time, uint16_t thread ) { time <<= 16; time |= thread; memcpy( &_time_thread_free, &time, 8 ); }
uint64_t _ptr_csalloc1; uint64_t _ptr_csalloc1;
uint64_t _size_csalloc2; uint64_t _size_csalloc2;
Int24 csFree; Int24 csFree;

View File

@ -1163,19 +1163,17 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
mem->SetSize( size ); mem->SetSize( size );
mem->SetCsAlloc( csAlloc.Val() ); mem->SetCsAlloc( csAlloc.Val() );
refTime += timeAlloc; refTime += timeAlloc;
mem->SetTimeAlloc( refTime ); mem->SetTimeThreadAlloc( refTime, threadAlloc );
if( timeFree >= 0 ) if( timeFree >= 0 )
{ {
mem->SetTimeFree( timeFree + refTime ); mem->SetTimeThreadFree( timeFree + refTime, threadFree );
frees[fidx++] = i; frees[fidx++] = i;
} }
else else
{ {
mem->SetTimeFree( timeFree ); mem->SetTimeThreadFree( timeFree, threadFree );
active.emplace( ptr, i ); active.emplace( ptr, i );
} }
mem->SetThreadAlloc( threadAlloc );
mem->SetThreadFree( threadFree );
mem++; mem++;
} }
} }