X-Git-Url: https://i11git.iti.kit.edu/anon-gitweb/?p=Mitarbeiter%2FTim-Zeitz%2Fstud-rust-base.git;a=blobdiff_plain;f=src%2Ftime.rs;h=687f3e424a86d090431c335b5cfb196545bb5476;hp=8a3843c37641c72832c70eceec81f3b845d29b55;hb=cac08e302995e25c4b5d99fd98a616d1207bae54;hpb=b52fc015957bcfa65d2e8fbb8d4ea44f4923e3a8 diff --git a/src/time.rs b/src/time.rs index 8a3843c..687f3e4 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,15 +1,13 @@ //! This module contains a few utilities to measure how long executing algorithms takes. //! It utilizes the `time` crate. -use time_crate as time; - /// This function will measure how long it takes to execute the given lambda, /// print the time and return the result of the lambda. pub fn report_time Out>(name: &str, f: F) -> Out { let start = time::now(); - println!("starting {}", name); + eprintln!("starting {}", name); let res = f(); - println!("done {} - took: {}", name, (time::now() - start)); + eprintln!("done {} - took: {}", name, (time::now() - start)); res } @@ -46,7 +44,7 @@ impl Timer { /// Print the passed time in ms since the timer was started pub fn report_passed_ms(&self) { - println!("{}ms", (time::now() - self.start).num_milliseconds()); + eprintln!("{}ms", (time::now() - self.start).num_milliseconds()); } /// Return the number of ms passed since the timer was started as a `i64`