Allow crash event reporting.

When crash happens there's no longer anything to profile -- don't wait
for unfinished zones to finish before sending client terminate
confirmation.
This commit is contained in:
Bartosz Taudul 2018-08-20 01:03:16 +02:00
parent ca939ccd19
commit 366ea35593
3 changed files with 17 additions and 6 deletions

View File

@ -16,6 +16,7 @@ enum class QueueType : uint8_t
Callstack,
Terminate,
KeepAlive,
Crash,
ZoneBegin,
ZoneBeginCallstack,
ZoneEnd,
@ -287,6 +288,7 @@ static const size_t QueueDataSize[] = {
// above items must be first
sizeof( QueueHeader ), // terminate
sizeof( QueueHeader ), // keep alive
sizeof( QueueHeader ), // crash
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // callstack
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),

View File

@ -192,6 +192,7 @@ Worker::Worker( const char* addr )
, m_hasData( false )
, m_shutdown( false )
, m_terminate( false )
, m_crashed( false )
, m_stream( LZ4_createStreamDecode() )
, m_buffer( new char[TargetFrameSize*3 + 1] )
, m_bufferOffset( 0 )
@ -220,6 +221,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
, m_hasData( true )
, m_shutdown( false )
, m_terminate( false )
, m_crashed( false )
, m_stream( nullptr )
, m_buffer( nullptr )
{
@ -1315,6 +1317,8 @@ void Worker::Exec()
{
continue;
}
if( !m_crashed )
{
bool done = true;
for( auto& v : m_data.threads )
{
@ -1325,6 +1329,7 @@ void Worker::Exec()
}
}
if( !done ) continue;
}
ServerQuery( ServerQueryTerminate, 0 );
break;
}
@ -1921,6 +1926,9 @@ void Worker::Process( const QueueItem& ev )
break;
case QueueType::KeepAlive:
break;
case QueueType::Crash:
m_crashed = true;
break;
default:
assert( false );
break;

View File

@ -375,6 +375,7 @@ private:
std::string m_captureName;
std::string m_hostInfo;
bool m_terminate;
bool m_crashed;
LZ4_streamDecode_t* m_stream;
char* m_buffer;
int m_bufferOffset;