diff --git a/Chapter09/performance_profiling1.rs b/Chapter09/performance_profiling1.rs index e69de29..327f36d 100644 --- a/Chapter09/performance_profiling1.rs +++ b/Chapter09/performance_profiling1.rs @@ -0,0 +1,20 @@ +use std::{thread,time}; + +fn initialization() { + let t = time::Duration::from_millis(15000); + thread::sleep(t); +} + +fn work() { + let t = time::Duration::from_millis(15000); + loop { + thread::sleep(t); + println!("Work."); + } +} + +fn main() { + initialization(); + println!("Done initializing, start work."); + work(); +} diff --git a/Chapter09/performance_profiling2.rs b/Chapter09/performance_profiling2.rs index e69de29..f79c691 100644 --- a/Chapter09/performance_profiling2.rs +++ b/Chapter09/performance_profiling2.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/Chapter09/performance_profiling3.rs b/Chapter09/performance_profiling3.rs index e69de29..f79c691 100644 --- a/Chapter09/performance_profiling3.rs +++ b/Chapter09/performance_profiling3.rs @@ -0,0 +1,2 @@ +fn main() { +}