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
2 changed files with 19 additions and 0 deletions
+15
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() );