pub struct EnergyViolation {
pub kind: EnergyViolationKind,
pub budget: f64,
pub estimated: f64,
pub budget_span: Span,
pub code_span: Span,
pub confidence: f64,
pub message: String,
pub callee_chain: Vec<(String, f64)>,
}Expand description
Energy violation detected during compile-time analysis.
This is returned when energy estimation determines that a function’s estimated energy consumption exceeds its declared budget.
Fields§
§kind: EnergyViolationKindThe kind of violation
budget: f64The declared budget value
estimated: f64The estimated actual value
budget_span: SpanSource span where the budget was declared
code_span: SpanSource span of the violating code (e.g., function body)
confidence: f64Confidence level of the estimate (0.0 to 1.0)
message: StringHuman-readable description of the violation
callee_chain: Vec<(String, f64)>Callee chain showing where the energy went: (callee_name, cost_joules) Populated only for transitive budget violations
Implementations§
Source§impl EnergyViolation
impl EnergyViolation
Sourcepub fn format_joules(joules: f64) -> String
pub fn format_joules(joules: f64) -> String
Format a joule value with appropriate SI prefix for readability. Values >= 0.001J use plain joules; smaller values use mJ/uJ/nJ/pJ.
Sourcepub fn joules(
budget: f64,
estimated: f64,
budget_span: Span,
code_span: Span,
confidence: f64,
) -> Self
pub fn joules( budget: f64, estimated: f64, budget_span: Span, code_span: Span, confidence: f64, ) -> Self
Create a new joule budget violation
Sourcepub fn watts(
budget: f64,
estimated: f64,
budget_span: Span,
code_span: Span,
confidence: f64,
) -> Self
pub fn watts( budget: f64, estimated: f64, budget_span: Span, code_span: Span, confidence: f64, ) -> Self
Create a new power budget violation
Sourcepub fn temp_delta(
budget: f64,
estimated: f64,
budget_span: Span,
code_span: Span,
confidence: f64,
) -> Self
pub fn temp_delta( budget: f64, estimated: f64, budget_span: Span, code_span: Span, confidence: f64, ) -> Self
Create a new temperature budget violation
Sourcepub fn excess_percentage(&self) -> f64
pub fn excess_percentage(&self) -> f64
Get the percentage by which the estimate exceeds the budget
Trait Implementations§
Source§impl Clone for EnergyViolation
impl Clone for EnergyViolation
Source§fn clone(&self) -> EnergyViolation
fn clone(&self) -> EnergyViolation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more