diff rust/hg-core/src/dirstate/status.rs @ 44541:d880805d5442

hg-core: add function timing information This change makes use of the newly added logging infrastructure to trace the execution time of some important calls. This approach is very much complementary to using a profiler and will not guard against out-of-order execution or other kinds of compiler optimizations. That said, it is useful to get a rough high-level idea of where time is spent. Differential Revision: https://phab.mercurial-scm.org/D8253
author Raphaël Gomès <rgomes@octobus.net>
date Fri, 06 Mar 2020 18:08:23 +0100
parents fe7d2cf0b429
children ece43c79333e
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/status.rs	Fri Mar 06 18:08:13 2020 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Fri Mar 06 18:08:23 2020 +0100
@@ -25,6 +25,7 @@
     PatternError,
 };
 use lazy_static::lazy_static;
+use micro_timer::timed;
 use rayon::prelude::*;
 use std::{
     borrow::Cow,
@@ -211,6 +212,7 @@
 
 /// Get stat data about the files explicitly specified by match.
 /// TODO subrepos
+#[timed]
 fn walk_explicit<'a>(
     files: Option<&'a HashSet<&HgPath>>,
     dmap: &'a DirstateMap,
@@ -513,6 +515,7 @@
 ///
 /// This takes a mutable reference to the results to account for the `extend`
 /// in timings
+#[timed]
 fn traverse<'a>(
     matcher: &'a (impl Matcher + Sync),
     root_dir: impl AsRef<Path> + Sync + Send + Copy,
@@ -606,6 +609,7 @@
 
 /// This takes a mutable reference to the results to account for the `extend`
 /// in timings
+#[timed]
 fn extend_from_dmap<'a>(
     dmap: &'a DirstateMap,
     root_dir: impl AsRef<Path> + Sync + Send,
@@ -630,6 +634,7 @@
     pub bad: Vec<(Cow<'a, HgPath>, BadMatch)>,
 }
 
+#[timed]
 fn build_response<'a>(
     results: impl IntoIterator<Item = (Cow<'a, HgPath>, Dispatch)>,
 ) -> (Vec<Cow<'a, HgPath>>, DirstateStatus<'a>) {
@@ -710,6 +715,7 @@
 
 /// This takes a mutable reference to the results to account for the `extend`
 /// in timings
+#[timed]
 fn handle_unknowns<'a>(
     dmap: &'a DirstateMap,
     matcher: &(impl Matcher + Sync),
@@ -792,6 +798,7 @@
 /// This is the current entry-point for `hg-core` and is realistically unusable
 /// outside of a Python context because its arguments need to provide a lot of
 /// information that will not be necessary in the future.
+#[timed]
 pub fn status<'a: 'c, 'b: 'c, 'c>(
     dmap: &'a DirstateMap,
     matcher: &'b (impl Matcher + Sync),