Skip to main content

forge/profile/analyze/
types.rs

1use serde::Serialize;
2use wowlab_types::sim::FastMap;
3
4#[derive(Clone, Debug, Serialize)]
5pub(crate) struct Function {
6    pub name: String,
7    pub module: String,
8    pub category: String,
9    pub self_pct: f64,
10    pub total_pct: f64,
11    pub self_samples: u64,
12    pub total_samples: u64,
13}
14
15#[derive(Clone, Debug, Serialize)]
16pub(crate) struct CallEdge {
17    pub caller: String,
18    pub callee: String,
19    pub samples: u64,
20    pub pct: f64,
21}
22
23#[derive(Clone, Debug, Serialize)]
24pub(crate) struct HotspotContext {
25    pub name: String,
26    pub self_pct: f64,
27    pub total_pct: f64,
28    pub category: String,
29    pub callers: Vec<ContextEntry>,
30    pub callees: Vec<ContextEntry>,
31}
32
33#[derive(Clone, Debug, Serialize)]
34pub(crate) struct ContextEntry {
35    pub name: String,
36    pub pct: f64,
37    pub samples: u64,
38}
39
40#[derive(Clone, Debug, Serialize)]
41pub(crate) struct ProfileAnalysis {
42    pub spec: String,
43    pub iterations: u32,
44    pub duration_sec: f64,
45    pub throughput: f64,
46    pub total_samples: u64,
47    pub unresolved_symbols: u32,
48    pub functions: Vec<Function>,
49    pub bottlenecks: Vec<Function>,
50    pub categories: Vec<(String, f64)>,
51    pub category_functions: FastMap<String, Vec<Function>>,
52    pub call_edges: Vec<CallEdge>,
53    pub hotspot_context: Vec<HotspotContext>,
54    pub source_files: Vec<(String, f64)>,
55    pub observations: Vec<String>,
56}