Add zone value failure context.

This commit is contained in:
Bartosz Taudul 2021-10-10 14:12:13 +02:00
parent 9300934fa5
commit 930ef77ea9
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 19 additions and 3 deletions

View File

@ -480,6 +480,10 @@ bool View::Draw()
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( data.thread ) );
}
if( !data.message.empty() )
{
TextFocused( "Context:", data.message.c_str() );
}
if( data.callstack != 0 )
{
if( ImGui::TreeNode( "Call stack" ) )

View File

@ -4844,10 +4844,21 @@ void Worker::ZoneTextFailure( uint64_t thread )
m_failureData.thread = thread;
}
void Worker::ZoneValueFailure( uint64_t thread )
void Worker::ZoneValueFailure( uint64_t thread, uint64_t value )
{
char buf[128];
if( (int64_t)value < 0 )
{
sprintf( buf, "Zone value was: %" PRIu64 " (unsigned), %" PRIi64 " (signed)", value, (int64_t)value );
}
else
{
sprintf( buf, "Zone value was: %" PRIu64, value );
}
m_failure = Failure::ZoneValue;
m_failureData.thread = thread;
m_failureData.message = buf;
}
void Worker::ZoneColorFailure( uint64_t thread )
@ -5120,7 +5131,7 @@ void Worker::ProcessZoneValue( const QueueZoneValue& ev )
auto td = RetrieveThread( m_threadCtx );
if( !td || td->stack.empty() || td->nextZoneId != td->zoneIdStack.back() )
{
ZoneValueFailure( m_threadCtx );
ZoneValueFailure( m_threadCtx, ev.value );
return;
}

View File

@ -381,6 +381,7 @@ private:
uint64_t thread;
int16_t srcloc;
uint32_t callstack;
std::string message;
};
struct FrameImagePending
@ -715,7 +716,7 @@ private:
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
void ZoneDoubleEndFailure( uint64_t thread, const ZoneEvent* ev );
void ZoneTextFailure( uint64_t thread );
void ZoneValueFailure( uint64_t thread );
void ZoneValueFailure( uint64_t thread, uint64_t value );
void ZoneColorFailure( uint64_t thread );
void ZoneNameFailure( uint64_t thread );
void MemFreeFailure( uint64_t thread );