mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Save "on demand" flag in traces.
Previously on demand mode was determined by frame offset parameter being greater than zero. However, if the application is not pumping frames with FrameMark macro, the frame index will never increase and the frame offset parameter stay at zero. It is not possible to distinguish on demand traces from normal ones in this scenario. Fix by explicitly saving the on demand flag in trace file and employ the previous logic to set the flag when importing older traces.
This commit is contained in:
parent
ed79c4f241
commit
e92874c0bb
@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 9 };
|
||||
enum { Patch = 1 };
|
||||
enum { Patch = 2 };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,6 +312,7 @@ Worker::Worker( const char* name, const char* program, const std::vector<ImportE
|
||||
, m_samplingPeriod( 0 )
|
||||
, m_stream( nullptr )
|
||||
, m_buffer( nullptr )
|
||||
, m_onDemand( false )
|
||||
, m_inconsistentSamples( false )
|
||||
, m_traceVersion( CurrentVersion )
|
||||
{
|
||||
@ -589,6 +590,17 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
f.Read( m_data.cpuManufacturer, 12 );
|
||||
m_data.cpuManufacturer[12] = '\0';
|
||||
|
||||
if( fileVer >= FileVersion( 0, 9, 2 ) )
|
||||
{
|
||||
uint8_t flag;
|
||||
f.Read( flag );
|
||||
m_onDemand = flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_onDemand = m_data.frameOffset != 0;
|
||||
}
|
||||
|
||||
uint64_t sz;
|
||||
{
|
||||
f.Read( sz );
|
||||
@ -7656,6 +7668,9 @@ void Worker::Write( FileWrite& f, bool fiDict )
|
||||
f.Write( &m_data.cpuId, sizeof( m_data.cpuId ) );
|
||||
f.Write( m_data.cpuManufacturer, 12 );
|
||||
|
||||
uint8_t flag = m_onDemand;
|
||||
f.Write( &flag, sizeof( flag ) );
|
||||
|
||||
uint64_t sz = m_captureName.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
f.Write( m_captureName.c_str(), sz );
|
||||
|
Loading…
Reference in New Issue
Block a user