mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Read/write LockEvent data in one go.
This commit is contained in:
parent
c5133e0b4e
commit
bc84ebc338
@ -103,8 +103,10 @@ struct LockEvent
|
|||||||
int64_t time;
|
int64_t time;
|
||||||
int32_t srcloc;
|
int32_t srcloc;
|
||||||
uint8_t thread;
|
uint8_t thread;
|
||||||
uint8_t lockingThread;
|
|
||||||
Type type;
|
Type type;
|
||||||
|
// All above is read/saved as-is.
|
||||||
|
|
||||||
|
uint8_t lockingThread;
|
||||||
uint8_t lockCount;
|
uint8_t lockCount;
|
||||||
uint64_t waitList;
|
uint64_t waitList;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -334,10 +334,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
|||||||
for( uint64_t i=0; i<tsz; i++ )
|
for( uint64_t i=0; i<tsz; i++ )
|
||||||
{
|
{
|
||||||
auto lev = m_slab.Alloc<LockEvent>();
|
auto lev = m_slab.Alloc<LockEvent>();
|
||||||
f.Read( &lev->time, sizeof( lev->time ) );
|
f.Read( lev, sizeof( LockEvent::time ) + sizeof( LockEvent::srcloc ) + sizeof( LockEvent::thread ) + sizeof( LockEvent::type ) );
|
||||||
f.Read( &lev->srcloc, sizeof( lev->srcloc ) );
|
|
||||||
f.Read( &lev->thread, sizeof( lev->thread ) );
|
|
||||||
f.Read( &lev->type, sizeof( lev->type ) );
|
|
||||||
*ptr++ = lev;
|
*ptr++ = lev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,10 +343,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
|||||||
for( uint64_t i=0; i<tsz; i++ )
|
for( uint64_t i=0; i<tsz; i++ )
|
||||||
{
|
{
|
||||||
auto lev = m_slab.Alloc<LockEventShared>();
|
auto lev = m_slab.Alloc<LockEventShared>();
|
||||||
f.Read( &lev->time, sizeof( lev->time ) );
|
f.Read( lev, sizeof( LockEventShared::time ) + sizeof( LockEventShared::srcloc ) + sizeof( LockEventShared::thread ) + sizeof( LockEventShared::type ) );
|
||||||
f.Read( &lev->srcloc, sizeof( lev->srcloc ) );
|
|
||||||
f.Read( &lev->thread, sizeof( lev->thread ) );
|
|
||||||
f.Read( &lev->type, sizeof( lev->type ) );
|
|
||||||
*ptr++ = lev;
|
*ptr++ = lev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,9 +355,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
|||||||
for( uint64_t i=0; i<tsz; i++ )
|
for( uint64_t i=0; i<tsz; i++ )
|
||||||
{
|
{
|
||||||
auto lev = m_slab.Alloc<LockEvent>();
|
auto lev = m_slab.Alloc<LockEvent>();
|
||||||
f.Read( &lev->time, sizeof( lev->time ) );
|
f.Read( lev, sizeof( LockEvent::time ) + sizeof( LockEvent::srcloc ) + sizeof( LockEvent::thread ) );
|
||||||
f.Read( &lev->srcloc, sizeof( lev->srcloc ) );
|
|
||||||
f.Read( &lev->thread, sizeof( lev->thread ) );
|
|
||||||
f.Skip( sizeof( uint8_t ) );
|
f.Skip( sizeof( uint8_t ) );
|
||||||
f.Read( &lev->type, sizeof( lev->type ) );
|
f.Read( &lev->type, sizeof( lev->type ) );
|
||||||
f.Skip( sizeof( uint8_t ) + sizeof( uint64_t ) );
|
f.Skip( sizeof( uint8_t ) + sizeof( uint64_t ) );
|
||||||
@ -375,9 +367,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
|||||||
for( uint64_t i=0; i<tsz; i++ )
|
for( uint64_t i=0; i<tsz; i++ )
|
||||||
{
|
{
|
||||||
auto lev = m_slab.Alloc<LockEventShared>();
|
auto lev = m_slab.Alloc<LockEventShared>();
|
||||||
f.Read( &lev->time, sizeof( lev->time ) );
|
f.Read( lev, sizeof( LockEventShared::time ) + sizeof( LockEventShared::srcloc ) + sizeof( LockEventShared::thread ) );
|
||||||
f.Read( &lev->srcloc, sizeof( lev->srcloc ) );
|
|
||||||
f.Read( &lev->thread, sizeof( lev->thread ) );
|
|
||||||
f.Skip( sizeof( uint8_t ) );
|
f.Skip( sizeof( uint8_t ) );
|
||||||
f.Read( &lev->type, sizeof( lev->type ) );
|
f.Read( &lev->type, sizeof( lev->type ) );
|
||||||
f.Skip( sizeof( uint8_t ) + sizeof( uint64_t ) * 3 );
|
f.Skip( sizeof( uint8_t ) + sizeof( uint64_t ) * 3 );
|
||||||
@ -2138,10 +2128,7 @@ void Worker::Write( FileWrite& f )
|
|||||||
f.Write( &sz, sizeof( sz ) );
|
f.Write( &sz, sizeof( sz ) );
|
||||||
for( auto& lev : v.second.timeline )
|
for( auto& lev : v.second.timeline )
|
||||||
{
|
{
|
||||||
f.Write( &lev->time, sizeof( lev->time ) );
|
f.Write( lev, sizeof( LockEvent::time ) + sizeof( LockEvent::srcloc ) + sizeof( LockEvent::thread ) + sizeof( LockEvent::type ) );
|
||||||
f.Write( &lev->srcloc, sizeof( lev->srcloc ) );
|
|
||||||
f.Write( &lev->thread, sizeof( lev->thread ) );
|
|
||||||
f.Write( &lev->type, sizeof( lev->type ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user