Skip to main content

Crate micromeasure

Crate micromeasure 

Source
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§

bench
table

Macros§

benchmark_main

Structs§

BenchSampleResult
Per-sample result returned by a benchmark function that wants to report custom metrics in addition to the standard timing/throughput/PMU pipeline.
BenchmarkCaseIdentity
Stable semantic identity for one native benchmark case.
BenchmarkMainOptions
BenchmarkReport
Persisted benchmark report for serialization and optional comparisons.
BenchmarkResult
Collected benchmark result for session summary and JSON export
BenchmarkStats
ComparisonAnalysis
A comparison bundled with a reproducible policy evaluation.
ComparisonCaseSnapshot
Measurement evidence for one side of a comparison.
ComparisonOptions
Options controlling report and report-set comparison.
ComparisonReport
Serializable, policy-free relationship between two benchmark reports.
ComparisonStatistics
Stability evidence retained for one side of a matched or unmatched case.
ComparisonSummary
Counts summarizing a structured comparison.
EnvironmentComparison
Complete environment relationship recorded in a comparison artifact.
EnvironmentOverride
Operator-supplied justification for comparing non-identical environments.
Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
MatchedBenchmark
Structured comparison for a benchmark found on both sides.
MetricComparison
A custom metric present in both versions of a matched benchmark.
MetricSummary
Aggregated view of a custom per-sample metric, computed by [crate::bench::stats::aggregate_metrics] from Vec<MetricValue> per sample. One summary per (name, unit) pair across all samples of a benchmark.
NativeMeasurementProjection
Native-only measurements kept alongside the normalized primary value.
PolicyCaseEvaluation
Policy result for one matched case.
PolicyEvaluation
Complete policy evaluation for a comparison.
PolicySummary
Aggregate policy counts.
PrimaryMeasurement
A direction-aware primary value used for comparison.
RegressionPolicy
Configurable classification and regression-gating policy.
ReportContext
Run-level context retained in every new benchmark report.
ReportReference
Durable reference to one evidence document.
SampleMetric
Owned, serializable form of a per-sample crate::MetricValue.
SampleMetricSet
Custom metrics captured for one measured sample, preserved in execution order for drift and state-transition analysis.
SeriesCaseIdentity
Stable semantic identity for one external series case.
SeriesReport
A portable external report containing chronological raw samples.
SeriesResult
Raw observations for one externally orchestrated measurement.
SeriesValidationError
Semantic failure in an otherwise structurally readable series report.
SuiteComparisonAnalysis
Versioned combined result for one file pair or two report directories.
SuiteComparisonSummary
Aggregate counts across matched, added, and removed suites.
UnmatchedBenchmark
A benchmark present on only one side of a partial comparison.
Validity
Correctness status for a report or individual result.
WorkerCounterSummary
WorkerSummary

Enums§

BenchmarkKind
ChangeClassification
Direction-aware material-change classification.
ComparisonCaseIdentity
Semantic identity for a native benchmark or external series case.
ComparisonError
Semantic failure while comparing two otherwise readable reports.
ComparisonExitStatus
Stable process-status contract for comparison frontends.
ComparisonPolicy
ComparisonSide
Which side of a comparison supplied a value or caused an error.
ContextError
Failure to load or validate an explicitly requested context document.
MeasurementDirection
Whether larger or smaller primary values represent an improvement.
MeasurementKind
The semantic kind of a comparison’s primary measurement.
PolicyError
Invalid regression-policy configuration.
PolicyFinding
Stability or correctness observation attached during policy evaluation.
ReportDocument
Loaded evidence plus the reference derived from its original bytes.
ReportDocumentType
Kind of evidence document referenced by a comparison.
ReportError
Failure to load or interpret a persisted report.
ReportInputRole
Role of an input while loading and validating a report set.
SuiteComparisonError
Failure while loading, validating, or comparing report inputs.
ValidityStatus
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_box could 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.