mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Force inline lock operations.
This commit is contained in:
parent
dcd89f894c
commit
9736be0321
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
|
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
|
||||||
#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 );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ template<class T>
|
|||||||
class Lockable
|
class Lockable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Lockable( const SourceLocation* srcloc )
|
tracy_force_inline Lockable( const SourceLocation* srcloc )
|
||||||
: m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
: m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) )
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
@ -30,7 +30,7 @@ public:
|
|||||||
Lockable( const Lockable& ) = delete;
|
Lockable( const Lockable& ) = delete;
|
||||||
Lockable& operator=( const Lockable& ) = delete;
|
Lockable& operator=( const Lockable& ) = delete;
|
||||||
|
|
||||||
void lock()
|
tracy_force_inline void lock()
|
||||||
{
|
{
|
||||||
int8_t cpu;
|
int8_t cpu;
|
||||||
const auto thread = GetThreadHandle();
|
const auto thread = GetThreadHandle();
|
||||||
@ -59,7 +59,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlock()
|
tracy_force_inline void unlock()
|
||||||
{
|
{
|
||||||
m_lockable.unlock();
|
m_lockable.unlock();
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
s_queue.enqueue_finish( token, magic );
|
s_queue.enqueue_finish( token, magic );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool try_lock()
|
tracy_force_inline bool try_lock()
|
||||||
{
|
{
|
||||||
const auto ret = m_lockable.try_lock();
|
const auto ret = m_lockable.try_lock();
|
||||||
if( ret )
|
if( ret )
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mark( const SourceLocation* srcloc )
|
tracy_force_inline void Mark( const SourceLocation* srcloc )
|
||||||
{
|
{
|
||||||
Magic magic;
|
Magic magic;
|
||||||
auto& token = s_token;
|
auto& token = s_token;
|
||||||
|
Loading…
Reference in New Issue
Block a user