jdrouet/powercap

Question for calculation of total energy

Opened this issue ยท 0 comments

Hi there! ๐Ÿ˜„ I have a question about total energy calculation.

According to the paper "RAPL in Action", package domain measures the energy consumption of the entire socket. It includes the consumption of all the cores, integrated graphics and the uncore components(last level caches, memory controller).

Since socket's energy already contains energy of cpu cores and other uncore components, I think total_energy function in Socket should not add core and uncore energy. However, the code below does not consider about the type of domain.

impl Socket {
    // some implementations...

    pub fn total_energy(&self) -> Result<u64, ReadError> {
        let mut res = self.energy()?;
        for (_, item) in self.domains.iter() {
            res += item.energy()?; // I think this part should be changed that can consider the domain.
        }
        Ok(res)
    }
}

impl IntelRapl {
    // some implementations...

    pub fn total_energy(&self) -> Result<u64, reader::ReadError> {
        let mut res = 0;
        for (_, item) in self.sockets.iter() {
            res += item.total_energy()?;
        }
        Ok(res)
    }
}

I'd love to know what you think about this. Thank you!