Skip to content

Commit

Permalink
Apply workaround for criterion comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Sep 10, 2020
1 parent 516a876 commit 48d6af8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ build = "build.rs"
[package.metadata.docs.rs]
features = ["std"]

[lib]
bench = false

[[bench]]
name = "macros"
harness = false
Expand Down
10 changes: 5 additions & 5 deletions metrics/benches/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ fn reset_recorder() {
fn macro_benchmark(c: &mut Criterion) {
c.bench(
"macros",
Benchmark::new("uninitialized/no labels", |b| {
Benchmark::new("uninitialized/no_labels", |b| {
b.iter(|| {
counter!("counter_bench", 42);
})
})
.with_function("uninitialized/with static labels", |b| {
.with_function("uninitialized/with_static_labels", |b| {
b.iter(|| {
counter!("counter_bench", 42, "request" => "http", "svc" => "admin");
})
})
.with_function("initialized/no labels", |b| {
.with_function("initialized/no_labels", |b| {
reset_recorder();
b.iter(|| {
counter!("counter_bench", 42);
});
metrics::clear_recorder();
})
.with_function("initialized/with static labels", |b| {
.with_function("initialized/with_static_labels", |b| {
reset_recorder();
b.iter(|| {
counter!("counter_bench", 42, "request" => "http", "svc" => "admin");
});
metrics::clear_recorder();
})
.with_function("initialized/with dynamic labels", |b| {
.with_function("initialized/with_dynamic_labels", |b| {
let label_val = thread_rng().gen::<u64>().to_string();

reset_recorder();
Expand Down

0 comments on commit 48d6af8

Please sign in to comment.