mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Put source location zone data into a struct.
This commit is contained in:
parent
f5b0f34827
commit
43c3fe25ba
@ -124,11 +124,11 @@ Worker::Worker( FileRead& f )
|
|||||||
m_data.sourceLocationZones.reserve( sle + sz );
|
m_data.sourceLocationZones.reserve( sle + sz );
|
||||||
for( uint64_t i=1; i<sle; i++ )
|
for( uint64_t i=1; i<sle; i++ )
|
||||||
{
|
{
|
||||||
m_data.sourceLocationZones.emplace( int32_t( i ), Vector<ZoneEvent*>() );
|
m_data.sourceLocationZones.emplace( int32_t( i ), SourceLocationZones() );
|
||||||
}
|
}
|
||||||
for( uint64_t i=0; i<sz; i++ )
|
for( uint64_t i=0; i<sz; i++ )
|
||||||
{
|
{
|
||||||
m_data.sourceLocationZones.emplace( -int32_t( i + 1 ), Vector<ZoneEvent*>() );
|
m_data.sourceLocationZones.emplace( -int32_t( i + 1 ), SourceLocationZones() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ const Vector<ZoneEvent*>& Worker::GetZonesForSourceLocation( int32_t srcloc ) co
|
|||||||
{
|
{
|
||||||
static const Vector<ZoneEvent*> empty;
|
static const Vector<ZoneEvent*> empty;
|
||||||
auto it = m_data.sourceLocationZones.find( srcloc );
|
auto it = m_data.sourceLocationZones.find( srcloc );
|
||||||
return it != m_data.sourceLocationZones.end() ? it->second : empty;
|
return it != m_data.sourceLocationZones.end() ? it->second.zones : empty;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ uint32_t Worker::NewShrinkedSourceLocation( uint64_t srcloc )
|
|||||||
const auto sz = m_data.sourceLocationExpand.size();
|
const auto sz = m_data.sourceLocationExpand.size();
|
||||||
m_data.sourceLocationExpand.push_back( srcloc );
|
m_data.sourceLocationExpand.push_back( srcloc );
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
m_data.sourceLocationZones.emplace( sz, Vector<ZoneEvent*>() );
|
m_data.sourceLocationZones.emplace( sz, SourceLocationZones() );
|
||||||
#endif
|
#endif
|
||||||
m_sourceLocationShrink.emplace( srcloc, sz );
|
m_sourceLocationShrink.emplace( srcloc, sz );
|
||||||
return sz;
|
return sz;
|
||||||
@ -701,7 +701,7 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||||
assert( it != m_data.sourceLocationZones.end() );
|
assert( it != m_data.sourceLocationZones.end() );
|
||||||
it->second.push_back( zone );
|
it->second.zones.push_back( zone );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto td = NoticeThread( thread );
|
auto td = NoticeThread( thread );
|
||||||
@ -969,7 +969,7 @@ void Worker::AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz )
|
|||||||
m_pendingSourceLocationPayload.emplace( ptr, -int32_t( idx + 1 ) );
|
m_pendingSourceLocationPayload.emplace( ptr, -int32_t( idx + 1 ) );
|
||||||
m_data.sourceLocationPayload.push_back( slptr );
|
m_data.sourceLocationPayload.push_back( slptr );
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
m_data.sourceLocationZones.emplace( -int32_t( idx + 1 ), Vector<ZoneEvent*>() );
|
m_data.sourceLocationZones.emplace( -int32_t( idx + 1 ), SourceLocationZones() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1626,7 +1626,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
|||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||||
assert( it != m_data.sourceLocationZones.end() );
|
assert( it != m_data.sourceLocationZones.end() );
|
||||||
it->second.push_back( zone );
|
it->second.zones.push_back( zone );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReadTimeline( f, zone->child );
|
ReadTimeline( f, zone->child );
|
||||||
|
|||||||
@ -32,6 +32,13 @@ struct nohash
|
|||||||
|
|
||||||
class Worker
|
class Worker
|
||||||
{
|
{
|
||||||
|
struct SourceLocationZones
|
||||||
|
{
|
||||||
|
SourceLocationZones() {}
|
||||||
|
|
||||||
|
Vector<ZoneEvent*> zones;
|
||||||
|
};
|
||||||
|
|
||||||
struct DataBlock
|
struct DataBlock
|
||||||
{
|
{
|
||||||
DataBlock() : zonesCnt( 0 ), lastTime( 0 ) {}
|
DataBlock() : zonesCnt( 0 ), lastTime( 0 ) {}
|
||||||
@ -55,7 +62,7 @@ class Worker
|
|||||||
flat_hash_map<SourceLocation*, uint32_t, SourceLocationHasher, SourceLocationComparator> sourceLocationPayloadMap;
|
flat_hash_map<SourceLocation*, uint32_t, SourceLocationHasher, SourceLocationComparator> sourceLocationPayloadMap;
|
||||||
Vector<uint64_t> sourceLocationExpand;
|
Vector<uint64_t> sourceLocationExpand;
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
flat_hash_map<int32_t, Vector<ZoneEvent*>, nohash<int32_t>> sourceLocationZones;
|
flat_hash_map<int32_t, SourceLocationZones, nohash<int32_t>> sourceLocationZones;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<uint32_t, LockMap> lockMap;
|
std::map<uint32_t, LockMap> lockMap;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user