1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add cache for last accessed source location zones.

This commit is contained in:
Bartosz Taudul
2019-10-25 21:29:55 +02:00
parent b5419944aa
commit 1d0084aa28
2 changed files with 41 additions and 15 deletions
+12
View File
@@ -216,6 +216,9 @@ private:
std::pair<uint64_t, ContextSwitch*> ctxSwitchLast = std::make_pair( std::numeric_limits<uint64_t>::max(), nullptr );
uint64_t checkSrclocLast = 0;
std::pair<uint64_t, uint16_t> shrinkSrclocLast = std::make_pair( std::numeric_limits<uint64_t>::max(), 0 );
#ifndef TRACY_NO_STATISTICS
std::pair<uint16_t, SourceLocationZones*> srclocZonesLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
#endif
};
struct MbpsBlock
@@ -498,6 +501,15 @@ private:
return RetrieveThreadReal( thread );
}
#ifndef TRACY_NO_STATISTICS
SourceLocationZones* GetSourceLocationZones( uint16_t srcloc )
{
if( m_data.srclocZonesLast.first == srcloc ) return m_data.srclocZonesLast.second;
return GetSourceLocationZonesReal( srcloc );
}
SourceLocationZones* GetSourceLocationZonesReal( uint16_t srcloc );
#endif
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
void InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread, int64_t time );