mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add lock marking.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#define TracyLockable( type, varname ) type varname;
|
||||
#define LockableBase( type ) type
|
||||
#define LockMark(x)
|
||||
|
||||
#else
|
||||
|
||||
@@ -30,6 +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 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 );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -92,6 +92,18 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Mark( const SourceLocation* srcloc )
|
||||
{
|
||||
Magic magic;
|
||||
auto& token = s_token;
|
||||
auto item = s_queue.enqueue_begin( token, magic );
|
||||
item->hdr.type = QueueType::LockMark;
|
||||
item->lockMark.id = m_id;
|
||||
item->lockMark.thread = GetThreadHandle();
|
||||
item->lockMark.srcloc = (uint64_t)srcloc;
|
||||
s_queue.enqueue_finish( token, magic );
|
||||
}
|
||||
|
||||
private:
|
||||
T m_lockable;
|
||||
uint64_t m_id;
|
||||
|
||||
Reference in New Issue
Block a user