mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00: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
|
||||
m_data.sourceLocationZonesReady = true;
|
||||
m_data.ctxUsageReady = true;
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
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();
|
||||
m_backgroundDone.store( true, std::memory_order_relaxed );
|
||||
} );
|
||||
@ -4862,6 +4865,14 @@ void Worker::ReconstructMemAllocPlot()
|
||||
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 )
|
||||
{
|
||||
uint64_t sz;
|
||||
|
@ -224,6 +224,11 @@ private:
|
||||
#else
|
||||
std::pair<uint16_t, uint64_t*> srclocCntLast = std::make_pair( std::numeric_limits<uint16_t>::max(), nullptr );
|
||||
#endif
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
Vector<ContextSwitchUsage> ctxUsage;
|
||||
bool ctxUsageReady = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct MbpsBlock
|
||||
@ -373,6 +378,7 @@ public:
|
||||
const SourceLocationZones& GetZonesForSourceLocation( int16_t srcloc ) const;
|
||||
const flat_hash_map<int16_t, SourceLocationZones, nohash<int16_t>>& GetSourceLocationZones() const { return m_data.sourceLocationZones; }
|
||||
bool AreSourceLocationZonesReady() const { return m_data.sourceLocationZonesReady; }
|
||||
bool IsCpuUsageReady() const { return m_data.ctxUsageReady; }
|
||||
#endif
|
||||
|
||||
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]; }
|
||||
|
||||
#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 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 );
|
||||
|
Loading…
Reference in New Issue
Block a user