diff --git a/rtiow/src/bin/tracer.rs b/rtiow/src/bin/tracer.rs index a862134..cd9f3c9 100644 --- a/rtiow/src/bin/tracer.rs +++ b/rtiow/src/bin/tracer.rs @@ -88,8 +88,10 @@ fn push_metrics(push_gateway_addr: &str, instance: String, start_time: &DateTime } } +#[cfg(not(feature = "profile"))] struct MockTimer; +#[cfg(not(feature = "profile"))] impl MockTimer { fn start>>(&self, _: T) -> Result<(), ()> { Ok(()) @@ -99,8 +101,10 @@ impl MockTimer { } } +#[cfg(not(feature = "profile"))] struct MockProfiler; +#[cfg(not(feature = "profile"))] impl MockProfiler { fn lock(&self) -> Option { Some(MockTimer {}) diff --git a/rtiow/src/lib.rs b/rtiow/src/lib.rs index 5274097..1f6c240 100644 --- a/rtiow/src/lib.rs +++ b/rtiow/src/lib.rs @@ -31,7 +31,5 @@ extern crate structopt; #[macro_use] extern crate serde_derive; #[macro_use] -extern crate lazy_static; -#[macro_use] #[cfg(feature = "prom")] extern crate prometheus; diff --git a/rtiow/src/renderer.rs b/rtiow/src/renderer.rs index ce4583a..d11e480 100644 --- a/rtiow/src/renderer.rs +++ b/rtiow/src/renderer.rs @@ -15,6 +15,8 @@ use std::time; use image; use image::RgbImage; +#[cfg(feature = "prom")] +use lazy_static::lazy_static; use num_cpus; use rand; use rand::Rng; @@ -36,7 +38,9 @@ lazy_static! { register_counter_vec!("rays", "Number of rays fired", &["level"]).unwrap(); } +#[cfg(not(feature = "prom"))] struct MockPrometheus; +#[cfg(not(feature = "prom"))] impl MockPrometheus { fn with_label_values(&self, _: &[&str]) -> &MockPrometheus { self