mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Don't call ReadTimeline() when there's nothing to read.
This commit is contained in:
parent
9dfa9c95cb
commit
81ff554c7d
@ -170,6 +170,11 @@ public:
|
||||
void reserve( size_t cap )
|
||||
{
|
||||
if( cap == 0 || cap <= Capacity() ) return;
|
||||
reserve_non_zero( cap );
|
||||
}
|
||||
|
||||
void reserve_non_zero( size_t cap )
|
||||
{
|
||||
cap--;
|
||||
cap |= cap >> 1;
|
||||
cap |= cap >> 2;
|
||||
|
@ -1549,11 +1549,29 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
vec.reserve( sz );
|
||||
if( sz != 0 )
|
||||
{
|
||||
ReadTimeline( f, vec, sz );
|
||||
}
|
||||
}
|
||||
|
||||
m_data.zonesCnt += sz;
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
if( sz != 0 )
|
||||
{
|
||||
ReadTimeline( f, vec, sz );
|
||||
}
|
||||
}
|
||||
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
||||
{
|
||||
assert( size != 0 );
|
||||
vec.reserve_non_zero( size );
|
||||
m_data.zonesCnt += size;
|
||||
|
||||
for( uint64_t i=0; i<size; i++ )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<ZoneEvent>();
|
||||
vec.push_back_no_space_check( zone );
|
||||
@ -1563,13 +1581,12 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
vec.reserve( sz );
|
||||
assert( size != 0 );
|
||||
vec.reserve_non_zero( size );
|
||||
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
for( uint64_t i=0; i<size; i++ )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<GpuEvent>();
|
||||
vec.push_back_no_space_check( zone );
|
||||
|
@ -171,8 +171,11 @@ private:
|
||||
|
||||
StringLocation StoreString( char* str, size_t sz );
|
||||
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec );
|
||||
void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec );
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec );
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec );
|
||||
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size );
|
||||
void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size );
|
||||
|
||||
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec );
|
||||
void WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec );
|
||||
|
Loading…
Reference in New Issue
Block a user