mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Move TracyQueue.hpp to common.
This commit is contained in:
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#ifndef __TRACYQUEUE_HPP__
|
||||
#define __TRACYQUEUE_HPP__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
enum class QueueType : uint8_t
|
||||
{
|
||||
ZoneBegin,
|
||||
ZoneEnd,
|
||||
NUM_TYPES
|
||||
};
|
||||
|
||||
#pragma pack( 1 )
|
||||
|
||||
struct QueueZoneBegin
|
||||
{
|
||||
uint64_t id;
|
||||
uint64_t filename; // ptr
|
||||
uint64_t function; // ptr
|
||||
uint32_t line;
|
||||
};
|
||||
|
||||
struct QueueZoneEnd
|
||||
{
|
||||
uint64_t id;
|
||||
};
|
||||
|
||||
struct QueueHeader
|
||||
{
|
||||
QueueType type;
|
||||
int64_t time;
|
||||
};
|
||||
|
||||
struct QueueItem
|
||||
{
|
||||
QueueHeader hdr;
|
||||
union
|
||||
{
|
||||
QueueZoneBegin zoneBegin;
|
||||
QueueZoneEnd zoneEnd;
|
||||
};
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
enum { QueueItemSize = sizeof( QueueItem ) };
|
||||
|
||||
static const size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),
|
||||
};
|
||||
|
||||
static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" );
|
||||
static_assert( sizeof( void* ) <= sizeof( uint64_t ), "Pointer size > 8 bytes" );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user