Mercurial > hg-stable
changeset 45536:b1cea0dc9db0
rhg: Add debug timing
Differential Revision: https://phab.mercurial-scm.org/D8962
author | Antoine Cezar <antoine.cezar@octobus.net> |
---|---|
date | Wed, 23 Sep 2020 12:26:16 +0200 |
parents | f17caf8f3fef |
children | b0d6309ff50c |
files | rust/Cargo.lock rust/rhg/Cargo.toml rust/rhg/src/commands/debugdata.rs rust/rhg/src/main.rs |
diffstat | 4 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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]]
--- 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"
--- 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 =
--- 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)