///|
/// A deterministic benchmark smoke program. It deliberately prints checksums
/// rather than elapsed time: CI proves the representative hot paths run, and
/// a benchmark harness can wrap this executable with its own timer/CPU setup.
fn scalar_update_checksum(iterations : Int) -> Double raise {
let counter = @prometheus.Counter::new("benchmark_updates_total")
let gauge = @prometheus.Gauge::new("benchmark_gauge")
for index in 0.. Double raise {
let descriptor = @prometheus.Descriptor::new(
"benchmark_vector_total",
CounterKind,
variable_label_names=["worker", "outcome"],
)
let vector = @prometheus.CounterVec::new(descriptor, cardinality_limit=64)
for index in 0.. Double raise {
let registry = @prometheus.Registry::new()
let histogram = @prometheus.Histogram::new(
"benchmark_duration_seconds",
[0.001, 0.01, 0.1, 1.0],
unit="seconds",
)
registry.register_histogram(histogram)
for index in 0.. 0.0005
1 => 0.005
2 => 0.05
3 => 0.5
_ => 5.0
}
histogram.observe(value)
}
let gathered = registry.gather()
let sample = gathered.families[0].histogram_samples[0].value
sample.count.to_double() + sample.sum
}
///|
fn encode_checksum(iterations : Int) -> Int raise {
let descriptor = @prometheus.Descriptor::new(
"benchmark_encoded_total",
CounterKind,
help="Benchmark exporter work",
variable_label_names=["route"],
)
let vector = @prometheus.CounterVec::new(descriptor)
for index in 0..