Patchwork D10552: dirstate-tree: Add #[timed] attribute to `status` and `DirstateMap::read`

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 10:28 a.m.
Message ID <differential-rev-PHID-DREV-er6sscp3qivrqc7hsx7x-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48870/
State Superseded
Headers show

Comments

phabricator - May 3, 2021, 10:28 a.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When running with a `RUST_LOG=trace` environment variable, the `micro_timer`
  crate prints the duration taken by each call to functions with that attribute.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10552

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate_tree/status.rs b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -13,6 +13,7 @@ 
 use crate::PatternFileWarning;
 use crate::StatusError;
 use crate::StatusOptions;
+use micro_timer::timed;
 use rayon::prelude::*;
 use std::borrow::Cow;
 use std::io;
@@ -29,6 +30,7 @@ 
 /// and its use of `itertools::merge_join_by`. When reaching a path that only
 /// exists in one of the two trees, depending on information requested by
 /// `options` we may need to traverse the remaining subtree.
+#[timed]
 pub fn status<'tree>(
     dmap: &'tree mut DirstateMap,
     matcher: &(dyn Matcher + Sync),
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1,4 +1,5 @@ 
 use bytes_cast::BytesCast;
+use micro_timer::timed;
 use std::path::PathBuf;
 use std::{collections::BTreeMap, convert::TryInto};
 
@@ -499,6 +500,7 @@ 
         self.dirty_parents = true;
     }
 
+    #[timed]
     fn read<'a>(
         &mut self,
         file_contents: &'a [u8],