Pack frame identifiers in ghost zones.

This commit is contained in:
Bartosz Taudul 2020-03-10 22:04:12 +01:00
parent ead597bacc
commit b89874850f
3 changed files with 18 additions and 4 deletions

View File

@ -504,7 +504,7 @@ enum { FrameImageSize = sizeof( FrameImage ) };
struct GhostZone
{
Int48 start, end;
CallstackFrameId frame;
Int24 frame;
int32_t child;
};

View File

@ -1763,16 +1763,28 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
do
{
auto& entry = cs[idx];
uint32_t fid;
auto it = m_data.ghostFramesMap.find( entry.data );
if( it == m_data.ghostFramesMap.end() )
{
fid = uint32_t( m_data.ghostFrames.size() );
m_data.ghostFrames.push_back( entry );
m_data.ghostFramesMap.emplace( entry.data, fid );
}
else
{
fid = it->second;
}
if( vec->empty() )
{
gcnt++;
auto& zone = vec->push_next();
zone.start.SetVal( time );
zone.end.SetVal( time + m_samplingPeriod );
zone.frame = entry;
zone.frame.SetVal( fid );
zone.child = -1;
}
else if( vec->back().frame == entry )
else if( vec->back().frame.Val() == fid )
{
auto& zone = vec->back();
zone.end.SetVal( time + m_samplingPeriod );
@ -1784,7 +1796,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
auto& zone = vec->push_next();
zone.start.SetVal( time );
zone.end.SetVal( time + m_samplingPeriod );
zone.frame = entry;
zone.frame.SetVal( fid );
zone.child = -1;
}
if( idx > 0 )

View File

@ -245,6 +245,8 @@ private:
Vector<Vector<short_ptr<GpuEvent>>> gpuChildren;
#ifndef TRACY_NO_STATISTICS
Vector<Vector<GhostZone>> ghostChildren;
Vector<CallstackFrameId> ghostFrames;
unordered_flat_map<uint64_t, uint32_t> ghostFramesMap;
#endif
Vector<Vector<short_ptr<ZoneEvent>>> zoneVectorCache;