Skip to main content

Crate perfgate_host_detect

Crate perfgate_host_detect 

Source
Expand description

Host mismatch detection for benchmarking noise reduction.

This crate provides detection of host environment differences between baseline and current benchmark runs. Host mismatches can introduce significant noise into performance measurements, leading to false positives or negatives in regression detection.

§Example

use perfgate_host_detect::detect_host_mismatch;
use perfgate_types::HostInfo;

let baseline = HostInfo {
    os: "linux".to_string(),
    arch: "x86_64".to_string(),
    cpu_count: Some(8),
    memory_bytes: Some(16 * 1024 * 1024 * 1024),
    hostname_hash: Some("abc123".to_string()),
};

let current = HostInfo {
    os: "linux".to_string(),
    arch: "x86_64".to_string(),
    cpu_count: Some(8),
    memory_bytes: Some(16 * 1024 * 1024 * 1024),
    hostname_hash: Some("abc123".to_string()),
};

assert!(detect_host_mismatch(&baseline, &current).is_none());

§Detection Criteria

The function detects mismatches based on:

  • OS mismatch: Different operating systems (e.g., linux vs windows)
  • Architecture mismatch: Different CPU architectures (e.g., x86_64 vs aarch64)
  • CPU count: Significant difference (> 2x) in logical CPU count
  • Memory: Significant difference (> 2x) in total system memory
  • Hostname hash: Different hashed hostnames (different machines)

The 2x threshold for CPU and memory is chosen to avoid false positives from minor variations (e.g., 8 vs 10 CPUs) while catching significant differences (e.g., 4 vs 16 CPUs) that could affect benchmark results.

Functions§

detect_host_mismatch
Detect host mismatches between baseline and current runs.