# HG changeset patch # User Antoine Cezar # Date 1600856776 -7200 # Node ID b1cea0dc9db04fcff5c60f4f790febc36318a627 # Parent f17caf8f3fefe048d5d6410a98f41bb9892d4725 rhg: Add debug timing Differential Revision: https://phab.mercurial-scm.org/D8962 diff -r f17caf8f3fef -r b1cea0dc9db0 rust/Cargo.lock --- a/rust/Cargo.lock Mon Aug 17 16:56:39 2020 +0200 +++ b/rust/Cargo.lock Wed Sep 23 12:26:16 2020 +0200 @@ -569,7 +569,10 @@ version = "0.1.0" dependencies = [ "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hg-core 0.1.0", + "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff -r f17caf8f3fef -r b1cea0dc9db0 rust/rhg/Cargo.toml --- a/rust/rhg/Cargo.toml Mon Aug 17 16:56:39 2020 +0200 +++ b/rust/rhg/Cargo.toml Wed Sep 23 12:26:16 2020 +0200 @@ -7,4 +7,6 @@ [dependencies] hg-core = { path = "../hg-core"} clap = "2.33.1" - +log = "0.4.11" +micro-timer = "0.3.1" +env_logger = "0.7.1" diff -r f17caf8f3fef -r b1cea0dc9db0 rust/rhg/src/commands/debugdata.rs --- a/rust/rhg/src/commands/debugdata.rs Mon Aug 17 16:56:39 2020 +0200 +++ b/rust/rhg/src/commands/debugdata.rs Wed Sep 23 12:26:16 2020 +0200 @@ -5,6 +5,7 @@ use hg::operations::{ DebugData, DebugDataError, DebugDataErrorKind, DebugDataKind, }; +use micro_timer::timed; pub const HELP_TEXT: &str = " Dump the contents of a data file revision @@ -22,6 +23,7 @@ } impl<'a> Command for DebugDataCommand<'a> { + #[timed] fn run(&self, ui: &Ui) -> Result<(), CommandError> { let mut operation = DebugData::new(self.rev, self.kind); let data = diff -r f17caf8f3fef -r b1cea0dc9db0 rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs Mon Aug 17 16:56:39 2020 +0200 +++ b/rust/rhg/src/main.rs Wed Sep 23 12:26:16 2020 +0200 @@ -1,3 +1,4 @@ +extern crate log; use clap::App; use clap::AppSettings; use clap::Arg; @@ -15,6 +16,7 @@ use error::CommandError; fn main() { + env_logger::init(); let app = App::new("rhg") .setting(AppSettings::AllowInvalidUtf8) .setting(AppSettings::SubcommandRequired)