mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Calculate min/max time spans for source locations.
This commit is contained in:
parent
43c3fe25ba
commit
0f1f7c6813
@ -1239,6 +1239,17 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
||||
assert( zone->end >= zone->start );
|
||||
|
||||
m_data.lastTime = std::max( m_data.lastTime, zone->end );
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||
assert( it != m_data.sourceLocationZones.end() );
|
||||
const auto timeSpan = zone->end - zone->start;
|
||||
if( timeSpan > 0 )
|
||||
{
|
||||
it->second.min = std::min( it->second.min, timeSpan );
|
||||
it->second.max = std::max( it->second.max, timeSpan );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Worker::ProcessFrameMark( const QueueFrameMark& ev )
|
||||
@ -1627,6 +1638,16 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||
assert( it != m_data.sourceLocationZones.end() );
|
||||
it->second.zones.push_back( zone );
|
||||
|
||||
if( zone->end != -1 )
|
||||
{
|
||||
const auto timeSpan = zone->end - zone->start;
|
||||
if( timeSpan > 0 )
|
||||
{
|
||||
it->second.min = std::min( it->second.min, timeSpan );
|
||||
it->second.max = std::max( it->second.max, timeSpan );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ReadTimeline( f, zone->child );
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __TRACYWORKER_HPP__
|
||||
|
||||
#include <atomic>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
@ -34,9 +35,11 @@ class Worker
|
||||
{
|
||||
struct SourceLocationZones
|
||||
{
|
||||
SourceLocationZones() {}
|
||||
SourceLocationZones() : min( std::numeric_limits<int64_t>::max() ), max( std::numeric_limits<int64_t>::min() ) {}
|
||||
|
||||
Vector<ZoneEvent*> zones;
|
||||
int64_t min;
|
||||
int64_t max;
|
||||
};
|
||||
|
||||
struct DataBlock
|
||||
|
Loading…
Reference in New Issue
Block a user