From 3451d81a0e53c1bf8314299abf2b89c38166b74c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 6 Oct 2017 19:24:53 +0200 Subject: [PATCH] Describe marking locks. --- README.md | 12 ++++++++++++ doc/locks.png | Bin 0 -> 8503 bytes 2 files changed, 12 insertions(+) create mode 100644 doc/locks.png diff --git a/README.md b/README.md index c626f6d3..68d5956c 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,18 @@ Use the `ZoneName( const char* name )` macro to set a custom name for the zone, Use the `ZoneText( const char* text, size_t size )` macro to add a custom text string that will be displayed along the zone information (for example, name of the file you are opening). Note that every time `ZoneText` is invoked, a memory allocation is performed to store an internal copy of the data. The string you have provided is not used by tracy. +#### Marking locks + +Tracy can collect and display lock interactions in threads. + +![](doc/locks.png) + +To mark a lock (mutex) for event reporting, use the `TracyLockable( type, varname )` macro. Note that the lock must implement a [Lockable concept](http://en.cppreference.com/w/cpp/concept/Lockable) (i.e. there's no support for timed mutices). For a concrete example, you would replace the line `std::mutex m_lock` with `TracyLockable( std::mutex, m_lock )`. + +The standard `std::lock_guard` and `std::unique_lock` wrappers should use the `LockableBase( type )` macro for their template parameter (unless you're using C++17, with improved template argument deduction). For example, `std::lock_guard lock( m_lock )`. + +To mark the location of lock being held, use the `LockMark( varname )` macro, after you have obtained the lock. Note that the varname must be a lock variable (a reference is also valid). This step is optional. + #### Running the server The easiest way to get going is to build the standalone server, available in the `standalone` directory. You can connect to localhost or remote clients and view the collected data right away. diff --git a/doc/locks.png b/doc/locks.png new file mode 100644 index 0000000000000000000000000000000000000000..496728aabd7688d34cc600875e6433c536d592c0 GIT binary patch literal 8503 zcmbVSXH-*Zw`Oz@XA}_`g9-+*;RgX!giwQy1sz0G#84BI5^13bBvQht1Bk((;|S7K z1QetO2#`QT3`mzQ2myoATPPtw0{5H{%6x0xANQ_xfaE>z+3!BPJp0*OLoZ)45dU@0 zuOcEM;up@Jxhf*Ev0X&uC$Y^NfED$C9o4{}U);}|-xd+sA_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