katra_core/config.rs
1//! Capture and hardware configuration.
2
3use serde::{Deserialize, Serialize};
4
5use crate::scope::Scope;
6
7/// Capture options for a profiling session.
8#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9pub struct CaptureOptions {
10 /// Per-thread event buffer capacity (in events).
11 pub thread_buffer_capacity: usize,
12 /// Drain the per-thread buffer to the sink when it holds this many events.
13 pub drain_threshold: usize,
14 /// Restrict capture to these scopes; empty = all scopes.
15 pub enable_domains: Vec<Scope>,
16 /// Record wall-clock timestamps on every event.
17 pub wall_clock: bool,
18 /// Whether the capture session is deterministic (drives replay guarantees).
19 pub deterministic: bool,
20}
21
22impl Default for CaptureOptions {
23 fn default() -> Self {
24 CaptureOptions {
25 thread_buffer_capacity: 2048,
26 drain_threshold: 512,
27 enable_domains: Vec::new(),
28 wall_clock: true,
29 deterministic: false,
30 }
31 }
32}
33
34/// Hardware capabilities discovered at runtime (Katra3D ยง30).
35///
36/// Used to derive hardware policies (staging strategy, budget sizing).
37/// Values are `Option` because they may not be discoverable in every
38/// environment; nothing may be assumed.
39#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
40pub struct HardwareProfile {
41 /// GPU vendor string, if discoverable.
42 pub gpu_vendor: Option<String>,
43 /// GPU model string, if discoverable.
44 pub gpu_model: Option<String>,
45 /// Whether the GPU is integrated (unified memory).
46 pub integrated: Option<bool>,
47 /// Whether Resizable BAR is active.
48 pub rebar_enabled: Option<bool>,
49 /// Whether host-visible VRAM is available.
50 pub host_visible_vram: Option<bool>,
51 /// Physical RAM in bytes.
52 pub ram_bytes: Option<u64>,
53 /// Number of logical CPU cores.
54 pub cpu_cores: Option<u32>,
55 /// Kernel release string (e.g. "6.8.0-45-generic").
56 pub kernel: Option<String>,
57 /// CPU model name (from /proc/cpuinfo).
58 pub cpu_model: Option<String>,
59}