mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Context switch usage reconstruction skeleton.
This commit is contained in:
parent
a62c4135ad
commit
50b96c757e
@ -259,6 +259,7 @@ Worker::Worker( const char* addr, int port )
|
|||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
m_data.sourceLocationZonesReady = true;
|
m_data.sourceLocationZonesReady = true;
|
||||||
|
m_data.ctxUsageReady = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } );
|
m_thread = std::thread( [this] { SetThreadName( "Tracy Worker" ); Exec(); } );
|
||||||
@ -1787,6 +1788,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
m_data.sourceLocationZonesReady = true;
|
m_data.sourceLocationZonesReady = true;
|
||||||
}
|
}
|
||||||
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
|
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
|
||||||
|
if( !m_data.ctxSwitch.empty() ) ReconstructContextSwitchUsage();
|
||||||
|
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
|
||||||
if( reconstructMemAllocPlot ) ReconstructMemAllocPlot();
|
if( reconstructMemAllocPlot ) ReconstructMemAllocPlot();
|
||||||
m_backgroundDone.store( true, std::memory_order_relaxed );
|
m_backgroundDone.store( true, std::memory_order_relaxed );
|
||||||
} );
|
} );
|
||||||
@ -4862,6 +4865,14 @@ void Worker::ReconstructMemAllocPlot()
|
|||||||
m_data.memory.plot = plot;
|
m_data.memory.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
void Worker::ReconstructContextSwitchUsage()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::shared_mutex> lock( m_data.lock );
|
||||||
|
m_data.ctxUsageReady = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx )
|
void Worker::ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx )
|
||||||
{
|
{
|
||||||
uint64_t sz;
|
uint64_t sz;
|
||||||
|
|||||||
@ -224,6 +224,11 @@ private:
|
|||||||
#else
|
#else
|
||||||
std::pair<uint16_t, uint64_t*> srclocCntLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
std::pair<uint16_t, uint64_t*> srclocCntLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
Vector<ContextSwitchUsage> ctxUsage;
|
||||||
|
bool ctxUsageReady = false;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MbpsBlock
|
struct MbpsBlock
|
||||||
@ -373,6 +378,7 @@ public:
|
|||||||
const SourceLocationZones& GetZonesForSourceLocation( int16_t srcloc ) const;
|
const SourceLocationZones& GetZonesForSourceLocation( int16_t srcloc ) const;
|
||||||
const flat_hash_map<int16_t, SourceLocationZones, nohash<int16_t>>& GetSourceLocationZones() const { return m_data.sourceLocationZones; }
|
const flat_hash_map<int16_t, SourceLocationZones, nohash<int16_t>>& GetSourceLocationZones() const { return m_data.sourceLocationZones; }
|
||||||
bool AreSourceLocationZonesReady() const { return m_data.sourceLocationZonesReady; }
|
bool AreSourceLocationZonesReady() const { return m_data.sourceLocationZonesReady; }
|
||||||
|
bool IsCpuUsageReady() const { return m_data.ctxUsageReady; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tracy_force_inline uint16_t CompressThread( uint64_t thread ) { return m_data.localThreadCompress.CompressThread( thread ); }
|
tracy_force_inline uint16_t CompressThread( uint64_t thread ) { return m_data.localThreadCompress.CompressThread( thread ); }
|
||||||
@ -555,6 +561,10 @@ private:
|
|||||||
|
|
||||||
tracy_force_inline Vector<short_ptr<ZoneEvent>>& GetZoneChildrenMutable( int32_t idx ) { return m_data.zoneChildren[idx]; }
|
tracy_force_inline Vector<short_ptr<ZoneEvent>>& GetZoneChildrenMutable( int32_t idx ) { return m_data.zoneChildren[idx]; }
|
||||||
|
|
||||||
|
#ifndef TRACY_NO_STATISTICS
|
||||||
|
void ReconstructContextSwitchUsage();
|
||||||
|
#endif
|
||||||
|
|
||||||
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx );
|
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int32_t& childIdx );
|
||||||
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );
|
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );
|
||||||
tracy_force_inline void ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int fileVer );
|
tracy_force_inline void ReadTimelinePre0510( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime, int fileVer );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user