mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Fixup source location zones pointers.
This commit is contained in:
parent
ae33aa4869
commit
e1e3bbbe3e
@ -2834,8 +2834,16 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
{
|
{
|
||||||
m_data.zonesCnt++;
|
m_data.zonesCnt++;
|
||||||
|
|
||||||
|
auto td = m_threadCtxData;
|
||||||
|
if( !td ) td = m_threadCtxData = NoticeThread( thread );
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
auto slz = GetSourceLocationZones( zone->SrcLoc() );
|
auto slz = GetSourceLocationZones( zone->SrcLoc() );
|
||||||
|
if( !td->stack.empty() )
|
||||||
|
{
|
||||||
|
assert( m_slzPointerMap.find( zone ) == m_slzPointerMap.end() );
|
||||||
|
m_slzPointerMap.emplace( zone, slz->zones.size() );
|
||||||
|
}
|
||||||
auto& ztd = slz->zones.push_next();
|
auto& ztd = slz->zones.push_next();
|
||||||
ztd.SetZone( zone );
|
ztd.SetZone( zone );
|
||||||
ztd.SetThread( CompressThread( thread ) );
|
ztd.SetThread( CompressThread( thread ) );
|
||||||
@ -2843,8 +2851,6 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
CountZoneStatistics( zone );
|
CountZoneStatistics( zone );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto td = m_threadCtxData;
|
|
||||||
if( !td ) td = m_threadCtxData = NoticeThread( thread );
|
|
||||||
td->count++;
|
td->count++;
|
||||||
if( td->stack.empty() )
|
if( td->stack.empty() )
|
||||||
{
|
{
|
||||||
@ -3654,12 +3660,28 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
|||||||
for( auto& ze : childVec )
|
for( auto& ze : childVec )
|
||||||
{
|
{
|
||||||
ZoneEvent* src = ze;
|
ZoneEvent* src = ze;
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
auto slz = GetSourceLocationZones( src->SrcLoc() );
|
||||||
|
auto slzit = m_slzPointerMap.find( src );
|
||||||
|
assert( slzit != m_slzPointerMap.end() );
|
||||||
|
slz->zones[slzit->second].SetZone( dst );
|
||||||
|
m_slzPointerMap.erase( slzit );
|
||||||
|
#endif
|
||||||
memcpy( dst++, src, sizeof( ZoneEvent ) );
|
memcpy( dst++, src, sizeof( ZoneEvent ) );
|
||||||
m_zoneEventPool.push_back( src );
|
m_zoneEventPool.push_back( src );
|
||||||
}
|
}
|
||||||
fitVec.swap( childVec );
|
fitVec.swap( childVec );
|
||||||
m_data.zoneVectorCache.push_back( std::move( fitVec ) );
|
m_data.zoneVectorCache.push_back( std::move( fitVec ) );
|
||||||
}
|
}
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( auto& z : childVec )
|
||||||
|
{
|
||||||
|
m_slzPointerMap.erase( z );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
|||||||
@ -703,6 +703,10 @@ private:
|
|||||||
std::condition_variable m_netWriteCv;
|
std::condition_variable m_netWriteCv;
|
||||||
|
|
||||||
Vector<ZoneEvent*> m_zoneEventPool;
|
Vector<ZoneEvent*> m_zoneEventPool;
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
flat_hash_map<ZoneEvent*, size_t, nohash<ZoneEvent*>> m_slzPointerMap;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user