Save/load CPU usage plot.

This commit is contained in:
Bartosz Taudul 2019-02-21 22:53:26 +01:00
parent e9baa80bf3
commit e190faa7e1
3 changed files with 13 additions and 5 deletions

View File

@ -262,7 +262,7 @@ struct PlotItem
double val; double val;
}; };
enum class PlotType enum class PlotType : uint8_t
{ {
User, User,
Memory, Memory,

View File

@ -7,7 +7,7 @@ namespace Version
{ {
enum { Major = 0 }; enum { Major = 0 };
enum { Minor = 4 }; enum { Minor = 4 };
enum { Patch = 4 }; enum { Patch = 5 };
} }
} }

View File

@ -826,7 +826,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
{ {
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>();
pd->type = PlotType::User; if( fileVer >= FileVersion( 0, 4, 5 ) )
{
f.Read( pd->type );
}
else
{
pd->type = PlotType::User;
}
f.Read( pd->name ); f.Read( pd->name );
f.Read( pd->min ); f.Read( pd->min );
f.Read( pd->max ); f.Read( pd->max );
@ -3720,11 +3727,12 @@ void Worker::Write( FileWrite& f )
} }
sz = m_data.plots.Data().size(); sz = m_data.plots.Data().size();
for( auto& plot : m_data.plots.Data() ) { if( plot->type != PlotType::User ) sz--; } for( auto& plot : m_data.plots.Data() ) { if( plot->type == PlotType::Memory ) sz--; }
f.Write( &sz, sizeof( sz ) ); f.Write( &sz, sizeof( sz ) );
for( auto& plot : m_data.plots.Data() ) for( auto& plot : m_data.plots.Data() )
{ {
if( plot->type != PlotType::User ) continue; if( plot->type == PlotType::Memory ) continue;
f.Write( &plot->type, sizeof( plot->type ) );
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 ) );