1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Event scope — which layer of the compatibility stack an event belongs to
//! (KatraProfiler §5).
use serde::{Deserialize, Serialize};
/// The layer of the stack that produced an event.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Scope {
/// Windows-facing activity (NtReadFile, ReadFile, mappings, waits, ...).
WindowsFacing,
/// Wine/Proton activity (Windows→Unix transitions, server calls, ...).
WineProton,
/// Linux activity (syscalls, io_uring, page faults, scheduler, ...).
Linux,
/// D3D12/vkd3d activity (command lists, barriers, descriptors, PSOs, ...).
D3d12Vkd3d,
/// Vulkan activity (queue submissions, command buffers, ...).
Vulkan,
/// GPU activity (timestamps, idle bubbles, utilization).
Gpu,
/// Katra3D-native activity (graph ops, prefetch, staging, ...).
Katra,
}
impl Scope {
/// All scopes, in a stable order (append-only).
pub const ALL: [Scope; 7] = [
Scope::WindowsFacing,
Scope::WineProton,
Scope::Linux,
Scope::D3d12Vkd3d,
Scope::Vulkan,
Scope::Gpu,
Scope::Katra,
];
/// Stable string name.
pub const fn as_str(self) -> &'static str {
match self {
Scope::WindowsFacing => "windows_facing",
Scope::WineProton => "wine_proton",
Scope::Linux => "linux",
Scope::D3d12Vkd3d => "d3d12_vkd3d",
Scope::Vulkan => "vulkan",
Scope::Gpu => "gpu",
Scope::Katra => "katra",
}
}
}
impl std::fmt::Display for Scope {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}