geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Classes | Public Member Functions | List of all members
geopm::MSRIOImp Class Reference

#include <MSRIOImp.hpp>

Inheritance diagram for geopm::MSRIOImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::MSRIOImp:
Collaboration graph
[legend]

Public Member Functions

 MSRIOImp ()=delete
 
 MSRIOImp (std::shared_ptr< MSRPath > path)
 
 MSRIOImp (int num_cpu, std::shared_ptr< MSRPath > path, std::shared_ptr< IOUring > batch_reader, std::shared_ptr< IOUring > batch_writer)
 
 MSRIOImp (const MSRIOImp &other)=delete
 
MSRIOImpoperator= (const MSRIOImp &other)=delete
 
virtual ~MSRIOImp ()
 
uint64_t read_msr (int cpu_idx, uint64_t offset) override
 Read from a single MSR on a CPU. More...
 
void write_msr (int cpu_idx, uint64_t offset, uint64_t raw_value, uint64_t write_mask) override
 Write to a single MSR on a CPU. More...
 
int create_batch_context (void) override
 Add a new batch context to the set of managed contexts. More...
 
int add_read (int cpu_idx, uint64_t offset) override
 Extend the set of MSRs for batch read with a single offset. Note: uses the default batch context. More...
 
int add_read (int cpu_idx, uint64_t offset, int batch_ctx) override
 Extend the set of MSRs for batch read with a single offset. More...
 
void read_batch () override
 Batch read a set of MSRs configured by a previous call to the batch_config() method. The memory used to store the result should have been returned by add_read(). Note: uses the default batch context. More...
 
void read_batch (int batch_ctx) override
 Batch read a set of MSRs configured by a previous call to the batch_config() method. The memory used to store the result should have been returned by add_read(). More...
 
uint64_t sample (int batch_idx) const override
 Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read(). read_batch() must be called prior to calling this function. Note: uses the default batch context. More...
 
uint64_t sample (int batch_idx, int batch_ctx) const override
 Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read(). read_batch() must be called prior to calling this function. More...
 
void write_batch () override
 Write all adjusted values. Note: uses the default batch context. More...
 
void write_batch (int batch_ctx) override
 Write all adjusted values. More...
 
int add_write (int cpu_idx, uint64_t offset) override
 Add another offset to the list of MSRs to be written in batch. Note: uses the default batch context. More...
 
int add_write (int cpu_idx, uint64_t offset, int batch_ctx) override
 Add another offset to the list of MSRs to be written in batch. More...
 
void adjust (int batch_idx, uint64_t value, uint64_t write_mask) override
 Adjust a value that was previously added with the add_write() method. Note: uses the default batch context. More...
 
void adjust (int batch_idx, uint64_t value, uint64_t write_mask, int batch_ctx) override
 Adjust a value that was previously added with the add_write() method. More...
 
uint64_t system_write_mask (uint64_t offset) override
 Return the system write mask for a given offset. More...
 
- Public Member Functions inherited from geopm::MSRIO
 MSRIO ()=default
 
virtual ~MSRIO ()=default
 

Additional Inherited Members

- Public Types inherited from geopm::MSRIO
enum  m_driver_e { M_DRIVER_MSRSAFE , M_DRIVER_MSR , M_NUM_DRIVER }
 
- Static Public Member Functions inherited from geopm::MSRIO
static std::unique_ptr< MSRIOmake_unique (int driver_type)
 Returns a unique_ptr to a concrete object constructed using the underlying implementation. More...
 

Constructor & Destructor Documentation

◆ MSRIOImp() [1/4]

geopm::MSRIOImp::MSRIOImp ( )
delete

◆ MSRIOImp() [2/4]

geopm::MSRIOImp::MSRIOImp ( std::shared_ptr< MSRPath path)

◆ MSRIOImp() [3/4]

geopm::MSRIOImp::MSRIOImp ( int  num_cpu,
std::shared_ptr< MSRPath path,
std::shared_ptr< IOUring batch_reader,
std::shared_ptr< IOUring batch_writer 
)

◆ MSRIOImp() [4/4]

geopm::MSRIOImp::MSRIOImp ( const MSRIOImp other)
delete

◆ ~MSRIOImp()

geopm::MSRIOImp::~MSRIOImp ( )
virtual

Member Function Documentation

◆ add_read() [1/2]

int geopm::MSRIOImp::add_read ( int  cpu_idx,
uint64_t  offset 
)
overridevirtual

Extend the set of MSRs for batch read with a single offset. Note: uses the default batch context.

Parameters
[in]cpu_idxlogical Linux CPU index to read from when read_batch() method is called.
[in]offsetMSR offset to be read when read_batch() is called.
Returns
The logical index that will be passed to sample().

Implements geopm::MSRIO.

◆ add_read() [2/2]

int geopm::MSRIOImp::add_read ( int  cpu_idx,
uint64_t  offset,
int  batch_ctx 
)
overridevirtual

Extend the set of MSRs for batch read with a single offset.

Parameters
[in]cpu_idxlogical Linux CPU index to read from when read_batch() method is called.
[in]offsetMSR offset to be read when read_batch() is called.
[in]batch_ctxbatch context index where the read will be added.
Returns
The logical index that will be passed to sample().
Todo:
return same index for repeated calls with same inputs.

Implements geopm::MSRIO.

◆ add_write() [1/2]

int geopm::MSRIOImp::add_write ( int  cpu_idx,
uint64_t  offset 
)
overridevirtual

Add another offset to the list of MSRs to be written in batch. Note: uses the default batch context.

Parameters
[in]cpu_idxlogical Linux CPU index to write to when write_batch() method is called.
[in]offsetMSR offset to be written when write_batch() method is called.
Returns
The logical index that will be passed to adjust().

Implements geopm::MSRIO.

◆ add_write() [2/2]

int geopm::MSRIOImp::add_write ( int  cpu_idx,
uint64_t  offset,
int  batch_ctx 
)
overridevirtual

Add another offset to the list of MSRs to be written in batch.

Parameters
[in]cpu_idxlogical Linux CPU index to write to when write_batch() method is called.
[in]offsetMSR offset to be written when write_batch() method is called.
Returns
The logical index that will be passed to adjust().
Parameters
[in]batch_ctxbatch context index where the write will be added.

Implements geopm::MSRIO.

◆ adjust() [1/2]

void geopm::MSRIOImp::adjust ( int  batch_idx,
uint64_t  value,
uint64_t  write_mask 
)
overridevirtual

Adjust a value that was previously added with the add_write() method. Note: uses the default batch context.

Implements geopm::MSRIO.

◆ adjust() [2/2]

void geopm::MSRIOImp::adjust ( int  batch_idx,
uint64_t  value,
uint64_t  write_mask,
int  batch_ctx 
)
overridevirtual

Adjust a value that was previously added with the add_write() method.

Parameters
[in]batch_ctxindex of batch context where value will be adjusted.

Implements geopm::MSRIO.

◆ create_batch_context()

int geopm::MSRIOImp::create_batch_context ( void  )
overridevirtual

Add a new batch context to the set of managed contexts.

Returns
The context index that can be passed to future batch methods to refer to the added context.

Implements geopm::MSRIO.

◆ operator=()

MSRIOImp& geopm::MSRIOImp::operator= ( const MSRIOImp other)
delete

◆ read_batch() [1/2]

void geopm::MSRIOImp::read_batch ( )
overridevirtual

Batch read a set of MSRs configured by a previous call to the batch_config() method. The memory used to store the result should have been returned by add_read(). Note: uses the default batch context.

Implements geopm::MSRIO.

◆ read_batch() [2/2]

void geopm::MSRIOImp::read_batch ( int  batch_ctx)
overridevirtual

Batch read a set of MSRs configured by a previous call to the batch_config() method. The memory used to store the result should have been returned by add_read().

Parameters
[in]batch_ctxindex for batch context to use for the read.

Implements geopm::MSRIO.

◆ read_msr()

uint64_t geopm::MSRIOImp::read_msr ( int  cpu_idx,
uint64_t  offset 
)
overridevirtual

Read from a single MSR on a CPU.

[in] cpu_idx logical Linux CPU index to read from.

Parameters
[in]offsetThe MSR offset to read from.
Returns
The raw encoded MSR value read.

Implements geopm::MSRIO.

◆ sample() [1/2]

uint64_t geopm::MSRIOImp::sample ( int  batch_idx) const
overridevirtual

Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read(). read_batch() must be called prior to calling this function. Note: uses the default batch context.

Implements geopm::MSRIO.

◆ sample() [2/2]

uint64_t geopm::MSRIOImp::sample ( int  batch_idx,
int  batch_ctx 
) const
overridevirtual

Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read(). read_batch() must be called prior to calling this function.

Parameters
[in]batch_ctxindex of batch context from which the value will be read.

Implements geopm::MSRIO.

◆ system_write_mask()

uint64_t geopm::MSRIOImp::system_write_mask ( uint64_t  offset)
overridevirtual

Return the system write mask for a given offset.

Parameters
[in]offsetMSR offset to query
Returns
The msr-safe write mask or all 1's if not using msr-safe.

Implements geopm::MSRIO.

◆ write_batch() [1/2]

void geopm::MSRIOImp::write_batch ( )
overridevirtual

Write all adjusted values. Note: uses the default batch context.

Implements geopm::MSRIO.

◆ write_batch() [2/2]

void geopm::MSRIOImp::write_batch ( int  batch_ctx)
overridevirtual

Write all adjusted values.

Parameters
[in]batch_ctxindex for batch context to use for the write.

Implements geopm::MSRIO.

◆ write_msr()

void geopm::MSRIOImp::write_msr ( int  cpu_idx,
uint64_t  offset,
uint64_t  raw_value,
uint64_t  write_mask 
)
overridevirtual

Write to a single MSR on a CPU.

Parameters
[in]cpu_idxlogical Linux CPU index to write to.
[in]offsetThe MSR offset to write to.
[in]raw_valueThe raw encoded MSR value to write, only bits where the write_mask is set will be written, other bits in the MSR will be unmodified.
[in]write_maskThe mask determines the bits of the MSR that will be modified. An error will occur if bits are set in the raw_value that are not in the write mask.

Implements geopm::MSRIO.


The documentation for this class was generated from the following files: