mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Cache source location zones counter search.
This commit is contained in:
parent
dfe99c2604
commit
01985f50ef
@ -2609,7 +2609,9 @@ int16_t Worker::NewShrinkedSourceLocation( uint64_t srcloc )
|
|||||||
m_data.srclocZonesLast.first = sz;
|
m_data.srclocZonesLast.first = sz;
|
||||||
m_data.srclocZonesLast.second = &res.first->second;
|
m_data.srclocZonesLast.second = &res.first->second;
|
||||||
#else
|
#else
|
||||||
m_data.sourceLocationZonesCnt.emplace( sz, 0 );
|
auto res = m_data.sourceLocationZonesCnt.emplace( sz, 0 );
|
||||||
|
m_data.srclocCntLast.first = sz;
|
||||||
|
m_data.srclocCntLast.second = &res.first->second;
|
||||||
#endif
|
#endif
|
||||||
m_sourceLocationShrink.emplace( srcloc, sz );
|
m_sourceLocationShrink.emplace( srcloc, sz );
|
||||||
m_data.shrinkSrclocLast.first = srcloc;
|
m_data.shrinkSrclocLast.first = srcloc;
|
||||||
@ -2688,6 +2690,15 @@ Worker::SourceLocationZones* Worker::GetSourceLocationZonesReal( uint16_t srcloc
|
|||||||
m_data.srclocZonesLast.second = &it->second;
|
m_data.srclocZonesLast.second = &it->second;
|
||||||
return &it->second;
|
return &it->second;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
uint64_t* Worker::GetSourceLocationZonesCntReal( uint16_t srcloc )
|
||||||
|
{
|
||||||
|
auto it = m_data.sourceLocationZonesCnt.find( srcloc );
|
||||||
|
assert( it != m_data.sourceLocationZonesCnt.end() );
|
||||||
|
m_data.srclocCntLast.first = srcloc;
|
||||||
|
m_data.srclocCntLast.second = &it->second;
|
||||||
|
return &it->second;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const ThreadData* Worker::GetThreadData( uint64_t tid ) const
|
const ThreadData* Worker::GetThreadData( uint64_t tid ) const
|
||||||
@ -2721,9 +2732,8 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
ztd.SetZone( zone );
|
ztd.SetZone( zone );
|
||||||
ztd.SetThread( CompressThread( thread ) );
|
ztd.SetThread( CompressThread( thread ) );
|
||||||
#else
|
#else
|
||||||
auto it = m_data.sourceLocationZonesCnt.find( zone->SrcLoc() );
|
auto cnt = GetSourceLocationZonesCnt( zone->SrcLoc() );
|
||||||
assert( it != m_data.sourceLocationZonesCnt.end() );
|
(*cnt)++;
|
||||||
it->second++;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto td = NoticeThread( thread );
|
auto td = NoticeThread( thread );
|
||||||
@ -2887,14 +2897,16 @@ void Worker::AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz )
|
|||||||
m_data.sourceLocationPayloadMap.emplace( slptr, idx );
|
m_data.sourceLocationPayloadMap.emplace( slptr, idx );
|
||||||
m_pendingSourceLocationPayload.emplace( ptr, -int16_t( idx + 1 ) );
|
m_pendingSourceLocationPayload.emplace( ptr, -int16_t( idx + 1 ) );
|
||||||
m_data.sourceLocationPayload.push_back( slptr );
|
m_data.sourceLocationPayload.push_back( slptr );
|
||||||
#ifndef TRACY_NO_STATISTICS
|
|
||||||
const auto key = -int16_t( idx + 1 );
|
const auto key = -int16_t( idx + 1 );
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
auto res = m_data.sourceLocationZones.emplace( key, SourceLocationZones() );
|
auto res = m_data.sourceLocationZones.emplace( key, SourceLocationZones() );
|
||||||
m_data.srclocZonesLast.first = key;
|
m_data.srclocZonesLast.first = key;
|
||||||
m_data.srclocZonesLast.second = &res.first->second;
|
m_data.srclocZonesLast.second = &res.first->second;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
m_data.sourceLocationZonesCnt.emplace( -int16_t( idx + 1 ), 0 );
|
auto res = m_data.sourceLocationZonesCnt.emplace( key, 0 );
|
||||||
|
m_data.srclocCntLast.first = key;
|
||||||
|
m_data.srclocCntLast.second = &res.first->second;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -218,6 +218,8 @@ private:
|
|||||||
std::pair<uint64_t, uint16_t> shrinkSrclocLast = std::make_pair( std::numeric_limits<uint64_t>::max(), 0 );
|
std::pair<uint64_t, uint16_t> shrinkSrclocLast = std::make_pair( std::numeric_limits<uint64_t>::max(), 0 );
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
std::pair<uint16_t, SourceLocationZones*> srclocZonesLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
std::pair<uint16_t, SourceLocationZones*> srclocZonesLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
||||||
|
#else
|
||||||
|
std::pair<uint16_t, uint64_t*> srclocCntLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -508,6 +510,13 @@ private:
|
|||||||
return GetSourceLocationZonesReal( srcloc );
|
return GetSourceLocationZonesReal( srcloc );
|
||||||
}
|
}
|
||||||
SourceLocationZones* GetSourceLocationZonesReal( uint16_t srcloc );
|
SourceLocationZones* GetSourceLocationZonesReal( uint16_t srcloc );
|
||||||
|
#else
|
||||||
|
uint64_t* GetSourceLocationZonesCnt( uint16_t srcloc )
|
||||||
|
{
|
||||||
|
if( m_data.srclocCntLast.first == srcloc ) return m_data.srclocCntLast.second;
|
||||||
|
return GetSourceLocationZonesCntReal( srcloc );
|
||||||
|
}
|
||||||
|
uint64_t* GetSourceLocationZonesCntReal( uint16_t srcloc );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
|
tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread );
|
||||||
|
Loading…
Reference in New Issue
Block a user