adds tracing for instrumenting non-async functions (#44147)
Tracing code is not included in normal release builds Documents how to use them in our performance docs Only the maps and cursors are instrumented atm # Compile times: current main: fresh release build (cargo clean then build --release) 377.34 secs current main: fresh debug build (cargo clean then build ) 89.31 secs tracing tracy: fresh release build (cargo clean then build --release) 374.84 secs tracing tracy: fresh debug build (cargo clean then build ) 88.95 secs tracing tracy: fresh release build with timings (cargo clean then build --release --features tracing) 375.77 secs tracing tracy: fresh debug build with timings (cargo clean then build --features tracing) 90.03 secs Release Notes: - N/A --------- Co-authored-by: localcc <work@localcc.cc>
This commit is contained in:
co-authored by
localcc
parent
07fe8e9bb1
commit
b558be7ec6
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
use arrayvec::ArrayVec;
|
||||
use std::{cmp::Ordering, mem, sync::Arc};
|
||||
use ztracing::instrument;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct StackEntry<'a, T: Item, D> {
|
||||
@@ -211,6 +212,7 @@ where
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
#[instrument(skip_all)]
|
||||
pub fn prev(&mut self) {
|
||||
self.search_backward(|_| true)
|
||||
}
|
||||
@@ -394,6 +396,7 @@ where
|
||||
{
|
||||
/// Returns whether we found the item you were seeking for.
|
||||
#[track_caller]
|
||||
#[instrument(skip_all)]
|
||||
pub fn seek<Target>(&mut self, pos: &Target, bias: Bias) -> bool
|
||||
where
|
||||
Target: SeekTarget<'a, T::Summary, D>,
|
||||
@@ -408,6 +411,7 @@ where
|
||||
///
|
||||
/// If we did not seek before, use seek instead in that case.
|
||||
#[track_caller]
|
||||
#[instrument(skip_all)]
|
||||
pub fn seek_forward<Target>(&mut self, pos: &Target, bias: Bias) -> bool
|
||||
where
|
||||
Target: SeekTarget<'a, T::Summary, D>,
|
||||
@@ -449,6 +453,7 @@ where
|
||||
|
||||
/// Returns whether we found the item you were seeking for.
|
||||
#[track_caller]
|
||||
#[instrument(skip_all)]
|
||||
fn seek_internal(
|
||||
&mut self,
|
||||
target: &dyn SeekTarget<'a, T::Summary, D>,
|
||||
|
||||
@@ -8,6 +8,7 @@ use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::{cmp::Ordering, fmt, iter::FromIterator, sync::Arc};
|
||||
pub use tree_map::{MapSeekTarget, TreeMap, TreeSet};
|
||||
use ztracing::instrument;
|
||||
|
||||
#[cfg(test)]
|
||||
pub const TREE_BASE: usize = 2;
|
||||
@@ -379,6 +380,7 @@ impl<T: Item> SumTree<T> {
|
||||
/// A more efficient version of `Cursor::new()` + `Cursor::seek()` + `Cursor::item()`.
|
||||
///
|
||||
/// Only returns the item that exactly has the target match.
|
||||
#[instrument(skip_all)]
|
||||
pub fn find_exact<'a, 'slf, D, Target>(
|
||||
&'slf self,
|
||||
cx: <T::Summary as Summary>::Context<'a>,
|
||||
@@ -404,6 +406,7 @@ impl<T: Item> SumTree<T> {
|
||||
}
|
||||
|
||||
/// A more efficient version of `Cursor::new()` + `Cursor::seek()` + `Cursor::item()`
|
||||
#[instrument(skip_all)]
|
||||
pub fn find<'a, 'slf, D, Target>(
|
||||
&'slf self,
|
||||
cx: <T::Summary as Summary>::Context<'a>,
|
||||
|
||||
Reference in New Issue
Block a user