#mutex #rwlock #synchronization-primitive #thread

unlock

Instrumented synchronization primitives helping you to unlock performance issues

13 releases

0.0.13 Feb 12, 2024
0.0.12 Feb 3, 2024

#520 in Concurrency

Download history 219/week @ 2024-01-30 7/week @ 2024-02-06 13/week @ 2024-02-13 14/week @ 2024-02-20 40/week @ 2024-02-27 20/week @ 2024-03-12 41/week @ 2024-04-02 1/week @ 2024-04-09 238/week @ 2024-04-16

239 downloads per month

MIT/Apache

38KB
781 lines

unlock

github crates.io docs.rs build status

Helpers for tracing and troubleshooting multithreaded code.

Example Trace


Usage

Import RwLock and Mutex from this crate instead of parking_lot directly.

After this, you can instrument a section of code like this:

let condition = true;

if condition {
    unlock::capture();
}

/* do some work */

if condition {
    let events = unlock::drain();
    unlock::html::write("trace.html", &events)?;
    println!("Wrote trace.html");
}

How does it work

This library provides two facade types:

These integrate with a high performance concurrent tracing system to capture events. While this will have some overhead, we aim to make it as small as possible.

Once a workload has been instrumented, the drain function can be called to collect these events, which then can be formatted using either built-in methods such as html::write, or serialized as you please using serde for processing later.


Features

  • trace - Enable real tracing support. If this feature is disabled, this library will be replaced by a stub that can easily be optimized away.
  • parking_lot (default) - Enable support for parking_lot types. If this feature is enabled and trace is disabled, this will re-export parking_lot primitives.
  • serde - Enable serialization for events.

Dependencies

~0.8–6.5MB
~36K SLoC