Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ jobs:
bench: criterion_integration_with_inputs
- package: codspeed-criterion-compat
bench: criterion_integration_measurement_overhead
- package: codspeed-criterion-compat
bench: missing_docs
steps:
- uses: actions/checkout@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions crates/criterion_compat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ harness = false
[[bench]]
name = "custom_main"
harness = false

[[bench]]
name = "missing_docs"
harness = false
11 changes: 11 additions & 0 deletions crates/criterion_compat/benches/missing_docs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Harness macros expand to items that pass `missing_docs`.
#![deny(missing_docs)]

use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion};

fn sum(c: &mut Criterion) {
c.bench_function("sum", |b| b.iter(|| black_box(1u64) + 1));
}

criterion_group!(benches, sum);
criterion_main!(benches);
1 change: 1 addition & 0 deletions crates/criterion_compat/criterion_fork/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#[macro_export]
macro_rules! criterion_group {
(name = $name:ident; config = $config:expr; targets = $( $target:path ),+ $(,)*) => {
#[doc = "The function which runs the benchmarks."]
pub fn $name() {
let mut criterion: $crate::Criterion<_> = $config
.configure_from_args();
Expand Down
3 changes: 2 additions & 1 deletion crates/criterion_compat/src/compat/macros.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[macro_export]
macro_rules! criterion_group {
(name = $name:ident; config = $config:expr; targets = $( $target:path ),+ $(,)*) => {
#[doc = "The function which runs the benchmarks."]
pub fn $name(criterion: &mut $crate::Criterion) {
let mut criterion = &mut criterion.with_patched_measurement($config);
$(
Expand All @@ -22,7 +23,7 @@ macro_rules! criterion_group {
#[macro_export]
macro_rules! criterion_main {
( $( $group:path ),+ $(,)* ) => {
pub fn main() {
fn main() {
let mut criterion = $crate::Criterion::new_instrumented();
$(
$group(&mut criterion);
Expand Down