mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +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
|
SysTime
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PlotValueFormatting : uint8_t
|
||||||
|
{
|
||||||
|
Number,
|
||||||
|
Memory,
|
||||||
|
Percentage
|
||||||
|
};
|
||||||
|
|
||||||
struct PlotData
|
struct PlotData
|
||||||
{
|
{
|
||||||
uint64_t name;
|
uint64_t name;
|
||||||
@ -495,6 +502,7 @@ struct PlotData
|
|||||||
Vector<PlotItem> postpone;
|
Vector<PlotItem> postpone;
|
||||||
uint64_t postponeTime;
|
uint64_t postponeTime;
|
||||||
PlotType type;
|
PlotType type;
|
||||||
|
PlotValueFormatting format;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MemData
|
struct MemData
|
||||||
|
@ -7,7 +7,7 @@ namespace Version
|
|||||||
{
|
{
|
||||||
enum { Major = 0 };
|
enum { Major = 0 };
|
||||||
enum { Minor = 5 };
|
enum { Minor = 5 };
|
||||||
enum { Patch = 10 };
|
enum { Patch = 11 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,13 +1044,36 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
{
|
{
|
||||||
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
|
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
|
||||||
auto pd = m_slab.AllocInit<PlotData>();
|
auto pd = m_slab.AllocInit<PlotData>();
|
||||||
if( fileVer >= FileVersion( 0, 4, 5 ) )
|
if( fileVer >= FileVersion( 0, 5, 11 ) )
|
||||||
{
|
{
|
||||||
f.Read( pd->type );
|
f.Read( pd->type );
|
||||||
|
f.Read( pd->format );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pd->type = PlotType::User;
|
if( fileVer >= FileVersion( 0, 4, 5 ) )
|
||||||
|
{
|
||||||
|
f.Read( pd->type );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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->name );
|
||||||
f.Read( pd->min );
|
f.Read( pd->min );
|
||||||
@ -1094,7 +1117,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
{
|
{
|
||||||
for( uint64_t i=0; i<sz; i++ )
|
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 ) );
|
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:
|
case QueueType::PlotData:
|
||||||
ProcessPlotData( ev.plotData );
|
ProcessPlotData( ev.plotData );
|
||||||
break;
|
break;
|
||||||
|
case QueueType::PlotConfig:
|
||||||
|
ProcessPlotConfig( ev.plotConfig );
|
||||||
|
break;
|
||||||
case QueueType::Message:
|
case QueueType::Message:
|
||||||
ProcessMessage( ev.message );
|
ProcessMessage( ev.message );
|
||||||
break;
|
break;
|
||||||
@ -4091,6 +4121,7 @@ void Worker::ProcessPlotData( const QueuePlotData& ev )
|
|||||||
auto plot = m_slab.AllocInit<PlotData>();
|
auto plot = m_slab.AllocInit<PlotData>();
|
||||||
plot->name = name;
|
plot->name = name;
|
||||||
plot->type = PlotType::User;
|
plot->type = PlotType::User;
|
||||||
|
plot->format = PlotValueFormatting::Number;
|
||||||
return plot;
|
return plot;
|
||||||
}, [this]( uint64_t name ) {
|
}, [this]( uint64_t name ) {
|
||||||
Query( ServerQueryPlotName, 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 )
|
void Worker::ProcessMessage( const QueueMessage& ev )
|
||||||
{
|
{
|
||||||
auto it = m_pendingCustomStrings.find( ev.text );
|
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 = m_slab.AllocInit<PlotData>();
|
||||||
m_sysTimePlot->name = 0;
|
m_sysTimePlot->name = 0;
|
||||||
m_sysTimePlot->type = PlotType::SysTime;
|
m_sysTimePlot->type = PlotType::SysTime;
|
||||||
|
m_sysTimePlot->format = PlotValueFormatting::Percentage;
|
||||||
m_sysTimePlot->min = val;
|
m_sysTimePlot->min = val;
|
||||||
m_sysTimePlot->max = val;
|
m_sysTimePlot->max = val;
|
||||||
m_sysTimePlot->data.push_back( { time, 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 = m_slab.AllocInit<PlotData>();
|
||||||
m_data.memory.plot->name = 0;
|
m_data.memory.plot->name = 0;
|
||||||
m_data.memory.plot->type = PlotType::Memory;
|
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.memory.plot->data.push_back( { GetFrameBegin( *m_data.framesBase, 0 ), 0. } );
|
||||||
m_data.plots.Data().push_back( m_data.memory.plot );
|
m_data.plots.Data().push_back( m_data.memory.plot );
|
||||||
}
|
}
|
||||||
@ -4797,6 +4844,7 @@ void Worker::ReconstructMemAllocPlot()
|
|||||||
|
|
||||||
plot->name = 0;
|
plot->name = 0;
|
||||||
plot->type = PlotType::Memory;
|
plot->type = PlotType::Memory;
|
||||||
|
plot->format = PlotValueFormatting::Memory;
|
||||||
plot->data.reserve_exact( psz, m_slab );
|
plot->data.reserve_exact( psz, m_slab );
|
||||||
|
|
||||||
auto aptr = mem.data.begin();
|
auto aptr = mem.data.begin();
|
||||||
@ -5684,6 +5732,7 @@ void Worker::Write( FileWrite& f )
|
|||||||
{
|
{
|
||||||
if( plot->type == PlotType::Memory ) continue;
|
if( plot->type == PlotType::Memory ) continue;
|
||||||
f.Write( &plot->type, sizeof( plot->type ) );
|
f.Write( &plot->type, sizeof( plot->type ) );
|
||||||
|
f.Write( &plot->format, sizeof( plot->format ) );
|
||||||
f.Write( &plot->name, sizeof( plot->name ) );
|
f.Write( &plot->name, sizeof( plot->name ) );
|
||||||
f.Write( &plot->min, sizeof( plot->min ) );
|
f.Write( &plot->min, sizeof( plot->min ) );
|
||||||
f.Write( &plot->max, sizeof( plot->max ) );
|
f.Write( &plot->max, sizeof( plot->max ) );
|
||||||
|
@ -445,6 +445,7 @@ private:
|
|||||||
tracy_force_inline void ProcessLockSharedRelease( const QueueLockRelease& ev );
|
tracy_force_inline void ProcessLockSharedRelease( const QueueLockRelease& ev );
|
||||||
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
||||||
tracy_force_inline void ProcessPlotData( const QueuePlotData& 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 ProcessMessage( const QueueMessage& ev );
|
||||||
tracy_force_inline void ProcessMessageLiteral( const QueueMessage& ev );
|
tracy_force_inline void ProcessMessageLiteral( const QueueMessage& ev );
|
||||||
tracy_force_inline void ProcessMessageColor( const QueueMessageColor& ev );
|
tracy_force_inline void ProcessMessageColor( const QueueMessageColor& ev );
|
||||||
|
Loading…
Reference in New Issue
Block a user