mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Store failure reason strings in Worker.
This commit is contained in:
parent
3cd97138fc
commit
9944a73444
@ -182,17 +182,7 @@ int main( int argc, char** argv )
|
||||
const auto& failure = worker.GetFailureType();
|
||||
if( failure != tracy::Worker::Failure::None )
|
||||
{
|
||||
printf( "\n\033[31;1mInstrumentation failure: " );
|
||||
switch( failure )
|
||||
{
|
||||
case tracy::Worker::Failure::ZoneStack:
|
||||
printf( "Invalid order of zone begin and end events." );
|
||||
break;
|
||||
default:
|
||||
printf( "<unknown reason>" );
|
||||
break;
|
||||
}
|
||||
printf( "\033[0m" );
|
||||
printf( "\n\033[31;1mInstrumentation failure: %s\033[0m", tracy::Worker::GetFailureString( failure ) );
|
||||
}
|
||||
|
||||
printf( "\nFrames: %" PRIu64 "\nTime span: %s\nZones: %s\nSaving trace...", worker.GetFrameCount( *worker.GetFramesBase() ), TimeToString( worker.GetLastTime() - worker.GetTimeBegin() ), RealToString( worker.GetZoneCount(), true ) );
|
||||
|
@ -469,15 +469,7 @@ bool View::Draw()
|
||||
ImGui::Text( "Profiling session terminated due to improper instrumentation.\nPlease correct your program and try again." );
|
||||
ImGui::Text( "Reason:" );
|
||||
ImGui::SameLine();
|
||||
switch( failure )
|
||||
{
|
||||
case Worker::Failure::ZoneStack:
|
||||
ImGui::Text( "Invalid order of zone begin and end events." );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
ImGui::Text( "%s", Worker::GetFailureString( failure ) );
|
||||
ImGui::Separator();
|
||||
if( srcloc.name.active )
|
||||
{
|
||||
|
@ -3645,4 +3645,14 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t&
|
||||
}
|
||||
}
|
||||
|
||||
static const char* s_failureReasons[] = {
|
||||
"<unknown reason>",
|
||||
"Invalid order of zone begin and end events."
|
||||
};
|
||||
|
||||
const char* Worker::GetFailureString( Worker::Failure failure )
|
||||
{
|
||||
return s_failureReasons[(int)failure];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -180,7 +180,9 @@ public:
|
||||
enum class Failure
|
||||
{
|
||||
None,
|
||||
ZoneStack
|
||||
ZoneStack,
|
||||
|
||||
NUM_FAILURES
|
||||
};
|
||||
|
||||
Worker( const char* addr );
|
||||
@ -284,6 +286,7 @@ public:
|
||||
void ClearFailure() { m_failure = Failure::None; }
|
||||
Failure GetFailureType() const { return m_failure; }
|
||||
const FailureData& GetFailureData() const { return m_failureData; }
|
||||
static const char* GetFailureString( Failure failure );
|
||||
|
||||
private:
|
||||
void Exec();
|
||||
|
Loading…
Reference in New Issue
Block a user