Calculate total time spent in source location.

This simple solution doesn't handle recursion at all.
This commit is contained in:
Bartosz Taudul 2018-03-24 14:24:30 +01:00
parent 40a14292b3
commit a9e1a9bddb
2 changed files with 8 additions and 1 deletions

View File

@ -1271,6 +1271,7 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
assert( it != m_data.sourceLocationZones.end() ); assert( it != m_data.sourceLocationZones.end() );
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;
} }
#endif #endif
} }
@ -1671,6 +1672,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread
{ {
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;
} }
} }
#endif #endif

View File

@ -35,11 +35,16 @@ class Worker
struct SourceLocationZones struct SourceLocationZones
{ {
SourceLocationZones() : min( std::numeric_limits<int64_t>::max() ), max( std::numeric_limits<int64_t>::min() ) {} SourceLocationZones()
: min( std::numeric_limits<int64_t>::max() )
, max( std::numeric_limits<int64_t>::min() )
, total( 0 )
{}
Vector<ZoneThreadData> zones; Vector<ZoneThreadData> zones;
int64_t min; int64_t min;
int64_t max; int64_t max;
int64_t total;
}; };
struct DataBlock struct DataBlock