geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
Public Types | Public Member Functions | Static Public Member Functions | List of all members
geopm::MSRIO Class Referenceabstract

#include <MSRIO.hpp>

Inheritance diagram for geopm::MSRIO:
Inheritance graph
[legend]

Public Types

enum  m_driver_e { M_DRIVER_MSRSAFE , M_DRIVER_MSR , M_NUM_DRIVER }
 

Public Member Functions

 MSRIO ()=default
 
virtual ~MSRIO ()=default
 
virtual uint64_t read_msr (int cpu_idx, uint64_t offset)=0
 Read from a single MSR on a CPU. More...
 
virtual void write_msr (int cpu_idx, uint64_t offset, uint64_t raw_value, uint64_t write_mask)=0
 Write to a single MSR on a CPU. More...
 
virtual int create_batch_context (void)=0
 Add a new batch context to the set of managed contexts. More...
 
virtual int add_read (int cpu_idx, uint64_t offset)=0
 Extend the set of MSRs for batch read with a single offset. Note: uses the default batch context. More...
 
virtual int add_read (int cpu_idx, uint64_t offset, int batch_ctx)=0
 Extend the set of MSRs for batch read with a single offset. More...
 
virtual void read_batch (void)=0
 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...
 
virtual void read_batch (int batch_ctx)=0
 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...
 
virtual int add_write (int cpu_idx, uint64_t offset)=0
 Add another offset to the list of MSRs to be written in batch. Note: uses the default batch context. More...
 
virtual int add_write (int cpu_idx, uint64_t offset, int batch_ctx)=0
 Add another offset to the list of MSRs to be written in batch. More...
 
virtual void adjust (int batch_idx, uint64_t value, uint64_t write_mask)=0
 Adjust a value that was previously added with the add_write() method. Note: uses the default batch context. More...
 
virtual void adjust (int batch_idx, uint64_t value, uint64_t write_mask, int batch_ctx)=0
 Adjust a value that was previously added with the add_write() method. More...
 
virtual uint64_t sample (int batch_idx) const =0
 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...
 
virtual uint64_t sample (int batch_idx, int batch_ctx) const =0
 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...
 
virtual void write_batch (void)=0
 Write all adjusted values. Note: uses the default batch context. More...
 
virtual void write_batch (int batch_ctx)=0
 Write all adjusted values. More...
 
virtual uint64_t system_write_mask (uint64_t offset)=0
 Return the system write mask for a given offset. More...
 

Static Public Member Functions

static std::unique_ptr< MSRIOmake_unique (int driver_type)
 Returns a unique_ptr to a concrete object constructed using the underlying implementation. More...
 

Member Enumeration Documentation

◆ m_driver_e

Enumerator
M_DRIVER_MSRSAFE 
M_DRIVER_MSR 
M_NUM_DRIVER 

Constructor & Destructor Documentation

◆ MSRIO()

geopm::MSRIO::MSRIO ( )
default

◆ ~MSRIO()

virtual geopm::MSRIO::~MSRIO ( )
virtualdefault

Member Function Documentation

◆ add_read() [1/2]

virtual int geopm::MSRIO::add_read ( int  cpu_idx,
uint64_t  offset 
)
pure virtual

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().

Implemented in geopm::MSRIOImp.

◆ add_read() [2/2]

virtual int geopm::MSRIO::add_read ( int  cpu_idx,
uint64_t  offset,
int  batch_ctx 
)
pure virtual

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().

Implemented in geopm::MSRIOImp.

◆ add_write() [1/2]

virtual int geopm::MSRIO::add_write ( int  cpu_idx,
uint64_t  offset 
)
pure virtual

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().

Implemented in geopm::MSRIOImp.

◆ add_write() [2/2]

virtual int geopm::MSRIO::add_write ( int  cpu_idx,
uint64_t  offset,
int  batch_ctx 
)
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ adjust() [1/2]

virtual void geopm::MSRIO::adjust ( int  batch_idx,
uint64_t  value,
uint64_t  write_mask 
)
pure virtual

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

Implemented in geopm::MSRIOImp.

◆ adjust() [2/2]

virtual void geopm::MSRIO::adjust ( int  batch_idx,
uint64_t  value,
uint64_t  write_mask,
int  batch_ctx 
)
pure virtual

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

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

Implemented in geopm::MSRIOImp.

◆ create_batch_context()

virtual int geopm::MSRIO::create_batch_context ( void  )
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ make_unique()

std::unique_ptr< MSRIO > geopm::MSRIO::make_unique ( int  driver_type)
static

Returns a unique_ptr to a concrete object constructed using the underlying implementation.

◆ read_batch() [1/2]

virtual void geopm::MSRIO::read_batch ( int  batch_ctx)
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ read_batch() [2/2]

virtual void geopm::MSRIO::read_batch ( void  )
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ read_msr()

virtual uint64_t geopm::MSRIO::read_msr ( int  cpu_idx,
uint64_t  offset 
)
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ sample() [1/2]

virtual uint64_t geopm::MSRIO::sample ( int  batch_idx) const
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ sample() [2/2]

virtual uint64_t geopm::MSRIO::sample ( int  batch_idx,
int  batch_ctx 
) const
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ system_write_mask()

virtual uint64_t geopm::MSRIO::system_write_mask ( uint64_t  offset)
pure virtual

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.

Implemented in geopm::MSRIOImp.

◆ write_batch() [1/2]

virtual void geopm::MSRIO::write_batch ( int  batch_ctx)
pure virtual

Write all adjusted values.

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

Implemented in geopm::MSRIOImp.

◆ write_batch() [2/2]

virtual void geopm::MSRIO::write_batch ( void  )
pure virtual

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

Implemented in geopm::MSRIOImp.

◆ write_msr()

virtual void geopm::MSRIO::write_msr ( int  cpu_idx,
uint64_t  offset,
uint64_t  raw_value,
uint64_t  write_mask 
)
pure virtual

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.

Implemented in geopm::MSRIOImp.


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