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

Add non-reentrant stats to SourceLocationZones

Extend SourceLocationZones with fields to track the count
and time of non-reentrant zone events -- that is, zone
events which were the only appearances (at the time) of
those zones on their threads' stacks.
This commit is contained in:
Terence Rokop 2021-06-05 11:28:16 -07:00
parent c90e39e06e
commit 66053e37f7
No known key found for this signature in database
GPG Key ID: FB9F472D903AD4FD
2 changed files with 19 additions and 0 deletions

View File

@ -4798,6 +4798,13 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
if( slz->selfMin > selfSpan ) slz->selfMin = selfSpan;
if( slz->selfMax < selfSpan ) slz->selfMax = selfSpan;
slz->selfTotal += selfSpan;
if ( !isReentry )
{
slz->nonReentrantCount++;
if( slz->nonReentrantMin > timeSpan ) slz->nonReentrantMin = timeSpan;
if( slz->nonReentrantMax < timeSpan ) slz->nonReentrantMax = timeSpan;
slz->nonReentrantTotal += timeSpan;
}
if( !td->childTimeStack.empty() )
{
td->childTimeStack.back() += timeSpan;
@ -7068,6 +7075,14 @@ void Worker::ReconstructZoneStatistics( SrcLocCountMap& countMap, ZoneEvent& zon
if( slz.max < timeSpan ) slz.max = timeSpan;
slz.total += timeSpan;
slz.sumSq += double( timeSpan ) * timeSpan;
const auto isReentry = HasSrcLocCount( countMap, zone.SrcLoc() );
if ( !isReentry )
{
slz.nonReentrantCount++;
if( slz.nonReentrantMin > timeSpan ) slz.nonReentrantMin = timeSpan;
if( slz.nonReentrantMax < timeSpan ) slz.nonReentrantMax = timeSpan;
slz.nonReentrantTotal += timeSpan;
}
if( zone.HasChildren() )
{
auto& children = GetZoneChildren( zone.Child() );

View File

@ -184,6 +184,10 @@ private:
int64_t selfMin = std::numeric_limits<int64_t>::max();
int64_t selfMax = std::numeric_limits<int64_t>::min();
int64_t selfTotal = 0;
size_t nonReentrantCount = 0;
int64_t nonReentrantMin = std::numeric_limits<int64_t>::max();
int64_t nonReentrantMax = std::numeric_limits<int64_t>::min();
int64_t nonReentrantTotal = 0;
};
struct CallstackFrameIdHash