Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
44540:82f51ab7a2dd | 44541:d880805d5442 |
---|---|
23 }, | 23 }, |
24 CopyMap, DirstateEntry, DirstateMap, EntryState, FastHashMap, | 24 CopyMap, DirstateEntry, DirstateMap, EntryState, FastHashMap, |
25 PatternError, | 25 PatternError, |
26 }; | 26 }; |
27 use lazy_static::lazy_static; | 27 use lazy_static::lazy_static; |
28 use micro_timer::timed; | |
28 use rayon::prelude::*; | 29 use rayon::prelude::*; |
29 use std::{ | 30 use std::{ |
30 borrow::Cow, | 31 borrow::Cow, |
31 collections::HashSet, | 32 collections::HashSet, |
32 fs::{read_dir, DirEntry}, | 33 fs::{read_dir, DirEntry}, |
209 }; | 210 }; |
210 } | 211 } |
211 | 212 |
212 /// Get stat data about the files explicitly specified by match. | 213 /// Get stat data about the files explicitly specified by match. |
213 /// TODO subrepos | 214 /// TODO subrepos |
215 #[timed] | |
214 fn walk_explicit<'a>( | 216 fn walk_explicit<'a>( |
215 files: Option<&'a HashSet<&HgPath>>, | 217 files: Option<&'a HashSet<&HgPath>>, |
216 dmap: &'a DirstateMap, | 218 dmap: &'a DirstateMap, |
217 root_dir: impl AsRef<Path> + Sync + Send + 'a, | 219 root_dir: impl AsRef<Path> + Sync + Send + 'a, |
218 options: StatusOptions, | 220 options: StatusOptions, |
511 /// Walk the working directory recursively to look for changes compared to the | 513 /// Walk the working directory recursively to look for changes compared to the |
512 /// current `DirstateMap`. | 514 /// current `DirstateMap`. |
513 /// | 515 /// |
514 /// This takes a mutable reference to the results to account for the `extend` | 516 /// This takes a mutable reference to the results to account for the `extend` |
515 /// in timings | 517 /// in timings |
518 #[timed] | |
516 fn traverse<'a>( | 519 fn traverse<'a>( |
517 matcher: &'a (impl Matcher + Sync), | 520 matcher: &'a (impl Matcher + Sync), |
518 root_dir: impl AsRef<Path> + Sync + Send + Copy, | 521 root_dir: impl AsRef<Path> + Sync + Send + Copy, |
519 dmap: &'a DirstateMap, | 522 dmap: &'a DirstateMap, |
520 path: impl AsRef<HgPath>, | 523 path: impl AsRef<HgPath>, |
604 }) | 607 }) |
605 } | 608 } |
606 | 609 |
607 /// This takes a mutable reference to the results to account for the `extend` | 610 /// This takes a mutable reference to the results to account for the `extend` |
608 /// in timings | 611 /// in timings |
612 #[timed] | |
609 fn extend_from_dmap<'a>( | 613 fn extend_from_dmap<'a>( |
610 dmap: &'a DirstateMap, | 614 dmap: &'a DirstateMap, |
611 root_dir: impl AsRef<Path> + Sync + Send, | 615 root_dir: impl AsRef<Path> + Sync + Send, |
612 options: StatusOptions, | 616 options: StatusOptions, |
613 results: &mut Vec<(Cow<'a, HgPath>, Dispatch)>, | 617 results: &mut Vec<(Cow<'a, HgPath>, Dispatch)>, |
628 pub ignored: Vec<Cow<'a, HgPath>>, | 632 pub ignored: Vec<Cow<'a, HgPath>>, |
629 pub unknown: Vec<Cow<'a, HgPath>>, | 633 pub unknown: Vec<Cow<'a, HgPath>>, |
630 pub bad: Vec<(Cow<'a, HgPath>, BadMatch)>, | 634 pub bad: Vec<(Cow<'a, HgPath>, BadMatch)>, |
631 } | 635 } |
632 | 636 |
637 #[timed] | |
633 fn build_response<'a>( | 638 fn build_response<'a>( |
634 results: impl IntoIterator<Item = (Cow<'a, HgPath>, Dispatch)>, | 639 results: impl IntoIterator<Item = (Cow<'a, HgPath>, Dispatch)>, |
635 ) -> (Vec<Cow<'a, HgPath>>, DirstateStatus<'a>) { | 640 ) -> (Vec<Cow<'a, HgPath>>, DirstateStatus<'a>) { |
636 let mut lookup = vec![]; | 641 let mut lookup = vec![]; |
637 let mut modified = vec![]; | 642 let mut modified = vec![]; |
708 } | 713 } |
709 } | 714 } |
710 | 715 |
711 /// This takes a mutable reference to the results to account for the `extend` | 716 /// This takes a mutable reference to the results to account for the `extend` |
712 /// in timings | 717 /// in timings |
718 #[timed] | |
713 fn handle_unknowns<'a>( | 719 fn handle_unknowns<'a>( |
714 dmap: &'a DirstateMap, | 720 dmap: &'a DirstateMap, |
715 matcher: &(impl Matcher + Sync), | 721 matcher: &(impl Matcher + Sync), |
716 root_dir: impl AsRef<Path> + Sync + Send + Copy, | 722 root_dir: impl AsRef<Path> + Sync + Send + Copy, |
717 options: StatusOptions, | 723 options: StatusOptions, |
790 /// Get the status of files in the working directory. | 796 /// Get the status of files in the working directory. |
791 /// | 797 /// |
792 /// This is the current entry-point for `hg-core` and is realistically unusable | 798 /// This is the current entry-point for `hg-core` and is realistically unusable |
793 /// outside of a Python context because its arguments need to provide a lot of | 799 /// outside of a Python context because its arguments need to provide a lot of |
794 /// information that will not be necessary in the future. | 800 /// information that will not be necessary in the future. |
801 #[timed] | |
795 pub fn status<'a: 'c, 'b: 'c, 'c>( | 802 pub fn status<'a: 'c, 'b: 'c, 'c>( |
796 dmap: &'a DirstateMap, | 803 dmap: &'a DirstateMap, |
797 matcher: &'b (impl Matcher + Sync), | 804 matcher: &'b (impl Matcher + Sync), |
798 root_dir: impl AsRef<Path> + Sync + Send + Copy + 'c, | 805 root_dir: impl AsRef<Path> + Sync + Send + Copy + 'c, |
799 ignore_files: &[impl AsRef<Path> + 'c], | 806 ignore_files: &[impl AsRef<Path> + 'c], |