Skip to content

Commit

Permalink
Allow compiling with no_metrics feature (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJollyjim authored and spacejam committed Jan 8, 2020
1 parent 2e94968 commit 43c565f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ readme = "README.md"

[dependencies]
libc = "0.2.66"

[features]
no_metrics = []
2 changes: 2 additions & 0 deletions src/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ impl Histogram {
.fetch_add(1, Ordering::Relaxed)
+ 1
}
#[cfg(feature = "no_metrics")]
0
}

/// Retrieve a percentile [0-100]. Returns NAN if no metrics have been
Expand Down
1 change: 1 addition & 0 deletions src/io_uring/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl Drop for Uring {
}

if self.config.print_profile_on_drop {
#[cfg(not(feature = "no_metrics"))]
M.print_profile();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub struct Metrics {

impl Drop for Metrics {
fn drop(&mut self) {
#[cfg(not(feature = "no_metrics"))]
self.print_profile()
}
}
Expand Down

0 comments on commit 43c565f

Please sign in to comment.