tracy/common/TracyProtocol.hpp

76 lines
1.6 KiB
C++
Raw Normal View History

#ifndef __TRACYPROTOCOL_HPP__
#define __TRACYPROTOCOL_HPP__
#include <limits>
#include <stdint.h>
#include "../common/tracy_lz4.hpp"
namespace tracy
{
enum : uint32_t { ProtocolVersion = 3 };
2017-10-19 21:48:16 +00:00
using lz4sz_t = uint32_t;
2017-09-13 20:58:04 +00:00
2017-10-19 21:48:16 +00:00
enum { TargetFrameSize = 256 * 1024 };
enum { LZ4Size = LZ4_COMPRESSBOUND( TargetFrameSize ) };
2017-09-13 20:58:04 +00:00
static_assert( LZ4Size <= std::numeric_limits<lz4sz_t>::max(), "LZ4Size greater than lz4sz_t" );
static_assert( TargetFrameSize * 2 >= 64 * 1024, "Not enough space for LZ4 stream buffer" );
enum ServerQuery : uint8_t
{
2017-10-18 16:48:51 +00:00
ServerQueryTerminate,
ServerQueryString,
ServerQueryThreadString,
2017-09-27 00:18:17 +00:00
ServerQuerySourceLocation,
2017-10-13 01:36:59 +00:00
ServerQueryPlotName,
2018-06-19 22:25:26 +00:00
ServerQueryCallstackFrame,
2018-08-04 17:47:09 +00:00
ServerQueryFrameName,
};
enum { HandshakeShibbolethSize = 8 };
static const char HandshakeShibboleth[HandshakeShibbolethSize] = { 'T', 'r', 'a', 'c', 'y', 'P', 'r', 'f' };
enum HandshakeStatus : uint8_t
{
HandshakePending,
HandshakeWelcome,
HandshakeProtocolMismatch,
HandshakeNotAvailable
};
2017-10-03 21:17:58 +00:00
enum { WelcomeMessageProgramNameSize = 64 };
2018-08-19 16:19:12 +00:00
enum { WelcomeMessageHostInfoSize = 1024 };
2017-10-03 21:17:58 +00:00
2018-07-10 20:29:31 +00:00
#pragma pack( 1 )
struct WelcomeMessage
{
double timerMul;
int64_t initBegin;
int64_t initEnd;
uint64_t delay;
2017-09-29 16:32:07 +00:00
uint64_t resolution;
uint64_t epoch;
uint8_t onDemand;
2017-10-03 21:17:58 +00:00
char programName[WelcomeMessageProgramNameSize];
2018-08-19 16:19:12 +00:00
char hostInfo[WelcomeMessageHostInfoSize];
};
2017-10-03 21:17:58 +00:00
enum { WelcomeMessageSize = sizeof( WelcomeMessage ) };
struct OnDemandPayloadMessage
{
uint64_t frames;
};
enum { OnDemandPayloadMessageSize = sizeof( OnDemandPayloadMessage ) };
2018-07-10 20:29:31 +00:00
#pragma pack()
}
#endif