1
0
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:
Bartosz Taudul
2017-10-06 16:32:32 +02:00
parent 21c1533d8b
commit dcd89f894c
3 changed files with 24 additions and 0 deletions
+2
View File
@@ -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
+12
View File
@@ -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;