SimGrid  3.18
Versatile Simulation of Distributed Systems
simgrid::s4u::this_actor Namespace Reference

Detailed Description

Static methods working on the current actor (see s4u::Actor)

Functions

bool isMaestro ()
 Returns true if run from the kernel mode, and false if run from a real actor. More...
 
void sleep_for (double duration)
 Block the actor sleeping for that amount of seconds (may throws hostFailure) More...
 
void sleep_until (double timeout)
 
template<class Rep , class Period >
void sleep_for (std::chrono::duration< Rep, Period > duration)
 
template<class Duration >
void sleep_until (const SimulationTimePoint< Duration > &timeout_time)
 
 XBT_ATTRIB_DEPRECATED_v320 ("Use sleep_for(): v3.20 will turn this warning into an error.") inline void sleep(double duration)
 
void execute (double flop)
 Block the actor, computing the given amount of flops. More...
 
void execute (double flop, double priority)
 Block the actor, computing the given amount of flops at the given priority. More...
 
void parallel_execute (int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount)
 
void parallel_execute (int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double timeout)
 
ExecPtr exec_init (double flops_amounts)
 
ExecPtr exec_async (double flops_amounts)
 
 XBT_ATTRIB_DEPRECATED_v320 ("Use Mailbox::get(): v3.20 will turn this warning into an error.") extern void *recv(MailboxPtr chan)
 Block the actor until it gets a message from the given mailbox. More...
 
 XBT_ATTRIB_DEPRECATED_v320 ("Use Mailbox::recv_async(): v3.20 will turn this warning into an error.") extern CommPtr irecv(MailboxPtr chan
 
 XBT_ATTRIB_DEPRECATED_v320 ("Use Mailbox::put(): v3.20 will turn this warning into an error.") extern void send(MailboxPtr chan
 Block the actor until it delivers a message of the given simulated size to the given mailbox. More...
 
 XBT_ATTRIB_DEPRECATED_v320 ("Use Mailbox::put_async(): v3.20 will turn this warning into an error.") extern CommPtr isend(MailboxPtr chan
 
aid_t getPid ()
 Returns the actor ID of the current actor). More...
 
aid_t getPpid ()
 Returns the ancestor's actor ID of the current actor. More...
 
std::string getName ()
 Returns the name of the current actor. More...
 
const char * getCname ()
 Returns the name of the current actor as a C string. More...
 
HostgetHost ()
 Returns the name of the host on which the actor is running. More...
 
void suspend ()
 Suspend the actor. More...
 
void yield ()
 yield the actor. More...
 
void resume ()
 Resume the actor. More...
 
bool isSuspended ()
 
void kill ()
 kill the actor. More...
 
void onExit (int_f_pvoid_pvoid_t fun, void *data)
 Add a function to the list of "on_exit" functions. More...
 
void migrate (Host *new_host)
 Migrate the actor to a new host. More...
 
voidrecv (MailboxPtr chan)
 
voidrecv (MailboxPtr chan, double timeout)
 
void send (MailboxPtr chan, void *payload, double simulatedSize)
 
void send (MailboxPtr chan, void *payload, double simulatedSize, double timeout)
 
CommPtr isend (MailboxPtr chan, void *payload, double simulatedSize)
 
CommPtr irecv (MailboxPtr chan, void **data)
 

Variables

double timeout
 
void ** data
 
voidpayload
 
void double simulatedSize
 

Function Documentation

◆ isMaestro()

bool simgrid::s4u::this_actor::isMaestro ( )

Returns true if run from the kernel mode, and false if run from a real actor.

Everything that is run out of any actor (simulation setup before the engine is run, computing the model evolutions as a result to the actors' action, etc) is run in kernel mode, just as in any operating systems.

In SimGrid, the actor in charge of doing the stuff in kernel mode is called Maestro, because it is the one scheduling when the others should move or wait.

◆ sleep_for() [1/2]

◆ sleep_until() [1/2]

void simgrid::s4u::this_actor::sleep_until ( double  timeout)

◆ sleep_for() [2/2]

template<class Rep , class Period >
void simgrid::s4u::this_actor::sleep_for ( std::chrono::duration< Rep, Period >  duration)
inline

◆ sleep_until() [2/2]

template<class Duration >
void simgrid::s4u::this_actor::sleep_until ( const SimulationTimePoint< Duration > &  timeout_time)
inline

◆ XBT_ATTRIB_DEPRECATED_v320() [1/5]

simgrid::s4u::this_actor::XBT_ATTRIB_DEPRECATED_v320 ( "Use sleep_for(): v3.20 will turn this warning into an error."  )

◆ execute() [1/2]

◆ execute() [2/2]

void simgrid::s4u::this_actor::execute ( double  flop,
double  priority 
)

Block the actor, computing the given amount of flops at the given priority.

An execution of priority 2 computes twice as fast as an execution at priority 1.

◆ parallel_execute() [1/2]

void simgrid::s4u::this_actor::parallel_execute ( int  host_nb,
sg_host_t host_list,
double *  flops_amount,
double *  bytes_amount 
)

◆ parallel_execute() [2/2]

void simgrid::s4u::this_actor::parallel_execute ( int  host_nb,
sg_host_t host_list,
double *  flops_amount,
double *  bytes_amount,
double  timeout 
)

◆ exec_init()

ExecPtr simgrid::s4u::this_actor::exec_init ( double  flops_amounts)

◆ exec_async()

ExecPtr simgrid::s4u::this_actor::exec_async ( double  flops_amounts)

◆ XBT_ATTRIB_DEPRECATED_v320() [2/5]

simgrid::s4u::this_actor::XBT_ATTRIB_DEPRECATED_v320 ( "Use Mailbox::get(): v3.20 will turn this warning into an error."  )

Block the actor until it gets a message from the given mailbox.

See Comm for the full communication API (including non blocking communications).

◆ XBT_ATTRIB_DEPRECATED_v320() [3/5]

simgrid::s4u::this_actor::XBT_ATTRIB_DEPRECATED_v320 ( "Use Mailbox::recv_async(): v3.20 will turn this warning into an error."  )

◆ XBT_ATTRIB_DEPRECATED_v320() [4/5]

simgrid::s4u::this_actor::XBT_ATTRIB_DEPRECATED_v320 ( "Use Mailbox::put(): v3.20 will turn this warning into an error."  )

Block the actor until it delivers a message of the given simulated size to the given mailbox.

See Comm for the full communication API (including non blocking communications).

◆ XBT_ATTRIB_DEPRECATED_v320() [5/5]

simgrid::s4u::this_actor::XBT_ATTRIB_DEPRECATED_v320 ( "Use Mailbox::put_async(): v3.20 will turn this warning into an error."  )

◆ getPid()

aid_t simgrid::s4u::this_actor::getPid ( )

Returns the actor ID of the current actor).

◆ getPpid()

aid_t simgrid::s4u::this_actor::getPpid ( )

Returns the ancestor's actor ID of the current actor.

◆ getName()

◆ getCname()

◆ getHost()

◆ suspend()

◆ yield()

void simgrid::s4u::this_actor::yield ( )

yield the actor.

Examples:
examples/s4u/actor-yield/s4u-actor-yield.cpp.

◆ resume()

void simgrid::s4u::this_actor::resume ( )

Resume the actor.

◆ isSuspended()

bool simgrid::s4u::this_actor::isSuspended ( )

◆ kill()

void simgrid::s4u::this_actor::kill ( )

kill the actor.

Examples:
examples/s4u/actor-kill/s4u-actor-kill.cpp.

◆ onExit()

void simgrid::s4u::this_actor::onExit ( int_f_pvoid_pvoid_t  fun,
void data 
)

Add a function to the list of "on_exit" functions.

Examples:
examples/s4u/actor-kill/s4u-actor-kill.cpp, and examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp.

◆ migrate()

void simgrid::s4u::this_actor::migrate ( Host new_host)

Migrate the actor to a new host.

Examples:
examples/s4u/actor-migration/s4u-actor-migration.cpp.

◆ recv() [1/2]

void* simgrid::s4u::this_actor::recv ( MailboxPtr  chan)

◆ recv() [2/2]

void* simgrid::s4u::this_actor::recv ( MailboxPtr  chan,
double  timeout 
)

◆ send() [1/2]

void simgrid::s4u::this_actor::send ( MailboxPtr  chan,
void payload,
double  simulatedSize 
)

◆ send() [2/2]

void simgrid::s4u::this_actor::send ( MailboxPtr  chan,
void payload,
double  simulatedSize,
double  timeout 
)

◆ isend()

CommPtr simgrid::s4u::this_actor::isend ( MailboxPtr  chan,
void payload,
double  simulatedSize 
)

◆ irecv()

CommPtr simgrid::s4u::this_actor::irecv ( MailboxPtr  chan,
void **  data 
)

Variable Documentation

◆ timeout

void double double simgrid::s4u::this_actor::timeout

◆ data

void** simgrid::s4u::this_actor::data

◆ payload

◆ simulatedSize

void double simgrid::s4u::this_actor::simulatedSize