SimGrid  3.16
Versatile Simulation of Distributed Systems
smx_global.cpp File Reference
#include <functional>
#include <memory>
#include <signal.h>
#include <stdlib.h>
#include "src/internal_config.h"
#include <xbt/functional.hpp>
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/xml/platf.hpp"
#include "smx_private.h"
#include "xbt/ex.h"
#include "mc/mc.h"
#include "simgrid/sg_config.h"
#include "src/mc/mc_replay.h"
#include "src/surf/StorageImpl.hpp"
#include "src/smpi/smpi_process.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/SynchroIo.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
#include "src/mc/mc_record.h"

Classes

struct  s_smx_timer
 Timer datatype. More...
 

Namespaces

 simgrid
 Alltoall Bruck.
 
 simgrid::simix
 

Typedefs

typedef struct s_smx_timer s_smx_timer_t
 Timer datatype. More...
 

Functions

 XBT_LOG_NEW_CATEGORY (simix, "All SIMIX categories")
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (simix_kernel, simix, "Logging specific to SIMIX (kernel)")
 
static void inthandler (int ignored)
 
static void segvhandler (int signum, siginfo_t *siginfo, void *context)
 
static void install_segvhandler ()
 Install signal handler for SIGSEGV. More...
 
double SIMIX_timer_next ()
 
static void kill_process (smx_actor_t process)
 
void simgrid::simix::set_maestro (std::function< void()> code)
 
void SIMIX_set_maestro (void(*code)(void *), void *data)
 
void SIMIX_global_init (int *argc, char **argv)
 Initialize SIMIX internal data. More...
 
void SIMIX_clean ()
 Clean the SIMIX simulation. More...
 
double SIMIX_get_clock ()
 A clock (in second). More...
 
static int process_syscall_color (void *p)
 
static void SIMIX_wake_processes ()
 Wake up all processes waiting for a Surf action to finish. More...
 
static bool SIMIX_execute_timers ()
 Handle any pending timer. More...
 
static bool SIMIX_execute_tasks ()
 Execute all the tasks that are queued. More...
 
void SIMIX_run ()
 Run the main simulation loop. More...
 
smx_timer_t SIMIX_timer_set (double date, void(*callback)(void *), void *arg)
 Set the date to execute a function. More...
 
smx_timer_t SIMIX_timer_set (double date, simgrid::xbt::Task< void()> callback)
 
void SIMIX_timer_remove (smx_timer_t timer)
 cancels a timer that was added earlier More...
 
double SIMIX_timer_get_date (smx_timer_t timer)
 Returns the date at which the timer will trigger (or 0 if nullptr timer) More...
 
void SIMIX_function_register_process_create (smx_creation_func_t function)
 Registers a function to create a process. More...
 
void SIMIX_function_register_process_kill (void_pfn_smxprocess_t function)
 Registers a function to kill a process. More...
 
void SIMIX_function_register_process_cleanup (void_pfn_smxprocess_t function)
 Registers a function to cleanup a process. More...
 
void SIMIX_display_process_status ()
 
int SIMIX_is_maestro ()
 

Variables

std::unique_ptr< simgrid::simix::Globalsimix_global
 
static xbt_heap_t simix_timers = nullptr
 
void(* SMPI_switch_data_segment )(int) = nullptr
 
int _sg_do_verbose_exit = 1
 
char sigsegv_stack [SIGSTKSZ]
 
static std::function< void()> maestro_code
 
int smx_cleaned = 0
 

Typedef Documentation

◆ s_smx_timer_t

typedef struct s_smx_timer s_smx_timer_t

Timer datatype.

Function Documentation

◆ XBT_LOG_NEW_CATEGORY()

XBT_LOG_NEW_CATEGORY ( simix  ,
"All SIMIX categories"   
)

◆ XBT_LOG_NEW_DEFAULT_SUBCATEGORY()

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( simix_kernel  ,
simix  ,
"Logging specific to SIMIX (kernel)"   
)

◆ inthandler()

static void inthandler ( int  ignored)
static

◆ segvhandler()

static void segvhandler ( int  signum,
siginfo_t *  siginfo,
void context 
)
static

◆ install_segvhandler()

static void install_segvhandler ( )
static

Install signal handler for SIGSEGV.

Check that nobody has already installed its own handler. For example, the Java VM does this.

◆ SIMIX_timer_next()

double SIMIX_timer_next ( )

◆ kill_process()

static void kill_process ( smx_actor_t  process)
static

◆ SIMIX_set_maestro()

void SIMIX_set_maestro ( void(*)(void *)  code,
void data 
)

◆ process_syscall_color()

static int process_syscall_color ( void p)
static

◆ SIMIX_wake_processes()

static void SIMIX_wake_processes ( )
static

Wake up all processes waiting for a Surf action to finish.

◆ SIMIX_execute_timers()

static bool SIMIX_execute_timers ( )
static

Handle any pending timer.

◆ SIMIX_execute_tasks()

static bool SIMIX_execute_tasks ( )
static

Execute all the tasks that are queued.

e.g. .then() callbacks of futures.

◆ SIMIX_timer_set() [1/2]

smx_timer_t SIMIX_timer_set ( double  date,
void(*)(void *)  callback,
void arg 
)

Set the date to execute a function.

Set the date to execute the function on the surf.

Parameters
dateDate to execute function
callbackFunction to be executed
argParameters of the function

◆ SIMIX_timer_set() [2/2]

smx_timer_t SIMIX_timer_set ( double  date,
simgrid::xbt::Task< void()>  callback 
)

◆ SIMIX_timer_remove()

void SIMIX_timer_remove ( smx_timer_t  timer)

cancels a timer that was added earlier

◆ SIMIX_timer_get_date()

double SIMIX_timer_get_date ( smx_timer_t  timer)

Returns the date at which the timer will trigger (or 0 if nullptr timer)

◆ SIMIX_function_register_process_create()

void SIMIX_function_register_process_create ( smx_creation_func_t  function)

Registers a function to create a process.

This function registers a function to be called when a new process is created. The function has to call SIMIX_process_create().

Parameters
functioncreate process function

◆ SIMIX_function_register_process_kill()

void SIMIX_function_register_process_kill ( void_pfn_smxprocess_t  function)

Registers a function to kill a process.

This function registers a function to be called when a process is killed. The function has to call the SIMIX_process_kill().

Parameters
functionKill process function

◆ SIMIX_function_register_process_cleanup()

void SIMIX_function_register_process_cleanup ( void_pfn_smxprocess_t  function)

Registers a function to cleanup a process.

This function registers a user function to be called when a process ends properly.

Parameters
functioncleanup process function

◆ SIMIX_display_process_status()

void SIMIX_display_process_status ( )

◆ SIMIX_is_maestro()

int SIMIX_is_maestro ( )

Variable Documentation

◆ simix_global

std::unique_ptr<simgrid::simix::Global> simix_global

◆ simix_timers

xbt_heap_t simix_timers = nullptr
static

◆ SMPI_switch_data_segment

void(* SMPI_switch_data_segment) (int) = nullptr

◆ _sg_do_verbose_exit

int _sg_do_verbose_exit = 1

◆ sigsegv_stack

char sigsegv_stack[SIGSTKSZ]

◆ maestro_code

std::function<void()> maestro_code
static

◆ smx_cleaned

int smx_cleaned = 0