mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
format 2
This commit is contained in:
parent
0848bb1603
commit
4f769258b4
@ -14,7 +14,8 @@
|
||||
|
||||
static bool s_isStdoutATerminal = false;
|
||||
|
||||
void InitIsStdoutATerminal() {
|
||||
void InitIsStdoutATerminal()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
s_isStdoutATerminal = _isatty( fileno( stdout ) );
|
||||
#else
|
||||
@ -24,7 +25,6 @@ void InitIsStdoutATerminal() {
|
||||
|
||||
bool IsStdoutATerminal() { return s_isStdoutATerminal; }
|
||||
|
||||
|
||||
#define ANSI_RESET "\033[0m"
|
||||
#define ANSI_BOLD "\033[1m"
|
||||
#define ANSI_BLACK "\033[30m"
|
||||
@ -42,7 +42,8 @@ bool IsStdoutATerminal() { return s_isStdoutATerminal; }
|
||||
#ifdef __GNUC__
|
||||
[[gnu::format( __printf__, 2, 3 )]]
|
||||
#endif
|
||||
void AnsiPrintf( const char* ansiEscape, const char* format, ... ) {
|
||||
void AnsiPrintf( const char* ansiEscape, const char* format, ... )
|
||||
{
|
||||
if( IsStdoutATerminal() )
|
||||
{
|
||||
// Prepend ansiEscape and append ANSI_RESET.
|
||||
@ -69,17 +70,20 @@ int checkHandshake(tracy::HandshakeStatus handshake)
|
||||
{
|
||||
if( handshake == tracy::HandshakeProtocolMismatch )
|
||||
{
|
||||
printf( "\nThe client you are trying to connect to uses incompatible protocol version.\nMake sure you are using the same Tracy version on both client and server.\n" );
|
||||
printf(
|
||||
"\nThe client you are trying to connect to uses incompatible protocol version.\nMake sure you are using the same Tracy version on both client and server.\n" );
|
||||
return 1;
|
||||
}
|
||||
if( handshake == tracy::HandshakeNotAvailable )
|
||||
{
|
||||
printf( "\nThe client you are trying to connect to is no longer able to sent profiling data,\nbecause another server was already connected to it.\nYou can do the following:\n\n 1. Restart the client application.\n 2. Rebuild the client application with on-demand mode enabled.\n" );
|
||||
printf(
|
||||
"\nThe client you are trying to connect to is no longer able to sent profiling data,\nbecause another server was already connected to it.\nYou can do the following:\n\n 1. Restart the client application.\n 2. Rebuild the client application with on-demand mode enabled.\n" );
|
||||
return 2;
|
||||
}
|
||||
if( handshake == tracy::HandshakeDropped )
|
||||
{
|
||||
printf( "\nThe client you are trying to connect to has disconnected during the initial\nconnection handshake. Please check your network configuration.\n" );
|
||||
printf(
|
||||
"\nThe client you are trying to connect to has disconnected during the initial\nconnection handshake. Please check your network configuration.\n" );
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
@ -143,7 +147,8 @@ bool printWorkerFailure(tracy::Worker& worker, char const* prefix)
|
||||
}
|
||||
else
|
||||
{
|
||||
AnsiPrintf( ANSI_RED ANSI_BOLD, "\n%s Instrumentation failure: %s", prefix, tracy::Worker::GetFailureString( failure ) );
|
||||
AnsiPrintf( ANSI_RED ANSI_BOLD, "\n%s Instrumentation failure: %s", prefix,
|
||||
tracy::Worker::GetFailureString( failure ) );
|
||||
auto& fd = worker.GetFailureData();
|
||||
if( !fd.message.empty() )
|
||||
{
|
||||
@ -180,8 +185,7 @@ bool printWorkerFailure(tracy::Worker& worker, char const* prefix)
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while( *++test );
|
||||
} while( *++test );
|
||||
if( match ) continue;
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
#ifndef __TRACYPROTOCOLSERVER_HPP__
|
||||
#define __TRACYPROTOCOLSERVER_HPP__
|
||||
|
||||
#include <optional>
|
||||
#include "TracyProtocol.hpp"
|
||||
#include "TracySocket.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user