mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Save/load sum of values in plots.
This commit is contained in:
parent
0b190b1a69
commit
8f6a911f1e
@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 7 };
|
||||
enum { Patch = 9 };
|
||||
enum { Patch = 10 };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1084,12 +1084,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
m_data.plots.Data().reserve( sz );
|
||||
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
|
||||
if( fileVer >= FileVersion( 0, 7, 10 ) )
|
||||
{
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
|
||||
auto pd = m_slab.AllocInit<PlotData>();
|
||||
uint64_t psz;
|
||||
f.Read6( pd->type, pd->format, pd->name, pd->min, pd->max, psz );
|
||||
f.Read7( pd->type, pd->format, 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;
|
||||
@ -1105,6 +1107,43 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
s_loadProgress.subProgress.store( i, std::memory_order_relaxed );
|
||||
auto pd = m_slab.AllocInit<PlotData>();
|
||||
uint64_t psz;
|
||||
f.Read6( pd->type, pd->format, pd->name, pd->min, pd->max, psz );
|
||||
pd->sum = 0;
|
||||
pd->data.reserve_exact( psz, m_slab );
|
||||
auto ptr = pd->data.data();
|
||||
int64_t refTime = 0;
|
||||
for( uint64_t j=0; j<psz; j++ )
|
||||
{
|
||||
int64_t t;
|
||||
f.Read2( t, ptr->val );
|
||||
pd->sum += ptr->val;
|
||||
refTime += t;
|
||||
ptr->time = refTime;
|
||||
ptr++;
|
||||
}
|
||||
m_data.plots.Data().push_back_no_space_check( pd );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fileVer >= FileVersion( 0, 7, 10 ) )
|
||||
{
|
||||
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 ) );
|
||||
uint64_t psz;
|
||||
f.Read( psz );
|
||||
f.Skip( psz * ( sizeof( uint64_t ) + sizeof( double ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
@ -1114,6 +1153,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
f.Skip( psz * ( sizeof( uint64_t ) + sizeof( double ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s_loadProgress.subTotal.store( 0, std::memory_order_relaxed );
|
||||
s_loadProgress.progress.store( LoadProgress::Memory, std::memory_order_relaxed );
|
||||
@ -7579,6 +7619,7 @@ void Worker::Write( FileWrite& f, bool fiDict )
|
||||
f.Write( &plot->name, sizeof( plot->name ) );
|
||||
f.Write( &plot->min, sizeof( plot->min ) );
|
||||
f.Write( &plot->max, sizeof( plot->max ) );
|
||||
f.Write( &plot->sum, sizeof( plot->sum ) );
|
||||
int64_t refTime = 0;
|
||||
sz = plot->data.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
|
Loading…
Reference in New Issue
Block a user