SimGrid  3.16
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 ()
 Mark that the action is now finished. More...
 
Action::State getState ()
 Get the state of the current Action. More...
 
virtual void setState (Action::State state)
 Set the state of the current Action. More...
 
double getBound ()
 Get the bound of the current Action. More...
 
void setBound (double bound)
 Set the bound of the current Action. More...
 
double getStartTime ()
 Get the start time of the current action. More...
 
double getFinishTime ()
 Get the finish time of the current action. More...
 
voidgetData ()
 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 ()
 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 ()
 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 ()
 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 ()
 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 ()
 Get the priority of the current Action. More...
 
virtual void setPriority (double priority)
 Set the priority of the current Action. More...
 
ActionListgetStateSet ()
 Get the state set in which the action is. More...
 
simgrid::surf::ModelgetModel ()
 
virtual void updateRemainingLazy (double now)
 
void heapInsert (xbt_heap_t heap, double key, enum heap_action_type hat)
 
void heapRemove (xbt_heap_t heap)
 
void heapUpdate (xbt_heap_t heap, double key, enum heap_action_type hat)
 
void updateIndexHeap (int i)
 
lmm_variable_t getVariable ()
 
double getLastUpdate ()
 
void refreshLastUpdate ()
 
enum heap_action_type getHat ()
 
bool is_linked ()
 
void gapRemove ()
 

Public Attributes

boost::intrusive::list_member_hook action_hook
 
boost::intrusive::list_member_hook action_lmm_hook
 
s_xbt_swag_hookup_t stateHookup_ = {nullptr,nullptr}
 

Protected Attributes

ActionListstateSet_
 
double priority_ = 1.0
 priority (1.0 by default) More...
 
int refcount_ = 1
 
double remains_
 How much of that cost remains to be done in the currently running task. More...
 
double maxDuration_ = NO_MAX_DURATION
 
double finishTime_ = -1
 finish time : this is modified during the run and fluctuates until the task is completed More...
 
lmm_variable_t variable_ = nullptr
 
double lastValue_ = 0
 
double lastUpdate_ = 0
 
int suspended_ = 0
 
int indexHeap_
 
enum heap_action_type hat_ = NOTSET
 

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

Mark that the action is now finished.

◆ getState()

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

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

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

Get the start time of the current action.

◆ getFinishTime()

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

Get the finish time of the current action.

◆ getData()

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

Get the user data associated to the current action.

◆ setData()

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

Set the user data associated to the current action.

◆ getCost()

double simgrid::surf::Action::getCost ( )
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 ( )

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

Get the priority of the current Action.

◆ setPriority()

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

Set the priority of the current Action.

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

◆ getStateSet()

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

Get the state set in which the action is.

◆ getModel()

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

◆ updateRemainingLazy()

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

◆ heapInsert()

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

◆ heapRemove()

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

◆ heapUpdate()

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

◆ updateIndexHeap()

void simgrid::surf::Action::updateIndexHeap ( int  i)

◆ getVariable()

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

◆ getLastUpdate()

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

◆ refreshLastUpdate()

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

◆ getHat()

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

◆ is_linked()

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

◆ gapRemove()

void simgrid::surf::Action::gapRemove ( )

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

◆ stateHookup_

s_xbt_swag_hookup_t simgrid::surf::Action::stateHookup_ = {nullptr,nullptr}

◆ stateSet_

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

◆ priority_

double simgrid::surf::Action::priority_ = 1.0
protected

priority (1.0 by default)

◆ refcount_

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

◆ remains_

double simgrid::surf::Action::remains_
protected

How much of that cost remains to be done in the currently running task.

◆ maxDuration_

double simgrid::surf::Action::maxDuration_ = NO_MAX_DURATION
protected

◆ finishTime_

double simgrid::surf::Action::finishTime_ = -1
protected

finish time : this is modified during the run and fluctuates until the task is completed

◆ variable_

lmm_variable_t simgrid::surf::Action::variable_ = nullptr
protected

◆ lastValue_

double simgrid::surf::Action::lastValue_ = 0
protected

◆ lastUpdate_

double simgrid::surf::Action::lastUpdate_ = 0
protected

◆ suspended_

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

◆ indexHeap_

int simgrid::surf::Action::indexHeap_
protected

◆ hat_

enum heap_action_type simgrid::surf::Action::hat_ = NOTSET
protected

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