pub struct EnergyMetadata {
pub budget: Option<HirEnergyBudget>,
pub estimated_cost: Option<f64>,
pub estimated_power: Option<f64>,
pub estimated_temp_delta: Option<f64>,
pub confidence: f64,
}Expand description
Energy metadata for HIR items (functions, loops, blocks).
This struct holds both the declared budget (if any) and the compile-time estimated cost computed by the energy estimator.
Fields§
§budget: Option<HirEnergyBudget>The declared energy budget from #[energy_budget(...)] attribute
estimated_cost: Option<f64>Compile-time estimated energy cost in joules
estimated_power: Option<f64>Estimated power consumption in watts (if determinable)
estimated_temp_delta: Option<f64>Estimated temperature impact in Celsius
confidence: f64Confidence level of the estimate (0.0 to 1.0) Lower values indicate more uncertainty (e.g., due to loops with unknown bounds)
Implementations§
Source§impl EnergyMetadata
impl EnergyMetadata
Sourcepub const fn with_budget(budget: HirEnergyBudget) -> Self
pub const fn with_budget(budget: HirEnergyBudget) -> Self
Create new metadata with just a budget
Sourcepub const fn with_estimate(estimated_cost: f64, confidence: f64) -> Self
pub const fn with_estimate(estimated_cost: f64, confidence: f64) -> Self
Create new metadata with an estimated cost
Sourcepub fn exceeds_budget(&self) -> bool
pub fn exceeds_budget(&self) -> bool
Check if the estimated cost exceeds the budget
Sourcepub fn budget_excess(&self) -> Option<f64>
pub fn budget_excess(&self) -> Option<f64>
Get the amount by which the estimate exceeds the budget (if any)
Sourcepub fn exceeds_power_budget(&self) -> bool
pub fn exceeds_power_budget(&self) -> bool
Check if the power estimate exceeds the budget
Sourcepub fn exceeds_temp_budget(&self) -> bool
pub fn exceeds_temp_budget(&self) -> bool
Check if the temperature estimate exceeds the budget
Sourcepub const fn set_estimate(&mut self, cost: f64, confidence: f64)
pub const fn set_estimate(&mut self, cost: f64, confidence: f64)
Set the estimated cost
Sourcepub const fn has_estimate(&self) -> bool
pub const fn has_estimate(&self) -> bool
Check if we have any estimate
Trait Implementations§
Source§impl Clone for EnergyMetadata
impl Clone for EnergyMetadata
Source§fn clone(&self) -> EnergyMetadata
fn clone(&self) -> EnergyMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more