mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
3b03e849f0
There shouldn't be any changes in generated code on modern architectures, as the memcpy will be reduced to a store/load operation identical to the one generated with plain struct member access. GetTime( cpu ) needs special handling, as the MSVC intrinsic for rdtscp can't store cpu identifier in a register. Using intermediate variable would cause store to stack, read from stack, store to the destination address. Since rdtscp is only available on x86, which handles unaligned stores without any problems, we can have one place with direct struct member access.
48 lines
993 B
C++
48 lines
993 B
C++
#ifndef __TRACYPROTOCOL_HPP__
|
|
#define __TRACYPROTOCOL_HPP__
|
|
|
|
#include <limits>
|
|
#include <stdint.h>
|
|
|
|
#include "../common/tracy_lz4.hpp"
|
|
|
|
namespace tracy
|
|
{
|
|
|
|
using lz4sz_t = uint32_t;
|
|
|
|
enum { TargetFrameSize = 256 * 1024 };
|
|
enum { LZ4Size = LZ4_COMPRESSBOUND( TargetFrameSize ) };
|
|
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
|
|
{
|
|
ServerQueryTerminate,
|
|
ServerQueryString,
|
|
ServerQueryThreadString,
|
|
ServerQuerySourceLocation,
|
|
ServerQueryPlotName,
|
|
};
|
|
|
|
enum { WelcomeMessageProgramNameSize = 64 };
|
|
|
|
#pragma pack( 1 )
|
|
struct WelcomeMessage
|
|
{
|
|
double timerMul;
|
|
int64_t initBegin;
|
|
int64_t initEnd;
|
|
uint64_t delay;
|
|
uint64_t resolution;
|
|
uint64_t epoch;
|
|
char programName[WelcomeMessageProgramNameSize];
|
|
};
|
|
#pragma pack()
|
|
|
|
enum { WelcomeMessageSize = sizeof( WelcomeMessage ) };
|
|
|
|
}
|
|
|
|
#endif
|