mirror of
https://github.com/wolfpld/tracy
synced 2025-05-03 14:03:52 +00:00
Prevent type conversions.
This commit is contained in:
parent
f0484b50ca
commit
cb0011755d
@ -82,6 +82,36 @@ public:
|
|||||||
tail.store( magic + 1, std::memory_order_release );
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static tracy_force_inline void PlotData( const char* name, int64_t val )
|
||||||
|
{
|
||||||
|
uint32_t cpu;
|
||||||
|
Magic magic;
|
||||||
|
auto& token = s_token.ptr;
|
||||||
|
auto& tail = token->get_tail_index();
|
||||||
|
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
|
||||||
|
item->hdr.type = QueueType::PlotData;
|
||||||
|
item->plotData.name = (uint64_t)name;
|
||||||
|
item->plotData.time = GetTime( cpu );
|
||||||
|
item->plotData.type = PlotDataType::Int;
|
||||||
|
item->plotData.data.i = val;
|
||||||
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
|
}
|
||||||
|
|
||||||
|
static tracy_force_inline void PlotData( const char* name, float val )
|
||||||
|
{
|
||||||
|
uint32_t cpu;
|
||||||
|
Magic magic;
|
||||||
|
auto& token = s_token.ptr;
|
||||||
|
auto& tail = token->get_tail_index();
|
||||||
|
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
|
||||||
|
item->hdr.type = QueueType::PlotData;
|
||||||
|
item->plotData.name = (uint64_t)name;
|
||||||
|
item->plotData.time = GetTime( cpu );
|
||||||
|
item->plotData.type = PlotDataType::Float;
|
||||||
|
item->plotData.data.f = val;
|
||||||
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
|
}
|
||||||
|
|
||||||
static tracy_force_inline void PlotData( const char* name, double val )
|
static tracy_force_inline void PlotData( const char* name, double val )
|
||||||
{
|
{
|
||||||
uint32_t cpu;
|
uint32_t cpu;
|
||||||
@ -92,7 +122,8 @@ public:
|
|||||||
item->hdr.type = QueueType::PlotData;
|
item->hdr.type = QueueType::PlotData;
|
||||||
item->plotData.name = (uint64_t)name;
|
item->plotData.name = (uint64_t)name;
|
||||||
item->plotData.time = GetTime( cpu );
|
item->plotData.time = GetTime( cpu );
|
||||||
item->plotData.val = val;
|
item->plotData.type = PlotDataType::Double;
|
||||||
|
item->plotData.data.d = val;
|
||||||
tail.store( magic + 1, std::memory_order_release );
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,11 +102,24 @@ struct QueueLockMark
|
|||||||
uint64_t srcloc; // ptr
|
uint64_t srcloc; // ptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PlotDataType : uint8_t
|
||||||
|
{
|
||||||
|
Float,
|
||||||
|
Double,
|
||||||
|
Int
|
||||||
|
};
|
||||||
|
|
||||||
struct QueuePlotData
|
struct QueuePlotData
|
||||||
{
|
{
|
||||||
uint64_t name; // ptr
|
uint64_t name; // ptr
|
||||||
int64_t time;
|
int64_t time;
|
||||||
double val;
|
PlotDataType type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
float f;
|
||||||
|
int64_t i;
|
||||||
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueueHeader
|
struct QueueHeader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user