SimGrid  3.21
Versatile Simulation of Distributed Systems
simgrid::kernel::resource::Action Class Referenceabstract

Detailed Description

An action is a consumption on a resource (e.g.: a communication for the network).

It is related (but still different) from activities, that are the stuff on which an actor can be blocked. See simgrid::s4u::Activity for more details.

#include <Action.hpp>

Public Types

enum  State {
  State::INITED, State::STARTED, State::FAILED, State::FINISHED,
  State::IGNORED
}
 
enum  SuspendStates { SuspendStates::not_suspended = 0, SuspendStates::suspended, SuspendStates::sleeping }
 
typedef boost::intrusive::list< Action, boost::intrusive::member_hook< Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_ > > ModifiedSet
 
typedef boost::intrusive::list< Action, boost::intrusive::member_hook< Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_ > > StateSet
 

Public Member Functions

bool is_within_modified_set () const
 
 Action (Model *model, double cost, bool failed)
 Action constructor. More...
 
 Action (Model *model, double cost, bool failed, lmm::Variable *var)
 Action constructor. More...
 
virtual ~Action ()
 
void finish (Action::State state)
 Mark that the action is now finished. More...
 
Action::State get_state () const
 Get the state of the current Action. More...
 
virtual void set_state (Action::State state)
 Set the state of the current Action. More...
 
double get_bound () const
 Get the bound of the current Action. More...
 
void set_bound (double bound)
 Set the bound of the current Action. More...
 
double get_start_time () const
 Get the start time of the current action. More...
 
double get_finish_time () const
 Get the finish time of the current action. More...
 
void * get_data () const
 Get the user data associated to the current action. More...
 
void set_data (void *data)
 Set the user data associated to the current action. More...
 
double get_cost () const
 Get the cost of the current action. More...
 
void set_cost (double cost)
 Set the cost of the current action. More...
 
void update_max_duration (double delta)
 Update the maximum duration of the current action. More...
 
void update_remains (double delta)
 Update the remaining time of the current action. More...
 
virtual void update_remains_lazy (double now)=0
 
void set_remains (double value)
 Set the remaining time of the current action. More...
 
virtual double get_remains ()
 Get the remaining time of the current action after updating the resource. More...
 
double get_remains_no_update () const
 Get the remaining time of the current action without updating the resource. More...
 
void set_finish_time (double value)
 Set the finish time of the current action. More...
 
void ref ()
 Add a reference to the current action (refcounting) More...
 
bool 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...
 
bool is_suspended ()
 Returns true if the current action is running. More...
 
double get_max_duration () const
 Get the maximum duration of the current action. More...
 
virtual void set_max_duration (double duration)
 Set the maximum duration of the current Action. More...
 
std::string get_category () const
 Get the tracing category associated to the current action. More...
 
void set_category (std::string category)
 Set the tracing category of the current Action. More...
 
double get_priority () const
 Get the priority of the current Action. More...
 
virtual void set_priority (double priority)
 Set the priority of the current Action. More...
 
void set_priority_no_update (double priority)
 
StateSetget_state_set () const
 Get the state set in which the action is. More...
 
simgrid::kernel::resource::Modelget_model () const
 
ActionHeap::Type get_type () const
 
lmm::Variable * get_variable () const
 
void set_variable (lmm::Variable *var)
 
double get_last_update () const
 
void set_last_update ()
 
double get_last_value () const
 
void set_last_value (double val)
 

Public Attributes

boost::intrusive::list_member_hook modified_set_hook_
 
boost::intrusive::list_member_hook state_set_hook_
 

Protected Attributes

StateSetstate_set_
 
Action::SuspendStates suspended_ = Action::SuspendStates::not_suspended
 

Member Typedef Documentation

◆ ModifiedSet

typedef boost::intrusive::list< Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_> > simgrid::kernel::resource::Action::ModifiedSet

◆ StateSet

typedef boost::intrusive::list< Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_> > simgrid::kernel::resource::Action::StateSet

Member Enumeration Documentation

◆ State

Enumerator
INITED 

Created, but not started yet.

STARTED 

Currently running.

FAILED 

either the resource failed, or the action was canceled

FINISHED 

Successfully completed.

IGNORED 

e.g.

failure detectors: infinite sleep actions that are put on resources which failure should get noticed

◆ SuspendStates

Enumerator
not_suspended 

Action currently not suspended.

suspended 
sleeping 

Constructor & Destructor Documentation

◆ Action() [1/2]

simgrid::kernel::resource::Action::Action ( 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::kernel::resource::Action::Action ( Model model,
double  cost,
bool  failed,
lmm::Variable *  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()

virtual simgrid::kernel::resource::Action::~Action ( )
virtual

Member Function Documentation

◆ is_within_modified_set()

bool simgrid::kernel::resource::Action::is_within_modified_set ( ) const
inline

◆ finish()

void simgrid::kernel::resource::Action::finish ( Action::State  state)

Mark that the action is now finished.

Parameters
statethe new state of the current Action

◆ get_state()

Action::State simgrid::kernel::resource::Action::get_state ( ) const

Get the state of the current Action.

get the state

◆ set_state()

virtual void simgrid::kernel::resource::Action::set_state ( Action::State  state)
virtual

Set the state of the current Action.

◆ get_bound()

double simgrid::kernel::resource::Action::get_bound ( ) const

Get the bound of the current Action.

◆ set_bound()

void simgrid::kernel::resource::Action::set_bound ( double  bound)

Set the bound of the current Action.

◆ get_start_time()

double simgrid::kernel::resource::Action::get_start_time ( ) const
inline

Get the start time of the current action.

◆ get_finish_time()

double simgrid::kernel::resource::Action::get_finish_time ( ) const
inline

Get the finish time of the current action.

◆ get_data()

void* simgrid::kernel::resource::Action::get_data ( ) const
inline

Get the user data associated to the current action.

◆ set_data()

void simgrid::kernel::resource::Action::set_data ( void *  data)
inline

Set the user data associated to the current action.

◆ get_cost()

double simgrid::kernel::resource::Action::get_cost ( ) const
inline

Get the cost of the current action.

◆ set_cost()

void simgrid::kernel::resource::Action::set_cost ( double  cost)
inline

Set the cost of the current action.

◆ update_max_duration()

void simgrid::kernel::resource::Action::update_max_duration ( double  delta)

Update the maximum duration of the current action.

Parameters
deltaAmount to remove from the MaxDuration

◆ update_remains()

void simgrid::kernel::resource::Action::update_remains ( double  delta)

Update the remaining time of the current action.

Parameters
deltaAmount to remove from the remaining time

◆ update_remains_lazy()

virtual void simgrid::kernel::resource::Action::update_remains_lazy ( double  now)
pure virtual

◆ set_remains()

void simgrid::kernel::resource::Action::set_remains ( double  value)
inline

Set the remaining time of the current action.

◆ get_remains()

virtual double simgrid::kernel::resource::Action::get_remains ( )
virtual

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

◆ get_remains_no_update()

double simgrid::kernel::resource::Action::get_remains_no_update ( ) const
inline

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

◆ set_finish_time()

void simgrid::kernel::resource::Action::set_finish_time ( double  value)
inline

Set the finish time of the current action.

◆ ref()

void simgrid::kernel::resource::Action::ref ( )

Add a reference to the current action (refcounting)

◆ unref()

bool simgrid::kernel::resource::Action::unref ( )

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

◆ cancel()

virtual void simgrid::kernel::resource::Action::cancel ( )
virtual

Cancel the current Action if running.

◆ suspend()

virtual void simgrid::kernel::resource::Action::suspend ( )
virtual

Suspend the current Action.

◆ resume()

virtual void simgrid::kernel::resource::Action::resume ( )
virtual

Resume the current Action.

◆ is_suspended()

bool simgrid::kernel::resource::Action::is_suspended ( )

Returns true if the current action is running.

◆ get_max_duration()

double simgrid::kernel::resource::Action::get_max_duration ( ) const
inline

Get the maximum duration of the current action.

◆ set_max_duration()

virtual void simgrid::kernel::resource::Action::set_max_duration ( double  duration)
virtual

Set the maximum duration of the current Action.

◆ get_category()

std::string simgrid::kernel::resource::Action::get_category ( ) const
inline

Get the tracing category associated to the current action.

◆ set_category()

void simgrid::kernel::resource::Action::set_category ( std::string  category)
inline

Set the tracing category of the current Action.

◆ get_priority()

double simgrid::kernel::resource::Action::get_priority ( ) const
inline

Get the priority of the current Action.

◆ set_priority()

virtual void simgrid::kernel::resource::Action::set_priority ( double  priority)
virtual

Set the priority of the current Action.

◆ set_priority_no_update()

void simgrid::kernel::resource::Action::set_priority_no_update ( double  priority)
inline

◆ get_state_set()

StateSet* simgrid::kernel::resource::Action::get_state_set ( ) const
inline

Get the state set in which the action is.

◆ get_model()

simgrid::kernel::resource::Model* simgrid::kernel::resource::Action::get_model ( ) const
inline

◆ get_type()

ActionHeap::Type simgrid::kernel::resource::Action::get_type ( ) const
inline

◆ get_variable()

lmm::Variable* simgrid::kernel::resource::Action::get_variable ( ) const
inline

◆ set_variable()

void simgrid::kernel::resource::Action::set_variable ( lmm::Variable *  var)
inline

◆ get_last_update()

double simgrid::kernel::resource::Action::get_last_update ( ) const
inline

◆ set_last_update()

void simgrid::kernel::resource::Action::set_last_update ( )

◆ get_last_value()

double simgrid::kernel::resource::Action::get_last_value ( ) const
inline

◆ set_last_value()

void simgrid::kernel::resource::Action::set_last_value ( double  val)
inline

Member Data Documentation

◆ modified_set_hook_

boost::intrusive::list_member_hook simgrid::kernel::resource::Action::modified_set_hook_

◆ state_set_hook_

boost::intrusive::list_member_hook simgrid::kernel::resource::Action::state_set_hook_

◆ state_set_

StateSet* simgrid::kernel::resource::Action::state_set_
protected

◆ suspended_

Action::SuspendStates simgrid::kernel::resource::Action::suspended_ = Action::SuspendStates::not_suspended
protected

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