Expand description
Microbenchmark harness for tiny operations where PMU behaviour matters.
This crate provides a reusable microbenchmark framework with:
- Performance counter integration (Linux only)
- Console output with Unicode tables
- Explicit report rendering and JSON persistence
- Structured, serializable comparison of persisted reports
- Portable raw-sample reports for external orchestrators
- Advisory or gating policy with terminal, Markdown, and JSON rendering
- Multi-suite file and directory validation and comparison
- Warm-up and calibration phases
- Progress indicators
- Generic table formatting
Re-exports§
pub use bench::BenchContext;pub use bench::BenchmarkCaseOrder;pub use bench::BenchmarkRunner;pub use bench::BenchmarkRuntimeOptions;pub use bench::ConcurrentBenchContext;pub use bench::ConcurrentBenchControl;pub use bench::ConcurrentBenchmarkGroup;pub use bench::ConcurrentSampleInfo;pub use bench::ConcurrentSampleLifecycle;pub use bench::ConcurrentSamplePhase;pub use bench::ConcurrentWorker;pub use bench::ConcurrentWorkerResult;pub use bench::CounterValue;pub use bench::DiagnosticError;pub use bench::DiagnosticResult;pub use bench::EnergyScope;pub use bench::MeasurementBackend;pub use bench::MeasurementDomain;pub use bench::MemoryBandwidthScope;pub use bench::MetricFormat;pub use bench::MetricValue;pub use bench::NoContext;pub use bench::OperationReportedDeviceBackend;pub use bench::PmuCounterProfile;pub use bench::PmuScope;pub use bench::Throughput;pub use bench::WallClockBackend;pub use bench::LinuxPerfBackend;pub use bench::LinuxPerfThreadSet;pub use table::Alignment;pub use table::BorderColor;pub use table::TableFormatter;pub use bench::PerfCounters;pub use perf_event;
Modules§
Macros§
Structs§
- Bench
Sample Result - Per-sample result returned by a benchmark function that wants to report custom metrics in addition to the standard timing/throughput/PMU pipeline.
- Benchmark
Case Identity - Stable semantic identity for one native benchmark case.
- Benchmark
Main Options - Benchmark
Report - Persisted benchmark report for serialization and optional comparisons.
- Benchmark
Result - Collected benchmark result for session summary and JSON export
- Benchmark
Stats - Comparison
Analysis - A comparison bundled with a reproducible policy evaluation.
- Comparison
Case Snapshot - Measurement evidence for one side of a comparison.
- Comparison
Options - Options controlling report and report-set comparison.
- Comparison
Report - Serializable, policy-free relationship between two benchmark reports.
- Comparison
Statistics - Stability evidence retained for one side of a matched or unmatched case.
- Comparison
Summary - Counts summarizing a structured comparison.
- Environment
Comparison - Complete environment relationship recorded in a comparison artifact.
- Environment
Override - Operator-supplied justification for comparing non-identical environments.
- Instant
- A measurement of a monotonically nondecreasing clock.
Opaque and useful only with
Duration. - Matched
Benchmark - Structured comparison for a benchmark found on both sides.
- Metric
Comparison - A custom metric present in both versions of a matched benchmark.
- Metric
Summary - Aggregated view of a custom per-sample metric, computed by
[
crate::bench::stats::aggregate_metrics] fromVec<MetricValue>per sample. One summary per(name, unit)pair across all samples of a benchmark. - Native
Measurement Projection - Native-only measurements kept alongside the normalized primary value.
- Policy
Case Evaluation - Policy result for one matched case.
- Policy
Evaluation - Complete policy evaluation for a comparison.
- Policy
Summary - Aggregate policy counts.
- Primary
Measurement - A direction-aware primary value used for comparison.
- Regression
Policy - Configurable classification and regression-gating policy.
- Report
Context - Run-level context retained in every new benchmark report.
- Report
Reference - Durable reference to one evidence document.
- Sample
Metric - Owned, serializable form of a per-sample
crate::MetricValue. - Sample
Metric Set - Custom metrics captured for one measured sample, preserved in execution order for drift and state-transition analysis.
- Series
Case Identity - Stable semantic identity for one external series case.
- Series
Report - A portable external report containing chronological raw samples.
- Series
Result - Raw observations for one externally orchestrated measurement.
- Series
Validation Error - Semantic failure in an otherwise structurally readable series report.
- Suite
Comparison Analysis - Versioned combined result for one file pair or two report directories.
- Suite
Comparison Summary - Aggregate counts across matched, added, and removed suites.
- Unmatched
Benchmark - A benchmark present on only one side of a partial comparison.
- Validity
- Correctness status for a report or individual result.
- Worker
Counter Summary - Worker
Summary
Enums§
- Benchmark
Kind - Change
Classification - Direction-aware material-change classification.
- Comparison
Case Identity - Semantic identity for a native benchmark or external series case.
- Comparison
Error - Semantic failure while comparing two otherwise readable reports.
- Comparison
Exit Status - Stable process-status contract for comparison frontends.
- Comparison
Policy - Comparison
Side - Which side of a comparison supplied a value or caused an error.
- Context
Error - Failure to load or validate an explicitly requested context document.
- Measurement
Direction - Whether larger or smaller primary values represent an improvement.
- Measurement
Kind - The semantic kind of a comparison’s primary measurement.
- Policy
Error - Invalid regression-policy configuration.
- Policy
Finding - Stability or correctness observation attached during policy evaluation.
- Report
Document - Loaded evidence plus the reference derived from its original bytes.
- Report
Document Type - Kind of evidence document referenced by a comparison.
- Report
Error - Failure to load or interpret a persisted report.
- Report
Input Role - Role of an input while loading and validating a report set.
- Suite
Comparison Error - Failure while loading, validating, or comparing report inputs.
- Validity
Status - Whether evidence passed its independent correctness checks.
Constants§
- ANALYSIS_
SCHEMA_ VERSION - JSON schema emitted for a comparison plus its separate policy evaluation.
- BASELINE_
PATH_ ENVIRONMENT - Environment variable selecting an exact baseline report.
- COMPARISON_
SCHEMA_ VERSION - JSON schema emitted for structured comparison reports.
- CONTEXT_
FILE_ ENVIRONMENT - Environment variable selecting an explicit report context document.
- DEFAULT_
MAXIMUM_ CV_ PERCENT - Default coefficient-of-variation threshold for a stability finding.
- DEFAULT_
MAXIMUM_ OUTLIER_ FRACTION - Default outlier-fraction threshold for a stability finding.
- DEFAULT_
MINIMUM_ CHANGE_ PERCENT - Default material-change threshold for advisory evaluation.
- OUTPUT_
PATH_ ENVIRONMENT - Environment variable selecting an explicit JSON report destination.
- REPORT_
SCHEMA_ VERSION - JSON document schema emitted by this version of
micromeasure. - SERIES_
DOCUMENT_ TYPE - JSON document discriminator required on external series reports.
- SERIES_
SCHEMA_ VERSION - JSON schema emitted and accepted for external series reports.
- SUITE_
ANALYSIS_ SCHEMA_ VERSION - JSON schema emitted for a combined suite comparison.
Functions§
- benchmark_
filter_ from_ args - benchmark_
filter_ from_ env - black_
box - An identity function that hints to the compiler to be maximally pessimistic about what
black_boxcould do. - compare_
report_ inputs - Compare one report file pair or two directories of reports.
- compare_
reports - Compare loaded evidence documents without terminal or filesystem effects.
- render_
markdown - Render Markdown suitable for a CI annotation or persisted summary.
- render_
terminal - Render a concise plain-text comparison for an interactive job log.
- run_
benchmark_ main - validate_
report_ input - Validate one report file or every JSON report beneath a directory.