Skip to main content

Crate cntryl_stress

Crate cntryl_stress 

Source
Expand description

§cntryl-stress

Performance benchmarks for engineers who need trustworthy artifacts, not just timing numbers.

cntryl-stress is an opinionated Rust benchmarking framework for performance engineering loops. It keeps benchmark authoring low ceremony while producing structured artifacts, diagnostics, and gates that can support real optimization decisions.

The framework is designed around one core question:

  • Can this benchmark row be trusted?

It helps answer that by recording raw samples, deriving summaries from measured samples only, preserving correctness counters, and calling out common benchmark-shape mistakes automatically.

Tier labels:

  • Tier 1: hot path
  • Tier 2: subsystem
  • Tier 3: system
  • Tier 4: integration
  • Tier 5: saturation/scaling
  • Tier 6: soak/endurance

The common benchmark body is intentionally small:

use cntryl_stress::{black_box, stress, LogicalUnit, OperationOutcome, StressContext};

#[stress(tier = 1)]
fn parse_hot_path(ctx: &mut StressContext) {
    let header = b"content-type:application/json";
    ctx.measure("colon lookup", || black_box(header.iter().position(|byte| *byte == b':')));
}

#[stress(tier = 3)]
fn process_batch(ctx: &mut StressContext) {
    let records = [1_u64, 2, 3];
    ctx.measure_outcome("process batch", LogicalUnit::new("record"), || {
        black_box(records.iter().sum::<u64>());
        OperationOutcome::success(records.len() as u64)
    });
}

A harness = false benchmark binary ends with cntryl_stress::stress_main!();.

Re-exports§

pub use artifact::RunProfile;
pub use artifact::TrustClass as BenchmarkRole;
pub use context::LogicalUnit;
pub use context::OperationOutcome;
pub use context::StressContext;
pub use runner::StressRunner;

Modules§

artifact
Raw-sample result types and current artifact helpers.
context
Benchmark context for named measurements, workload facts, and correctness counters.
prelude
Prelude module for benchmark files.
reporting
Pluggable reporters for current stress artifacts.
runner
Stress runner that records raw samples and derives current artifacts.

Macros§

stress_allocator
Install the stress allocation-counting global allocator.
stress_main
Generate a main function for stress benchmark binaries.

Structs§

StressError
Error returned by a stress benchmark function.
StressRunnerConfig
Configuration for one stress suite run.
StressRunnerOptions
Options for programmatic execution of registered benchmarks.

Functions§

black_box
An identity function that hints to the compiler to be maximally pessimistic about what black_box could do.

Type Aliases§

StressResult
Result returned by fallible stress benchmarks.

Attribute Macros§

stress
Mark a function as a stress benchmark.