From b026e09a09f53c17455b1b6fe118b5f183da2d7e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 24 Jul 2022 13:42:25 +0200 Subject: [PATCH] Include custom color in plot configuration. --- server/TracyEvent.hpp | 1 + server/TracyWorker.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index a12b37be..d63eb592 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -749,6 +749,7 @@ struct PlotData PlotValueFormatting format; uint8_t showSteps; uint8_t fill; + uint32_t color; }; struct MemData diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 001be054..19ad8af3 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -456,6 +456,7 @@ Worker::Worker( const char* name, const char* program, const std::vectorformat = v.format; plot->showSteps = false; plot->fill = true; + plot->color = 0; double sum = 0; 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 ); auto pd = m_slab.AllocInit(); 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 ); auto ptr = pd->data.data(); 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 ); pd->showSteps = false; pd->fill = true; + pd->color = 0; pd->data.reserve_exact( psz, m_slab ); auto ptr = pd->data.data(); int64_t refTime = 0; @@ -1155,6 +1157,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) pd->sum = 0; pd->showSteps = false; pd->fill = true; + pd->color = 0; pd->data.reserve_exact( psz, m_slab ); auto ptr = pd->data.data(); int64_t refTime = 0; @@ -1177,7 +1180,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) { for( uint64_t i=0; iformat = PlotValueFormatting::Number; plot->showSteps = false; plot->fill = true; + plot->color = 0; return plot; }, [this]( uint64_t name ) { Query( ServerQueryPlotName, name ); @@ -5696,6 +5700,7 @@ void Worker::ProcessPlotConfig( const QueuePlotConfig& ev ) plot->format = (PlotValueFormatting)ev.type; plot->showSteps = ev.step; plot->fill = ev.fill; + plot->color = ev.color & 0xFFFFFF; } void Worker::ProcessMessage( const QueueMessage& ev ) @@ -6819,6 +6824,7 @@ void Worker::ProcessSysTime( const QueueSysTime& ev ) m_sysTimePlot->format = PlotValueFormatting::Percentage; m_sysTimePlot->showSteps = false; m_sysTimePlot->fill = true; + m_sysTimePlot->color = 0; m_sysTimePlot->min = val; m_sysTimePlot->max = val; m_sysTimePlot->sum = val; @@ -7137,6 +7143,7 @@ void Worker::CreateMemAllocPlot( MemData& memdata ) memdata.plot->format = PlotValueFormatting::Memory; memdata.plot->showSteps = true; memdata.plot->fill = true; + memdata.plot->color = 0; memdata.plot->data.push_back( { GetFrameBegin( *m_data.framesBase, 0 ), 0. } ); m_data.plots.Data().push_back( memdata.plot ); } @@ -7162,6 +7169,7 @@ void Worker::ReconstructMemAllocPlot( MemData& mem ) plot->format = PlotValueFormatting::Memory; plot->showSteps = true; plot->fill = true; + plot->color = 0; plot->data.reserve_exact( psz, m_slab ); 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->showSteps, sizeof( plot->showSteps ) ); f.Write( &plot->fill, sizeof( plot->fill ) ); + f.Write( &plot->color, sizeof( plot->color ) ); f.Write( &plot->name, sizeof( plot->name ) ); f.Write( &plot->min, sizeof( plot->min ) ); f.Write( &plot->max, sizeof( plot->max ) );