SimGrid  3.18
Versatile Simulation of Distributed Systems
simgrid::surf::Action Class Reference

Detailed Description

SURF action interface class.

An action is an event generated by a resource (e.g.: a communication for the network)

#include <surf_interface.hpp>

Inheritance diagram for simgrid::surf::Action:
simgrid::surf::CpuAction simgrid::surf::NetworkAction simgrid::surf::StorageAction simgrid::surf::CpuCas01Action simgrid::surf::CpuTiAction simgrid::surf::L07Action simgrid::surf::NetworkCm02Action simgrid::surf::NetworkConstantAction simgrid::surf::NetworkNS3Action simgrid::surf::StorageN11Action

Public Types

enum  State {
  State::ready = 0, State::running, State::failed, State::done,
  State::to_free, State::not_in_the_system
}
 
typedef boost::intrusive::member_hook< Action, boost::intrusive::list_member_hook<>, &Action::action_hookActionOptions
 
typedef boost::intrusive::list< Action, ActionOptionsActionList
 

Public Member Functions

 Action (simgrid::surf::Model *model, double cost, bool failed)
 Action constructor. More...
 
 Action (simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var)
 Action constructor. More...
 
virtual ~Action ()
 Destructor. More...
 
void finish (Action::State state)
 Mark that the action is now finished. More...
 
Action::State getState () const
 Get the state of the current Action. More...
 
virtual void setState (Action::State state)
 Set the state of the current Action. More...
 
double getBound () const
 Get the bound of the current Action. More...
 
void setBound (double bound)
 Set the bound of the current Action. More...
 
double getStartTime () const
 Get the start time of the current action. More...
 
double getFinishTime () const
 Get the finish time of the current action. More...
 
voidgetData () const
 Get the user data associated to the current action. More...
 
void setData (void *data)
 Set the user data associated to the current action. More...
 
double getCost () const
 Get the cost of the current action. More...
 
void setCost (double cost)
 Set the cost of the current action. More...
 
void updateMaxDuration (double delta)
 Update the maximum duration of the current action. More...
 
void updateRemains (double delta)
 Update the remaining time of the current action. More...
 
void setRemains (double value)
 Set the remaining time of the current action. More...
 
virtual double getRemains ()
 Get the remaining time of the current action after updating the resource. More...
 
double getRemainsNoUpdate () const
 Get the remaining time of the current action without updating the resource. More...
 
void setFinishTime (double value)
 Set the finish time of the current action. More...
 
void ref ()
 Add a reference to the current action (refcounting) More...
 
virtual int unref ()
 Unref that action (and destroy it if refcount reaches 0) More...
 
virtual void cancel ()
 Cancel the current Action if running. More...
 
virtual void suspend ()
 Suspend the current Action. More...
 
virtual void resume ()
 Resume the current Action. More...
 
virtual bool isSuspended ()
 Returns true if the current action is running. More...
 
double getMaxDuration () const
 Get the maximum duration of the current action. More...
 
virtual void setMaxDuration (double duration)
 Set the maximum duration of the current Action. More...
 
char * getCategory () const
 Get the tracing category associated to the current action. More...
 
void setCategory (const char *category)
 Set the tracing category of the current Action. More...
 
double getPriority () const
 Get the priority of the current Action. More...
 
virtual void setSharingWeight (double priority)
 Set the priority of the current Action. More...
 
void setSharingWeightNoUpdate (double weight)
 
ActionListgetStateSet () const
 Get the state set in which the action is. More...
 
simgrid::surf::ModelgetModel () const
 
virtual void updateRemainingLazy (double now)
 
void heapInsert (heap_type &heap, double key, enum heap_action_type hat)
 
void heapRemove (heap_type &heap)
 
void heapUpdate (heap_type &heap, double key, enum heap_action_type hat)
 
void clearHeapHandle ()
 
lmm_variable_t getVariable () const
 
void setVariable (lmm_variable_t var)
 
double getLastUpdate () const
 
void refreshLastUpdate ()
 
double getLastValue () const
 
void setLastValue (double val)
 
enum heap_action_type getHat () const
 
bool is_linked () const
 

Public Attributes

boost::intrusive::list_member_hook action_hook
 
boost::intrusive::list_member_hook action_lmm_hook
 

Protected Attributes

ActionListstateSet_
 
int refcount_ = 1
 
int suspended_ = 0
 

Member Typedef Documentation

◆ ActionOptions

typedef boost::intrusive::member_hook< Action, boost::intrusive::list_member_hook<>, &Action::action_hook> simgrid::surf::Action::ActionOptions

◆ ActionList

typedef boost::intrusive::list<Action, ActionOptions> simgrid::surf::Action::ActionList

Member Enumeration Documentation

◆ State

Enumerator
ready 

Ready.

running 

Running.

failed 

Task Failure.

done 

Completed.

to_free 

Action to free in next cleanup.

not_in_the_system 

Not in the system anymore.

Why did you ask ?

Constructor & Destructor Documentation

◆ Action() [1/2]

simgrid::surf::Action::Action ( simgrid::surf::Model model,
double  cost,
bool  failed 
)

Action constructor.

Parameters
modelThe Model associated to this Action
costThe cost of the Action
failedIf the action is impossible (e.g.: execute something on a switched off host)

◆ Action() [2/2]

simgrid::surf::Action::Action ( simgrid::surf::Model model,
double  cost,
bool  failed,
lmm_variable_t  var 
)

Action constructor.

Parameters
modelThe Model associated to this Action
costThe cost of the Action
failedIf the action is impossible (e.g.: execute something on a switched off host)
varThe lmm variable associated to this Action if it is part of a LMM component

◆ ~Action()

simgrid::surf::Action::~Action ( )
virtual

Destructor.

Member Function Documentation

◆ finish()

void simgrid::surf::Action::finish ( Action::State  state)

Mark that the action is now finished.

Parameters
statethe new state of the current Action

◆ getState()

Action::State simgrid::surf::Action::getState ( ) const

Get the state of the current Action.

get the state

◆ setState()

void simgrid::surf::Action::setState ( Action::State  state)
virtual

◆ getBound()

double simgrid::surf::Action::getBound ( ) const

Get the bound of the current Action.

◆ setBound()

void simgrid::surf::Action::setBound ( double  bound)

Set the bound of the current Action.

◆ getStartTime()

double simgrid::surf::Action::getStartTime ( ) const
inline

Get the start time of the current action.

◆ getFinishTime()

double simgrid::surf::Action::getFinishTime ( ) const
inline

Get the finish time of the current action.

◆ getData()

void* simgrid::surf::Action::getData ( ) const
inline

Get the user data associated to the current action.

◆ setData()

void simgrid::surf::Action::setData ( void data)
inline

Set the user data associated to the current action.

◆ getCost()

double simgrid::surf::Action::getCost ( ) const
inline

Get the cost of the current action.

◆ setCost()

void simgrid::surf::Action::setCost ( double  cost)
inline

Set the cost of the current action.

◆ updateMaxDuration()

void simgrid::surf::Action::updateMaxDuration ( double  delta)
inline

Update the maximum duration of the current action.

Parameters
deltaAmount to remove from the MaxDuration

◆ updateRemains()

void simgrid::surf::Action::updateRemains ( double  delta)
inline

Update the remaining time of the current action.

Parameters
deltaAmount to remove from the remaining time

◆ setRemains()

void simgrid::surf::Action::setRemains ( double  value)
inline

Set the remaining time of the current action.

◆ getRemains()

double simgrid::surf::Action::getRemains ( )
virtual

Get the remaining time of the current action after updating the resource.

Reimplemented in simgrid::surf::CpuTiAction.

◆ getRemainsNoUpdate()

double simgrid::surf::Action::getRemainsNoUpdate ( ) const
inline

Get the remaining time of the current action without updating the resource.

◆ setFinishTime()

void simgrid::surf::Action::setFinishTime ( double  value)
inline

Set the finish time of the current action.

◆ ref()

void simgrid::surf::Action::ref ( )

Add a reference to the current action (refcounting)

◆ unref()

int simgrid::surf::Action::unref ( )
virtual

Unref that action (and destroy it if refcount reaches 0)

Returns
true if the action was destroyed and false if someone still has references on it

Reimplemented in simgrid::surf::L07Action, simgrid::surf::CpuTiAction, simgrid::surf::StorageN11Action, and simgrid::surf::NetworkNS3Action.

◆ cancel()

void simgrid::surf::Action::cancel ( )
virtual

Cancel the current Action if running.

Reimplemented in simgrid::surf::CpuTiAction, and simgrid::surf::StorageN11Action.

◆ suspend()

void simgrid::surf::Action::suspend ( )
virtual

◆ resume()

void simgrid::surf::Action::resume ( )
virtual

◆ isSuspended()

bool simgrid::surf::Action::isSuspended ( )
virtual

Returns true if the current action is running.

Reimplemented in simgrid::surf::StorageN11Action, and simgrid::surf::NetworkNS3Action.

◆ getMaxDuration()

double simgrid::surf::Action::getMaxDuration ( ) const
inline

Get the maximum duration of the current action.

◆ setMaxDuration()

void simgrid::surf::Action::setMaxDuration ( double  duration)
virtual

Set the maximum duration of the current Action.

Reimplemented in simgrid::surf::CpuTiAction, and simgrid::surf::StorageN11Action.

◆ getCategory()

char* simgrid::surf::Action::getCategory ( ) const
inline

Get the tracing category associated to the current action.

◆ setCategory()

void simgrid::surf::Action::setCategory ( const char *  category)

Set the tracing category of the current Action.

◆ getPriority()

double simgrid::surf::Action::getPriority ( ) const
inline

Get the priority of the current Action.

◆ setSharingWeight()

void simgrid::surf::Action::setSharingWeight ( double  priority)
virtual

Set the priority of the current Action.

Reimplemented in simgrid::surf::CpuTiAction, and simgrid::surf::StorageN11Action.

◆ setSharingWeightNoUpdate()

void simgrid::surf::Action::setSharingWeightNoUpdate ( double  weight)
inline

◆ getStateSet()

ActionList* simgrid::surf::Action::getStateSet ( ) const
inline

Get the state set in which the action is.

◆ getModel()

simgrid::surf::Model* simgrid::surf::Action::getModel ( ) const
inline

◆ updateRemainingLazy()

virtual void simgrid::surf::Action::updateRemainingLazy ( double  now)
inlinevirtual

◆ heapInsert()

void simgrid::surf::Action::heapInsert ( heap_type heap,
double  key,
enum heap_action_type  hat 
)

◆ heapRemove()

void simgrid::surf::Action::heapRemove ( heap_type heap)

◆ heapUpdate()

void simgrid::surf::Action::heapUpdate ( heap_type heap,
double  key,
enum heap_action_type  hat 
)

◆ clearHeapHandle()

void simgrid::surf::Action::clearHeapHandle ( )
inline

◆ getVariable()

lmm_variable_t simgrid::surf::Action::getVariable ( ) const
inline

◆ setVariable()

void simgrid::surf::Action::setVariable ( lmm_variable_t  var)
inline

◆ getLastUpdate()

double simgrid::surf::Action::getLastUpdate ( ) const
inline

◆ refreshLastUpdate()

void simgrid::surf::Action::refreshLastUpdate ( )
inline

◆ getLastValue()

double simgrid::surf::Action::getLastValue ( ) const
inline

◆ setLastValue()

void simgrid::surf::Action::setLastValue ( double  val)
inline

◆ getHat()

enum heap_action_type simgrid::surf::Action::getHat ( ) const
inline

◆ is_linked()

bool simgrid::surf::Action::is_linked ( ) const
inline

Member Data Documentation

◆ action_hook

boost::intrusive::list_member_hook simgrid::surf::Action::action_hook

◆ action_lmm_hook

boost::intrusive::list_member_hook simgrid::surf::Action::action_lmm_hook

◆ stateSet_

ActionList* simgrid::surf::Action::stateSet_
protected

◆ refcount_

int simgrid::surf::Action::refcount_ = 1
protected

◆ suspended_

int simgrid::surf::Action::suspended_ = 0
protected

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