mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 05:33:53 +00:00
Calculate total self time of zones.
This commit is contained in:
parent
814cd1553d
commit
b7930f67da
@ -1499,7 +1499,7 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
|||||||
m_data.lastTime = std::max( m_data.lastTime, zone->end );
|
m_data.lastTime = std::max( m_data.lastTime, zone->end );
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
const auto timeSpan = zone->end - zone->start;
|
auto timeSpan = zone->end - zone->start;
|
||||||
if( timeSpan > 0 )
|
if( timeSpan > 0 )
|
||||||
{
|
{
|
||||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||||
@ -1507,6 +1507,12 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
|||||||
it->second.min = std::min( it->second.min, timeSpan );
|
it->second.min = std::min( it->second.min, timeSpan );
|
||||||
it->second.max = std::max( it->second.max, timeSpan );
|
it->second.max = std::max( it->second.max, timeSpan );
|
||||||
it->second.total += timeSpan;
|
it->second.total += timeSpan;
|
||||||
|
for( auto& v : zone->child )
|
||||||
|
{
|
||||||
|
const auto childSpan = std::max( 0ll, v->end - v->start );
|
||||||
|
timeSpan -= childSpan;
|
||||||
|
}
|
||||||
|
it->second.selfTotal += timeSpan;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2089,12 +2095,18 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread
|
|||||||
|
|
||||||
if( zone->end >= 0 )
|
if( zone->end >= 0 )
|
||||||
{
|
{
|
||||||
const auto timeSpan = zone->end - zone->start;
|
auto timeSpan = zone->end - zone->start;
|
||||||
if( timeSpan > 0 )
|
if( timeSpan > 0 )
|
||||||
{
|
{
|
||||||
it->second.min = std::min( it->second.min, timeSpan );
|
it->second.min = std::min( it->second.min, timeSpan );
|
||||||
it->second.max = std::max( it->second.max, timeSpan );
|
it->second.max = std::max( it->second.max, timeSpan );
|
||||||
it->second.total += timeSpan;
|
it->second.total += timeSpan;
|
||||||
|
for( auto& v : zone->child )
|
||||||
|
{
|
||||||
|
const auto childSpan = std::max( 0ll, v->end - v->start );
|
||||||
|
timeSpan -= childSpan;
|
||||||
|
}
|
||||||
|
it->second.selfTotal += timeSpan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,12 +60,14 @@ class Worker
|
|||||||
: min( std::numeric_limits<int64_t>::max() )
|
: min( std::numeric_limits<int64_t>::max() )
|
||||||
, max( std::numeric_limits<int64_t>::min() )
|
, max( std::numeric_limits<int64_t>::min() )
|
||||||
, total( 0 )
|
, total( 0 )
|
||||||
|
, selfTotal( 0 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Vector<ZoneThreadData> zones;
|
Vector<ZoneThreadData> zones;
|
||||||
int64_t min;
|
int64_t min;
|
||||||
int64_t max;
|
int64_t max;
|
||||||
int64_t total;
|
int64_t total;
|
||||||
|
int64_t selfTotal;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DataBlock
|
struct DataBlock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user