pub struct EnergyMetrics {
pub total_joules: f64,
pub average_power_watts: f64,
pub peak_power_watts: f64,
pub duration_seconds: f64,
pub co2_grams: Option<f64>,
pub pue: f64,
}Expand description
Energy consumption metrics
Fields§
§total_joules: f64Total energy consumed in joules
average_power_watts: f64Average power draw in watts
peak_power_watts: f64Peak power draw in watts
duration_seconds: f64Duration of measurement in seconds
co2_grams: Option<f64>CO2 equivalent emissions in grams (based on grid carbon intensity)
pue: f64Power Usage Effectiveness (datacenter overhead)
Implementations§
Source§impl EnergyMetrics
impl EnergyMetrics
Sourcepub fn new(
total_joules: f64,
average_power_watts: f64,
peak_power_watts: f64,
duration_seconds: f64,
) -> Self
pub fn new( total_joules: f64, average_power_watts: f64, peak_power_watts: f64, duration_seconds: f64, ) -> Self
Create new energy metrics
Sourcepub fn with_carbon_intensity(self, carbon_intensity_g_per_kwh: f64) -> Self
pub fn with_carbon_intensity(self, carbon_intensity_g_per_kwh: f64) -> Self
Calculate CO2 emissions based on carbon intensity (g CO2/kWh)
Default grid intensity values:
- US Average: 386 g/kWh
- EU Average: 231 g/kWh
- Renewable: ~20 g/kWh
Sourcepub fn with_pue(self, pue: f64) -> Self
pub fn with_pue(self, pue: f64) -> Self
Set the Power Usage Effectiveness factor
PUE represents datacenter overhead:
- 1.0 = no overhead (local machine)
- 1.2 = efficient datacenter
- 1.5 = average datacenter
- 2.0 = inefficient datacenter
Sourcepub fn flops_per_watt(&self, total_flops: f64) -> f64
pub fn flops_per_watt(&self, total_flops: f64) -> f64
Calculate energy efficiency in FLOPS per watt
Trait Implementations§
Source§impl Clone for EnergyMetrics
impl Clone for EnergyMetrics
Source§fn clone(&self) -> EnergyMetrics
fn clone(&self) -> EnergyMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnergyMetrics
impl Debug for EnergyMetrics
Source§impl Default for EnergyMetrics
impl Default for EnergyMetrics
Source§impl<'de> Deserialize<'de> for EnergyMetrics
impl<'de> Deserialize<'de> for EnergyMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for EnergyMetrics
impl PartialEq for EnergyMetrics
Source§impl Serialize for EnergyMetrics
impl Serialize for EnergyMetrics
impl StructuralPartialEq for EnergyMetrics
Auto Trait Implementations§
impl Freeze for EnergyMetrics
impl RefUnwindSafe for EnergyMetrics
impl Send for EnergyMetrics
impl Sync for EnergyMetrics
impl Unpin for EnergyMetrics
impl UnsafeUnpin for EnergyMetrics
impl UnwindSafe for EnergyMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more