mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
memset on non-POD data is UB.
This commit is contained in:
parent
e579374504
commit
515443605d
@ -66,8 +66,6 @@ enum { SourceLocationSize = sizeof( SourceLocation ) };
|
|||||||
|
|
||||||
struct ZoneEvent
|
struct ZoneEvent
|
||||||
{
|
{
|
||||||
void Init() { memset( &child, 0, 12 ); }
|
|
||||||
|
|
||||||
int64_t start;
|
int64_t start;
|
||||||
int64_t end;
|
int64_t end;
|
||||||
int32_t srcloc;
|
int32_t srcloc;
|
||||||
@ -79,7 +77,6 @@ struct ZoneEvent
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum { ZoneEventSize = sizeof( ZoneEvent ) };
|
enum { ZoneEventSize = sizeof( ZoneEvent ) };
|
||||||
static_assert( sizeof( ZoneEvent::child ) == 13, "Adjust vector clear size!" );
|
|
||||||
|
|
||||||
|
|
||||||
struct LockEvent
|
struct LockEvent
|
||||||
@ -108,8 +105,6 @@ static_assert( std::numeric_limits<decltype(LockEvent::lockCount)>::max() >= Max
|
|||||||
|
|
||||||
struct GpuEvent
|
struct GpuEvent
|
||||||
{
|
{
|
||||||
void Init() { memset( &child, 0, 12 ); }
|
|
||||||
|
|
||||||
int64_t cpuStart;
|
int64_t cpuStart;
|
||||||
int64_t cpuEnd;
|
int64_t cpuEnd;
|
||||||
int64_t gpuStart;
|
int64_t gpuStart;
|
||||||
@ -120,7 +115,6 @@ struct GpuEvent
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum { GpuEventSize = sizeof( GpuEvent ) };
|
enum { GpuEventSize = sizeof( GpuEvent ) };
|
||||||
static_assert( sizeof( GpuEvent::child ) == 13, "Adjust vector clear size!" );
|
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@ public:
|
|||||||
Vector()
|
Vector()
|
||||||
: m_ptr( nullptr )
|
: m_ptr( nullptr )
|
||||||
, m_size( 0 )
|
, m_size( 0 )
|
||||||
, m_capacity( 0 )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -619,8 +619,7 @@ void View::Process( const QueueItem& ev )
|
|||||||
|
|
||||||
void View::ProcessZoneBegin( const QueueZoneBegin& ev )
|
void View::ProcessZoneBegin( const QueueZoneBegin& ev )
|
||||||
{
|
{
|
||||||
auto zone = m_slab.Alloc<ZoneEvent>();
|
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||||
zone->Init();
|
|
||||||
|
|
||||||
CheckSourceLocation( ev.srcloc );
|
CheckSourceLocation( ev.srcloc );
|
||||||
|
|
||||||
@ -639,8 +638,7 @@ void View::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev )
|
|||||||
auto it = m_pendingSourceLocationPayload.find( ev.srcloc );
|
auto it = m_pendingSourceLocationPayload.find( ev.srcloc );
|
||||||
assert( it != m_pendingSourceLocationPayload.end() );
|
assert( it != m_pendingSourceLocationPayload.end() );
|
||||||
|
|
||||||
auto zone = m_slab.Alloc<ZoneEvent>();
|
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||||
zone->Init();
|
|
||||||
|
|
||||||
zone->start = ev.time * m_timerMul;
|
zone->start = ev.time * m_timerMul;
|
||||||
zone->end = -1;
|
zone->end = -1;
|
||||||
@ -844,8 +842,7 @@ void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev )
|
|||||||
|
|
||||||
CheckSourceLocation( ev.srcloc );
|
CheckSourceLocation( ev.srcloc );
|
||||||
|
|
||||||
auto zone = m_slab.Alloc<GpuEvent>();
|
auto zone = m_slab.AllocInit<GpuEvent>();
|
||||||
zone->Init();
|
|
||||||
|
|
||||||
zone->cpuStart = ev.cpuTime * m_timerMul;
|
zone->cpuStart = ev.cpuTime * m_timerMul;
|
||||||
zone->cpuEnd = -1;
|
zone->cpuEnd = -1;
|
||||||
@ -3822,8 +3819,7 @@ void View::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
|||||||
|
|
||||||
for( uint64_t i=0; i<sz; i++ )
|
for( uint64_t i=0; i<sz; i++ )
|
||||||
{
|
{
|
||||||
auto zone = m_slab.Alloc<ZoneEvent>();
|
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||||
zone->Init();
|
|
||||||
|
|
||||||
m_zonesCnt++;
|
m_zonesCnt++;
|
||||||
vec.push_back( zone );
|
vec.push_back( zone );
|
||||||
@ -3846,8 +3842,7 @@ void View::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
|
|||||||
|
|
||||||
for( uint64_t i=0; i<sz; i++ )
|
for( uint64_t i=0; i<sz; i++ )
|
||||||
{
|
{
|
||||||
auto zone = m_slab.Alloc<GpuEvent>();
|
auto zone = m_slab.AllocInit<GpuEvent>();
|
||||||
zone->Init();
|
|
||||||
|
|
||||||
vec.push_back( zone );
|
vec.push_back( zone );
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user