katra-core 0.1.0

Katra3D core: shared vocabulary, error model, event model, IDs, and policy types.
Documentation
//! Capture and hardware configuration.

use serde::{Deserialize, Serialize};

use crate::scope::Scope;

/// Capture options for a profiling session.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CaptureOptions {
    /// Per-thread event buffer capacity (in events).
    pub thread_buffer_capacity: usize,
    /// Drain the per-thread buffer to the sink when it holds this many events.
    pub drain_threshold: usize,
    /// Restrict capture to these scopes; empty = all scopes.
    pub enable_domains: Vec<Scope>,
    /// Record wall-clock timestamps on every event.
    pub wall_clock: bool,
    /// Whether the capture session is deterministic (drives replay guarantees).
    pub deterministic: bool,
}

impl Default for CaptureOptions {
    fn default() -> Self {
        CaptureOptions {
            thread_buffer_capacity: 2048,
            drain_threshold: 512,
            enable_domains: Vec::new(),
            wall_clock: true,
            deterministic: false,
        }
    }
}

/// Hardware capabilities discovered at runtime (Katra3D ยง30).
///
/// Used to derive hardware policies (staging strategy, budget sizing).
/// Values are `Option` because they may not be discoverable in every
/// environment; nothing may be assumed.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct HardwareProfile {
    /// GPU vendor string, if discoverable.
    pub gpu_vendor: Option<String>,
    /// GPU model string, if discoverable.
    pub gpu_model: Option<String>,
    /// Whether the GPU is integrated (unified memory).
    pub integrated: Option<bool>,
    /// Whether Resizable BAR is active.
    pub rebar_enabled: Option<bool>,
    /// Whether host-visible VRAM is available.
    pub host_visible_vram: Option<bool>,
    /// Physical RAM in bytes.
    pub ram_bytes: Option<u64>,
    /// Number of logical CPU cores.
    pub cpu_cores: Option<u32>,
    /// Kernel release string (e.g. "6.8.0-45-generic").
    pub kernel: Option<String>,
    /// CPU model name (from /proc/cpuinfo).
    pub cpu_model: Option<String>,
}