SimGrid  3.14.159
Versatile Simulation of Distributed Systems
simgrid::surf::Cpu Class Referenceabstract

Detailed Description

SURF cpu resource interface class.

A Cpu represent a cpu associated to a host

#include <cpu_interface.hpp>

Inheritance diagram for simgrid::surf::Cpu:
simgrid::surf::Resource simgrid::surf::CpuCas01 simgrid::surf::CpuL07 simgrid::surf::CpuTi

Public Member Functions

 Cpu (simgrid::surf::Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint, std::vector< double > *speedPerPstate, int core)
 Cpu constructor. More...
 
 Cpu (simgrid::surf::Model *model, simgrid::s4u::Host *host, std::vector< double > *speedPerPstate, int core)
 Cpu constructor. More...
 
 ~Cpu ()
 
virtual simgrid::surf::Actionexecution_start (double size)=0
 Execute some quantity of computation. More...
 
virtual simgrid::surf::Actionsleep (double duration)=0
 Make a process sleep for duration (in seconds) More...
 
virtual int coreCount ()
 Get the amount of cores. More...
 
virtual double getSpeed (double load)
 Get the speed, accounting for the trace load and provided process load instead of the real current one. More...
 
virtual double getAvailableSpeed ()
 Get the available speed of the current Cpu. More...
 
virtual double getPstateSpeedCurrent ()
 Get the current Cpu computational speed. More...
 
virtual double getPstateSpeed (int pstate_index)
 
virtual int getNbPStates ()
 
virtual void setPState (int pstate_index)
 
virtual int getPState ()
 
simgrid::s4u::HostgetHost ()
 
virtual void setStateTrace (tmgr_trace_t trace)
 
virtual void setSpeedTrace (tmgr_trace_t trace)
 
- Public Member Functions inherited from simgrid::surf::Resource
 Resource (Model *model, const char *name, lmm_constraint_t constraint)
 Constructor of LMM Resources. More...
 
virtual ~Resource ()
 
ModelgetModel () const
 Get the Model of the current Resource. More...
 
const char * getName () const
 Get the name of the current Resource. More...
 
bool operator== (const Resource &other) const
 
virtual void apply_event (tmgr_trace_iterator_t event, double value)=0
 Apply an event of external load event to that resource. More...
 
virtual bool isUsed ()=0
 Check if the current Resource is used (if it currently serves an action) More...
 
virtual bool isOn () const
 Check if the current Resource is active. More...
 
virtual bool isOff () const
 Check if the current Resource is shut down. More...
 
virtual void turnOn ()
 Turn on the current Resource. More...
 
virtual void turnOff ()
 Turn off the current Resource. More...
 
lmm_constraint_t getConstraint () const
 Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) More...
 

Public Attributes

int coresAmount_ = 1
 
simgrid::s4u::Hosthost_
 
std::vector< double > speedPerPstate_
 
int pstate_ = 0
 
tmgr_trace_iterator_t stateEvent_ = nullptr
 
s_surf_metric_t speed_ = {1.0, 0, nullptr}
 

Protected Member Functions

virtual void onSpeedChange ()
 Take speed changes (either load or max) into account. More...
 

Additional Inherited Members

- Protected Attributes inherited from simgrid::surf::Resource
const lmm_constraint_t constraint_ = nullptr
 

Constructor & Destructor Documentation

◆ Cpu() [1/2]

simgrid::surf::Cpu::Cpu ( simgrid::surf::Model model,
simgrid::s4u::Host host,
lmm_constraint_t  constraint,
std::vector< double > *  speedPerPstate,
int  core 
)

Cpu constructor.

Parameters
modelThe CpuModel associated to this Cpu
hostThe host in which this Cpu should be plugged
constraintThe lmm constraint associated to this Cpu if it is part of a LMM component
speedPerPstateProcessor speed (in flop per second) for each pstate
coreThe number of core of this Cpu

◆ Cpu() [2/2]

simgrid::surf::Cpu::Cpu ( simgrid::surf::Model model,
simgrid::s4u::Host host,
std::vector< double > *  speedPerPstate,
int  core 
)

Cpu constructor.

Parameters
modelThe CpuModel associated to this Cpu
hostThe host in which this Cpu should be plugged
speedPerPstateProcessor speed (in flop per second) for each pstate
coreThe number of core of this Cpu

◆ ~Cpu()

simgrid::surf::Cpu::~Cpu ( )
default

Member Function Documentation

◆ execution_start()

virtual simgrid::surf::Action* simgrid::surf::Cpu::execution_start ( double  size)
pure virtual

Execute some quantity of computation.

Parameters
sizeThe value of the processing amount (in flop) needed to process
Returns
The CpuAction corresponding to the processing

Implemented in simgrid::surf::CpuTi, simgrid::surf::CpuL07, and simgrid::surf::CpuCas01.

◆ sleep()

virtual simgrid::surf::Action* simgrid::surf::Cpu::sleep ( double  duration)
pure virtual

Make a process sleep for duration (in seconds)

Parameters
durationThe number of seconds to sleep
Returns
The CpuAction corresponding to the sleeping

Implemented in simgrid::surf::CpuTi, simgrid::surf::CpuL07, and simgrid::surf::CpuCas01.

◆ coreCount()

int simgrid::surf::Cpu::coreCount ( )
virtual

Get the amount of cores.

◆ getSpeed()

double simgrid::surf::Cpu::getSpeed ( double  load)
virtual

Get the speed, accounting for the trace load and provided process load instead of the real current one.

◆ onSpeedChange()

void simgrid::surf::Cpu::onSpeedChange ( )
protectedvirtual

Take speed changes (either load or max) into account.

Reimplemented in simgrid::surf::CpuL07, and simgrid::surf::CpuCas01.

◆ getAvailableSpeed()

double simgrid::surf::Cpu::getAvailableSpeed ( )
virtual

Get the available speed of the current Cpu.

Reimplemented in simgrid::surf::CpuTi.

◆ getPstateSpeedCurrent()

double simgrid::surf::Cpu::getPstateSpeedCurrent ( )
virtual

Get the current Cpu computational speed.

◆ getPstateSpeed()

double simgrid::surf::Cpu::getPstateSpeed ( int  pstate_index)
virtual

◆ getNbPStates()

int simgrid::surf::Cpu::getNbPStates ( )
virtual

◆ setPState()

void simgrid::surf::Cpu::setPState ( int  pstate_index)
virtual

◆ getPState()

int simgrid::surf::Cpu::getPState ( )
virtual

◆ getHost()

simgrid::s4u::Host* simgrid::surf::Cpu::getHost ( )
inline

◆ setStateTrace()

void simgrid::surf::Cpu::setStateTrace ( tmgr_trace_t  trace)
virtual

◆ setSpeedTrace()

void simgrid::surf::Cpu::setSpeedTrace ( tmgr_trace_t  trace)
virtual

Reimplemented in simgrid::surf::CpuTi.

Member Data Documentation

◆ coresAmount_

int simgrid::surf::Cpu::coresAmount_ = 1

◆ host_

simgrid::s4u::Host* simgrid::surf::Cpu::host_

◆ speedPerPstate_

std::vector<double> simgrid::surf::Cpu::speedPerPstate_

◆ pstate_

int simgrid::surf::Cpu::pstate_ = 0

◆ stateEvent_

tmgr_trace_iterator_t simgrid::surf::Cpu::stateEvent_ = nullptr

◆ speed_

s_surf_metric_t simgrid::surf::Cpu::speed_ = {1.0, 0, nullptr}

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