[][src]Struct scaphandre::sensors::CPUSocket

pub struct CPUSocket {
    pub id: u16,
    pub domains: Vec<Domain>,
    pub attributes: Vec<Vec<HashMap<String, String>>>,
    pub counter_uj_path: String,
    pub record_buffer: Vec<Record>,
    pub buffer_max_kbytes: u16,
    pub cpu_cores: Vec<CPUCore>,
    pub stat_buffer: Vec<CPUStat>,
}

CPUSocket struct represents a CPU socket (matches physical_id attribute in /proc/cpuinfo), owning CPU cores (processor in /proc/cpuinfo).

Fields

id: u16

Numerical ID of the CPU socket (physical_id in /proc/cpuinfo)

domains: Vec<Domain>

RAPL domains attached to the socket

attributes: Vec<Vec<HashMap<String, String>>>

Text attributes linked to that socket, found in /proc/cpuinfo

counter_uj_path: String

Path to the file that provides the counter for energy consumed by the socket, in microjoules.

record_buffer: Vec<Record>

Comsumption records measured and stored by scaphandre for this socket.

buffer_max_kbytes: u16

Maximum size of the record_buffer in kilobytes.

cpu_cores: Vec<CPUCore>

CPU cores (core_id in /proc/cpuinfo) attached to the socket.

stat_buffer: Vec<CPUStat>

Usage statistics records stored for this socket.

Implementations

impl CPUSocket[src]

pub fn read_counter_uj(&self) -> Result<String, Box<dyn Error>>[src]

Returns the content of the energy consumption counter file, as a String value of microjoules.

pub fn get_domains(&mut self) -> &mut Vec<Domain>[src]

Returns a mutable reference to the domains vector.

pub fn get_domains_passive(&self) -> &Vec<Domain>[src]

Returns a mutable reference to the domains vector.

pub fn get_cores(&mut self) -> &mut Vec<CPUCore>[src]

Returns a mutable reference to the CPU cores vector.

pub fn get_cores_passive(&self) -> &Vec<CPUCore>[src]

Returns a immutable reference to the CPU cores vector.

pub fn add_cpu_core(&mut self, core: CPUCore)[src]

Adds a CPU core instance to the cores vector.

pub fn refresh_stats(&mut self)[src]

Generates a new CPUStat object storing current usage statistics of the socket and stores it in the stat_buffer.

pub fn read_stats(&self) -> Option<CPUStat>[src]

Combines stats from all CPU cores owned byu the socket and returns a CpuTime struct containing stats for the whole socket.

pub fn get_stats_diff(&mut self) -> Option<CPUStat>[src]

Computes the difference between previous usage statistics record for the socket and the current one. Returns a CPUStat object containing this difference, field by field.

pub fn get_records_diff_power_microwatts(&self) -> Option<Record>[src]

Returns a Record instance containing the power consumed between last and previous measurement, for this CPU socket

Trait Implementations

impl Clone for CPUSocket[src]

impl Debug for CPUSocket[src]

impl RecordGenerator for CPUSocket[src]

pub fn refresh_record(&mut self) -> Record[src]

Generates a new record of the socket energy consumption and stores it in the record_buffer. Returns a clone of this Record instance.

pub fn clean_old_records(&mut self)[src]

Checks the size in memory of record_buffer and deletes as many Record instances from the buffer to make it smaller in memory than buffer_max_kbytes.

pub fn get_records_passive(&self) -> Vec<Record>[src]

Returns a new owned Vector being a clone of the current record_buffer. This does not affect the current buffer but is costly.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,