mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
format 2
This commit is contained in:
parent
0848bb1603
commit
4f769258b4
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
static bool s_isStdoutATerminal = false;
|
static bool s_isStdoutATerminal = false;
|
||||||
|
|
||||||
void InitIsStdoutATerminal() {
|
void InitIsStdoutATerminal()
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
s_isStdoutATerminal = _isatty( fileno( stdout ) );
|
s_isStdoutATerminal = _isatty( fileno( stdout ) );
|
||||||
#else
|
#else
|
||||||
@ -24,7 +25,6 @@ void InitIsStdoutATerminal() {
|
|||||||
|
|
||||||
bool IsStdoutATerminal() { return s_isStdoutATerminal; }
|
bool IsStdoutATerminal() { return s_isStdoutATerminal; }
|
||||||
|
|
||||||
|
|
||||||
#define ANSI_RESET "\033[0m"
|
#define ANSI_RESET "\033[0m"
|
||||||
#define ANSI_BOLD "\033[1m"
|
#define ANSI_BOLD "\033[1m"
|
||||||
#define ANSI_BLACK "\033[30m"
|
#define ANSI_BLACK "\033[30m"
|
||||||
@ -42,7 +42,8 @@ bool IsStdoutATerminal() { return s_isStdoutATerminal; }
|
|||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
[[gnu::format( __printf__, 2, 3 )]]
|
[[gnu::format( __printf__, 2, 3 )]]
|
||||||
#endif
|
#endif
|
||||||
void AnsiPrintf( const char* ansiEscape, const char* format, ... ) {
|
void AnsiPrintf( const char* ansiEscape, const char* format, ... )
|
||||||
|
{
|
||||||
if( IsStdoutATerminal() )
|
if( IsStdoutATerminal() )
|
||||||
{
|
{
|
||||||
// Prepend ansiEscape and append ANSI_RESET.
|
// Prepend ansiEscape and append ANSI_RESET.
|
||||||
@ -69,17 +70,20 @@ int checkHandshake(tracy::HandshakeStatus handshake)
|
|||||||
{
|
{
|
||||||
if( handshake == tracy::HandshakeProtocolMismatch )
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
if( handshake == tracy::HandshakeNotAvailable )
|
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;
|
return 2;
|
||||||
}
|
}
|
||||||
if( handshake == tracy::HandshakeDropped )
|
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 3;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -143,7 +147,8 @@ bool printWorkerFailure(tracy::Worker& worker, char const* prefix)
|
|||||||
}
|
}
|
||||||
else
|
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();
|
auto& fd = worker.GetFailureData();
|
||||||
if( !fd.message.empty() )
|
if( !fd.message.empty() )
|
||||||
{
|
{
|
||||||
@ -180,8 +185,7 @@ bool printWorkerFailure(tracy::Worker& worker, char const* prefix)
|
|||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while( *++test );
|
||||||
while( *++test );
|
|
||||||
if( match ) continue;
|
if( match ) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#ifndef __TRACYPROTOCOLSERVER_HPP__
|
#ifndef __TRACYPROTOCOLSERVER_HPP__
|
||||||
#define __TRACYPROTOCOLSERVER_HPP__
|
#define __TRACYPROTOCOLSERVER_HPP__
|
||||||
|
|
||||||
#include <optional>
|
|
||||||
#include "TracyProtocol.hpp"
|
#include "TracyProtocol.hpp"
|
||||||
#include "TracySocket.hpp"
|
#include "TracySocket.hpp"
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user