mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 13:13:53 +00:00
Plot data transfer.
This commit is contained in:
parent
d9feeb3486
commit
f0484b50ca
@ -16,6 +16,8 @@
|
|||||||
#define LockableBase( type ) type
|
#define LockableBase( type ) type
|
||||||
#define LockMark(x)
|
#define LockMark(x)
|
||||||
|
|
||||||
|
#define TracyPlot(x,y)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include "TracyLock.hpp"
|
#include "TracyLock.hpp"
|
||||||
@ -35,6 +37,8 @@
|
|||||||
#define LockableBase( type ) tracy::Lockable<type>
|
#define LockableBase( type ) tracy::Lockable<type>
|
||||||
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
|
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
|
||||||
|
|
||||||
|
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,6 +82,20 @@ 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, double 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.val = val;
|
||||||
|
tail.store( magic + 1, std::memory_order_release );
|
||||||
|
}
|
||||||
|
|
||||||
static bool ShouldExit();
|
static bool ShouldExit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -21,6 +21,7 @@ enum class QueueType : uint8_t
|
|||||||
LockObtain,
|
LockObtain,
|
||||||
LockRelease,
|
LockRelease,
|
||||||
LockMark,
|
LockMark,
|
||||||
|
PlotData,
|
||||||
NUM_TYPES
|
NUM_TYPES
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,6 +102,13 @@ struct QueueLockMark
|
|||||||
uint64_t srcloc; // ptr
|
uint64_t srcloc; // ptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueuePlotData
|
||||||
|
{
|
||||||
|
uint64_t name; // ptr
|
||||||
|
int64_t time;
|
||||||
|
double val;
|
||||||
|
};
|
||||||
|
|
||||||
struct QueueHeader
|
struct QueueHeader
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
@ -126,6 +134,7 @@ struct QueueItem
|
|||||||
QueueLockObtain lockObtain;
|
QueueLockObtain lockObtain;
|
||||||
QueueLockRelease lockRelease;
|
QueueLockRelease lockRelease;
|
||||||
QueueLockMark lockMark;
|
QueueLockMark lockMark;
|
||||||
|
QueuePlotData plotData;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -147,6 +156,7 @@ static const size_t QueueDataSize[] = {
|
|||||||
sizeof( QueueHeader ) + sizeof( QueueLockObtain ),
|
sizeof( QueueHeader ) + sizeof( QueueLockObtain ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueLockRelease ),
|
sizeof( QueueHeader ) + sizeof( QueueLockRelease ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueLockMark ),
|
sizeof( QueueHeader ) + sizeof( QueueLockMark ),
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueuePlotData ),
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" );
|
static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user