Include custom color in plot configuration.

This commit is contained in:
Bartosz Taudul 2022-07-24 13:42:25 +02:00
parent 1dfe36e962
commit b026e09a09
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 12 additions and 2 deletions

View File

@ -749,6 +749,7 @@ struct PlotData
PlotValueFormatting format; PlotValueFormatting format;
uint8_t showSteps; uint8_t showSteps;
uint8_t fill; uint8_t fill;
uint32_t color;
}; };
struct MemData struct MemData

View File

@ -456,6 +456,7 @@ Worker::Worker( const char* name, const char* program, const std::vector<ImportE
plot->format = v.format; plot->format = v.format;
plot->showSteps = false; plot->showSteps = false;
plot->fill = true; plot->fill = true;
plot->color = 0;
double sum = 0; double sum = 0;
double min = v.data.begin()->second; double min = v.data.begin()->second;
@ -1105,7 +1106,7 @@ 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>();
uint64_t psz; uint64_t psz;
f.Read9( pd->type, pd->format, pd->showSteps, pd->fill, pd->name, pd->min, pd->max, pd->sum, psz ); f.Read10( pd->type, pd->format, pd->showSteps, pd->fill, pd->color, pd->name, pd->min, pd->max, pd->sum, psz );
pd->data.reserve_exact( psz, m_slab ); pd->data.reserve_exact( psz, m_slab );
auto ptr = pd->data.data(); auto ptr = pd->data.data();
int64_t refTime = 0; int64_t refTime = 0;
@ -1130,6 +1131,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
f.Read7( pd->type, pd->format, pd->name, pd->min, pd->max, pd->sum, psz ); f.Read7( pd->type, pd->format, pd->name, pd->min, pd->max, pd->sum, psz );
pd->showSteps = false; pd->showSteps = false;
pd->fill = true; pd->fill = true;
pd->color = 0;
pd->data.reserve_exact( psz, m_slab ); pd->data.reserve_exact( psz, m_slab );
auto ptr = pd->data.data(); auto ptr = pd->data.data();
int64_t refTime = 0; int64_t refTime = 0;
@ -1155,6 +1157,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
pd->sum = 0; pd->sum = 0;
pd->showSteps = false; pd->showSteps = false;
pd->fill = true; pd->fill = true;
pd->color = 0;
pd->data.reserve_exact( psz, m_slab ); pd->data.reserve_exact( psz, m_slab );
auto ptr = pd->data.data(); auto ptr = pd->data.data();
int64_t refTime = 0; int64_t refTime = 0;
@ -1177,7 +1180,7 @@ 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++ )
{ {
f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::sum ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) + sizeof( PlotData::showSteps ) + sizeof( PlotData::fill ) ); f.Skip( sizeof( PlotData::name ) + sizeof( PlotData::min ) + sizeof( PlotData::max ) + sizeof( PlotData::sum ) + sizeof( PlotData::type ) + sizeof( PlotData::format ) + sizeof( PlotData::showSteps ) + sizeof( PlotData::fill ) + sizeof( PlotData::color ) );
uint64_t psz; uint64_t psz;
f.Read( psz ); f.Read( psz );
f.Skip( psz * ( sizeof( uint64_t ) + sizeof( double ) ) ); f.Skip( psz * ( sizeof( uint64_t ) + sizeof( double ) ) );
@ -5672,6 +5675,7 @@ void Worker::ProcessPlotDataImpl( uint64_t name, int64_t evTime, double val )
plot->format = PlotValueFormatting::Number; plot->format = PlotValueFormatting::Number;
plot->showSteps = false; plot->showSteps = false;
plot->fill = true; plot->fill = true;
plot->color = 0;
return plot; return plot;
}, [this]( uint64_t name ) { }, [this]( uint64_t name ) {
Query( ServerQueryPlotName, name ); Query( ServerQueryPlotName, name );
@ -5696,6 +5700,7 @@ void Worker::ProcessPlotConfig( const QueuePlotConfig& ev )
plot->format = (PlotValueFormatting)ev.type; plot->format = (PlotValueFormatting)ev.type;
plot->showSteps = ev.step; plot->showSteps = ev.step;
plot->fill = ev.fill; plot->fill = ev.fill;
plot->color = ev.color & 0xFFFFFF;
} }
void Worker::ProcessMessage( const QueueMessage& ev ) void Worker::ProcessMessage( const QueueMessage& ev )
@ -6819,6 +6824,7 @@ void Worker::ProcessSysTime( const QueueSysTime& ev )
m_sysTimePlot->format = PlotValueFormatting::Percentage; m_sysTimePlot->format = PlotValueFormatting::Percentage;
m_sysTimePlot->showSteps = false; m_sysTimePlot->showSteps = false;
m_sysTimePlot->fill = true; m_sysTimePlot->fill = true;
m_sysTimePlot->color = 0;
m_sysTimePlot->min = val; m_sysTimePlot->min = val;
m_sysTimePlot->max = val; m_sysTimePlot->max = val;
m_sysTimePlot->sum = val; m_sysTimePlot->sum = val;
@ -7137,6 +7143,7 @@ void Worker::CreateMemAllocPlot( MemData& memdata )
memdata.plot->format = PlotValueFormatting::Memory; memdata.plot->format = PlotValueFormatting::Memory;
memdata.plot->showSteps = true; memdata.plot->showSteps = true;
memdata.plot->fill = true; memdata.plot->fill = true;
memdata.plot->color = 0;
memdata.plot->data.push_back( { GetFrameBegin( *m_data.framesBase, 0 ), 0. } ); memdata.plot->data.push_back( { GetFrameBegin( *m_data.framesBase, 0 ), 0. } );
m_data.plots.Data().push_back( memdata.plot ); m_data.plots.Data().push_back( memdata.plot );
} }
@ -7162,6 +7169,7 @@ void Worker::ReconstructMemAllocPlot( MemData& mem )
plot->format = PlotValueFormatting::Memory; plot->format = PlotValueFormatting::Memory;
plot->showSteps = true; plot->showSteps = true;
plot->fill = true; plot->fill = true;
plot->color = 0;
plot->data.reserve_exact( psz, m_slab ); plot->data.reserve_exact( psz, m_slab );
auto aptr = mem.data.begin(); auto aptr = mem.data.begin();
@ -8116,6 +8124,7 @@ void Worker::Write( FileWrite& f, bool fiDict )
f.Write( &plot->format, sizeof( plot->format ) ); f.Write( &plot->format, sizeof( plot->format ) );
f.Write( &plot->showSteps, sizeof( plot->showSteps ) ); f.Write( &plot->showSteps, sizeof( plot->showSteps ) );
f.Write( &plot->fill, sizeof( plot->fill ) ); f.Write( &plot->fill, sizeof( plot->fill ) );
f.Write( &plot->color, sizeof( plot->color ) );
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 ) );