pub fn with_thread_local<F, R>(f: F) -> Rwhere
F: FnOnce(&mut PerfContext) -> R,Expand description
Runs f with a reusable thread-local PerfContext.
The context is reset before each call. This avoids allocating and destroying the C wrapper for every measurement.
ยงPanics
Panics if called reentrantly or while a manually created PerfContext is
alive on the same thread. RocksDB returns the same underlying context to all
wrappers on a thread, so resetting it would discard the manual measurement.