SimGrid
3.18
Versatile Simulation of Distributed Systems
|
#include <cerrno>
#include <cstring>
#include <utility>
#include <string>
#include <xbt/config.hpp>
#include <xbt/log.h>
#include <xbt/range.hpp>
#include <xbt/sysdep.h>
#include "simgrid/modelchecker.h"
#include "simgrid/sg_config.h"
#include "smx_private.hpp"
#include "src/internal_config.h"
#include "xbt/xbt_os_thread.h"
#include <sys/mman.h>
Functions | |
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (simix_context, simix, "Context switching mechanism") | |
static std::string | contexts_list () |
void | SIMIX_context_mod_init () |
This function is called by SIMIX_global_init() to initialize the context module. More... | |
void | SIMIX_context_mod_exit () |
This function is called by SIMIX_clean() to finalize the context module. More... | |
void * | SIMIX_context_stack_new () |
void | SIMIX_context_stack_delete (void *stack) |
int | SIMIX_context_is_parallel () |
Returns whether some parallel threads are used for the user contexts. More... | |
int | SIMIX_context_get_nthreads () |
Returns the number of parallel threads used for the user contexts. More... | |
void | SIMIX_context_set_nthreads (int nb_threads) |
Sets the number of parallel threads to use for the user contexts. More... | |
int | SIMIX_context_get_parallel_threshold () |
Returns the threshold above which user processes are run in parallel. More... | |
void | SIMIX_context_set_parallel_threshold (int threshold) |
Sets the threshold above which user processes are run in parallel. More... | |
e_xbt_parmap_mode_t | SIMIX_context_get_parallel_mode () |
Returns the synchronization mode used when processes are run in parallel. More... | |
void | SIMIX_context_set_parallel_mode (e_xbt_parmap_mode_t mode) |
Sets the synchronization mode to use when processes are run in parallel. More... | |
smx_context_t | SIMIX_context_get_current () |
Returns the current context of this thread. More... | |
void | SIMIX_context_set_current (smx_context_t context) |
Sets the current context of this thread. More... | |
Variables | |
static std::pair< const char *, simgrid::kernel::context::ContextFactoryInitializer > | context_factories [] |
static simgrid::config::Flag< std::string > | context_factory_name ("contexts/factory",(std::string("Possible values: ")+contexts_list()).c_str(), context_factories[0].first) |
unsigned | smx_context_stack_size |
int | smx_context_stack_size_was_set = 0 |
unsigned | smx_context_guard_size |
int | smx_context_guard_size_was_set = 0 |
static xbt_os_thread_key_t | smx_current_context_key = 0 |
static smx_context_t | smx_current_context_serial |
static int | smx_parallel_contexts = 1 |
static int | smx_parallel_threshold = 2 |
static e_xbt_parmap_mode_t | smx_parallel_synchronization_mode = XBT_PARMAP_DEFAULT |
XBT_LOG_NEW_DEFAULT_SUBCATEGORY | ( | simix_context | , |
simix | , | ||
"Context switching mechanism" | |||
) |
|
inlinestatic |
void SIMIX_context_mod_init | ( | ) |
This function is called by SIMIX_global_init() to initialize the context module.
void SIMIX_context_mod_exit | ( | ) |
This function is called by SIMIX_clean() to finalize the context module.
void* SIMIX_context_stack_new | ( | ) |
int SIMIX_context_is_parallel | ( | ) |
Returns whether some parallel threads are used for the user contexts.
int SIMIX_context_get_nthreads | ( | ) |
Returns the number of parallel threads used for the user contexts.
void SIMIX_context_set_nthreads | ( | int | nb_threads | ) |
Sets the number of parallel threads to use for the user contexts.
This function should be called before initializing SIMIX. A value of 1 means no parallelism (1 thread only). If the value is greater than 1, the thread support must be enabled.
nb_threads | the number of threads to use |
int SIMIX_context_get_parallel_threshold | ( | ) |
Returns the threshold above which user processes are run in parallel.
If the number of threads is set to 1, there is no parallelism and this threshold has no effect.
void SIMIX_context_set_parallel_threshold | ( | int | threshold | ) |
Sets the threshold above which user processes are run in parallel.
If the number of threads is set to 1, there is no parallelism and this threshold has no effect.
threshold | when the number of user processes ready to run is above this threshold, they are run in parallel |
e_xbt_parmap_mode_t SIMIX_context_get_parallel_mode | ( | ) |
Returns the synchronization mode used when processes are run in parallel.
void SIMIX_context_set_parallel_mode | ( | e_xbt_parmap_mode_t | mode | ) |
Sets the synchronization mode to use when processes are run in parallel.
mode | how to synchronize threads if processes are run in parallel |
smx_context_t SIMIX_context_get_current | ( | ) |
Returns the current context of this thread.
void SIMIX_context_set_current | ( | smx_context_t | context | ) |
Sets the current context of this thread.
context | the context to set |
|
static |
|
static |
unsigned smx_context_stack_size |
int smx_context_stack_size_was_set = 0 |
unsigned smx_context_guard_size |
int smx_context_guard_size_was_set = 0 |
|
static |
|
static |
|
static |
|
static |
|
static |