mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Process CPU usage reports.
This commit is contained in:
parent
9f4f5bcb63
commit
e9baa80bf3
@ -265,7 +265,8 @@ struct PlotItem
|
||||
enum class PlotType
|
||||
{
|
||||
User,
|
||||
Memory
|
||||
Memory,
|
||||
SysTime
|
||||
};
|
||||
|
||||
struct PlotData
|
||||
|
@ -8862,6 +8862,12 @@ const char* View::GetPlotName( const PlotData* plot ) const
|
||||
return ICON_FA_MEMORY " Memory usage";
|
||||
#else
|
||||
return "Memory usage";
|
||||
#endif
|
||||
case PlotType::SysTime:
|
||||
#ifdef TRACY_EXTENDED_FONT
|
||||
return ICON_FA_TACHOMETER_ALT " CPU usage";
|
||||
#else
|
||||
return "CPU usage";
|
||||
#endif
|
||||
default:
|
||||
assert( false );
|
||||
|
@ -2277,6 +2277,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::CrashReport:
|
||||
ProcessCrashReport( ev.crashReport );
|
||||
break;
|
||||
case QueueType::SysTimeReport:
|
||||
ProcessSysTime( ev.sysTime );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
@ -3096,6 +3099,30 @@ void Worker::ProcessCrashReport( const QueueCrashReport& ev )
|
||||
m_data.m_crashEvent.callstack = 0;
|
||||
}
|
||||
|
||||
void Worker::ProcessSysTime( const QueueSysTime& ev )
|
||||
{
|
||||
const auto time = TscTime( ev.time );
|
||||
const auto val = ev.sysTime;
|
||||
if( !m_sysTimePlot )
|
||||
{
|
||||
m_sysTimePlot = m_slab.AllocInit<PlotData>();
|
||||
m_sysTimePlot->name = 0;
|
||||
m_sysTimePlot->type = PlotType::SysTime;
|
||||
m_sysTimePlot->min = val;
|
||||
m_sysTimePlot->max = val;
|
||||
m_sysTimePlot->data.push_back( { time, val } );
|
||||
m_data.plots.Data().push_back( m_sysTimePlot );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( !m_sysTimePlot->data.empty() );
|
||||
assert( m_sysTimePlot->data.back().time <= time );
|
||||
if( m_sysTimePlot->min > val ) m_sysTimePlot->min = val;
|
||||
else if( m_sysTimePlot->max < val ) m_sysTimePlot->max = val;
|
||||
m_sysTimePlot->data.push_back_non_empty( { time, val } );
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::MemAllocChanged( int64_t time )
|
||||
{
|
||||
const auto val = (double)m_data.memory.usage;
|
||||
|
@ -340,6 +340,7 @@ private:
|
||||
tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev );
|
||||
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
|
||||
tracy_force_inline void ProcessCrashReport( const QueueCrashReport& ev );
|
||||
tracy_force_inline void ProcessSysTime( const QueueSysTime& ev );
|
||||
|
||||
tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev );
|
||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev );
|
||||
@ -466,6 +467,8 @@ private:
|
||||
|
||||
Failure m_failure = Failure::None;
|
||||
FailureData m_failureData;
|
||||
|
||||
PlotData* m_sysTimePlot = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user