mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Process and store plot value formatting.
This commit is contained in:
parent
907574e637
commit
661c4a417b
@ -486,6 +486,13 @@ enum class PlotType : uint8_t
|
||||
SysTime
|
||||
};
|
||||
|
||||
enum class PlotValueFormatting : uint8_t
|
||||
{
|
||||
Number,
|
||||
Memory,
|
||||
Percentage
|
||||
};
|
||||
|
||||
struct PlotData
|
||||
{
|
||||
uint64_t name;
|
||||
@ -495,6 +502,7 @@ struct PlotData
|
||||
Vector<PlotItem> postpone;
|
||||
uint64_t postponeTime;
|
||||
PlotType type;
|
||||
PlotValueFormatting format;
|
||||
};
|
||||
|
||||
struct MemData
|
||||
|
@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 5 };
|
||||
enum { Patch = 10 };
|
||||
enum { Patch = 11 };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1044,6 +1044,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
|
||||
auto pd = m_slab.AllocInit<PlotData>();
|
||||
if( fileVer >= FileVersion( 0, 5, 11 ) )
|
||||
{
|
||||
f.Read( pd->type );
|
||||
f.Read( pd->format );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fileVer >= FileVersion( 0, 4, 5 ) )
|
||||
{
|
||||
f.Read( pd->type );
|
||||
@ -1052,6 +1059,22 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
pd->type = PlotType::User;
|
||||
}
|
||||
switch( pd->type )
|
||||
{
|
||||
case PlotType::User:
|
||||
pd->format = PlotValueFormatting::Number;
|
||||
break;
|
||||
case PlotType::Memory:
|
||||
pd->format = PlotValueFormatting::Memory;
|
||||
break;
|
||||
case PlotType::SysTime:
|
||||
pd->format = PlotValueFormatting::Percentage;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
f.Read( pd->name );
|
||||
f.Read( pd->min );
|
||||
f.Read( pd->max );
|
||||
@ -1094,7 +1117,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
if( fileVer >= FileVersion( 0, 4, 5 ) )
|
||||
if( fileVer >= FileVersion( 0, 5, 11 ) )
|
||||
{
|
||||
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) );
|
||||
}
|
||||
else if( fileVer >= FileVersion( 0, 4, 5 ) )
|
||||
{
|
||||
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::type ) );
|
||||
}
|
||||
@ -3414,6 +3441,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::PlotData:
|
||||
ProcessPlotData( ev.plotData );
|
||||
break;
|
||||
case QueueType::PlotConfig:
|
||||
ProcessPlotConfig( ev.plotConfig );
|
||||
break;
|
||||
case QueueType::Message:
|
||||
ProcessMessage( ev.message );
|
||||
break;
|
||||
@ -4091,6 +4121,7 @@ void Worker::ProcessPlotData( const QueuePlotData& ev )
|
||||
auto plot = m_slab.AllocInit<PlotData>();
|
||||
plot->name = name;
|
||||
plot->type = PlotType::User;
|
||||
plot->format = PlotValueFormatting::Number;
|
||||
return plot;
|
||||
}, [this]( uint64_t name ) {
|
||||
Query( ServerQueryPlotName, name );
|
||||
@ -4117,6 +4148,20 @@ void Worker::ProcessPlotData( const QueuePlotData& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ProcessPlotConfig( const QueuePlotConfig& ev )
|
||||
{
|
||||
PlotData* plot = m_data.plots.Retrieve( ev.name, [this, &ev] ( uint64_t name ) {
|
||||
auto plot = m_slab.AllocInit<PlotData>();
|
||||
plot->name = name;
|
||||
plot->type = PlotType::User;
|
||||
return plot;
|
||||
}, [this]( uint64_t name ) {
|
||||
Query( ServerQueryPlotName, name );
|
||||
} );
|
||||
|
||||
plot->format = (PlotValueFormatting)ev.type;
|
||||
}
|
||||
|
||||
void Worker::ProcessMessage( const QueueMessage& ev )
|
||||
{
|
||||
auto it = m_pendingCustomStrings.find( ev.text );
|
||||
@ -4608,6 +4653,7 @@ void Worker::ProcessSysTime( const QueueSysTime& ev )
|
||||
m_sysTimePlot = m_slab.AllocInit<PlotData>();
|
||||
m_sysTimePlot->name = 0;
|
||||
m_sysTimePlot->type = PlotType::SysTime;
|
||||
m_sysTimePlot->format = PlotValueFormatting::Percentage;
|
||||
m_sysTimePlot->min = val;
|
||||
m_sysTimePlot->max = val;
|
||||
m_sysTimePlot->data.push_back( { time, val } );
|
||||
@ -4774,6 +4820,7 @@ void Worker::CreateMemAllocPlot()
|
||||
m_data.memory.plot = m_slab.AllocInit<PlotData>();
|
||||
m_data.memory.plot->name = 0;
|
||||
m_data.memory.plot->type = PlotType::Memory;
|
||||
m_data.memory.plot->format = PlotValueFormatting::Memory;
|
||||
m_data.memory.plot->data.push_back( { GetFrameBegin( *m_data.framesBase, 0 ), 0. } );
|
||||
m_data.plots.Data().push_back( m_data.memory.plot );
|
||||
}
|
||||
@ -4797,6 +4844,7 @@ void Worker::ReconstructMemAllocPlot()
|
||||
|
||||
plot->name = 0;
|
||||
plot->type = PlotType::Memory;
|
||||
plot->format = PlotValueFormatting::Memory;
|
||||
plot->data.reserve_exact( psz, m_slab );
|
||||
|
||||
auto aptr = mem.data.begin();
|
||||
@ -5684,6 +5732,7 @@ void Worker::Write( FileWrite& f )
|
||||
{
|
||||
if( plot->type == PlotType::Memory ) continue;
|
||||
f.Write( &plot->type, sizeof( plot->type ) );
|
||||
f.Write( &plot->format, sizeof( plot->format ) );
|
||||
f.Write( &plot->name, sizeof( plot->name ) );
|
||||
f.Write( &plot->min, sizeof( plot->min ) );
|
||||
f.Write( &plot->max, sizeof( plot->max ) );
|
||||
|
@ -445,6 +445,7 @@ private:
|
||||
tracy_force_inline void ProcessLockSharedRelease( const QueueLockRelease& ev );
|
||||
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
||||
tracy_force_inline void ProcessPlotData( const QueuePlotData& ev );
|
||||
tracy_force_inline void ProcessPlotConfig( const QueuePlotConfig& ev );
|
||||
tracy_force_inline void ProcessMessage( const QueueMessage& ev );
|
||||
tracy_force_inline void ProcessMessageLiteral( const QueueMessage& ev );
|
||||
tracy_force_inline void ProcessMessageColor( const QueueMessageColor& ev );
|
||||
|
Loading…
Reference in New Issue
Block a user