joule-profiler-source-rapl 1.1.0

Intel RAPL energy measurement source for joule-profiler
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::{collections::HashMap, ops::AddAssign};

use crate::domain_type::RaplDomainIndex;

/// Snapshot of energy counters
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Snapshot {
    pub metrics: HashMap<RaplDomainIndex, u64>,
}

impl AddAssign<HashMap<RaplDomainIndex, u64>> for Snapshot {
    fn add_assign(&mut self, rhs: HashMap<RaplDomainIndex, u64>) {
        for (domain, value) in rhs {
            *self.metrics.entry(domain).or_default() += value;
        }
    }
}