I used the following command: (the '**' means recursion in ZSH)
sed -i -e 's/\([^_]\s*\)NULL/\1nullptr/g' src/**/*.cpp
We check for the underscore to avoid replacing MPI_*_NULL
void TRACE_msg_set_task_category(msg_task_t task, const char *category)
{
void TRACE_msg_set_task_category(msg_task_t task, const char *category)
{
- xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).",
+ xbt_assert(task->category == nullptr, "Task %p(%s) already has a category (%s).",
task, task->name, task->category);
task, task->name, task->category);
- //if user provides a NULL category, task is no longer traced
- if (category == NULL) {
+ //if user provides a nullptr category, task is no longer traced
+ if (category == nullptr) {
xbt_free (task->category);
xbt_free (task->category);
+ task->category = nullptr;
XBT_DEBUG("MSG task %p(%s), category removed", task, task->name);
return;
}
XBT_DEBUG("MSG task %p(%s), category removed", task, task->name);
return;
}
{
static long long counter = 0;
task->counter = counter++;
{
static long long counter = 0;
task->counter = counter++;
+ task->category = nullptr;
if(MC_is_active())
MC_ignore_heap(&(task->counter), sizeof(task->counter));
if(MC_is_active())
MC_ignore_heap(&(task->counter), sizeof(task->counter));
//free category
xbt_free(task->category);
//free category
xbt_free(task->category);
+ task->category = nullptr;
/** \ingroup msg_trace_driven
* \brief A trace loader
*
/** \ingroup msg_trace_driven
* \brief A trace loader
*
- * If path!=NULL, load a trace file containing actions, and execute them.
+ * If path!=nullptr, load a trace file containing actions, and execute them.
* Else, assume that each process gets the path in its deployment file
*/
msg_error_t MSG_action_trace_run(char *path)
* Else, assume that each process gets the path in its deployment file
*/
msg_error_t MSG_action_trace_run(char *path)
xbt_dynar_t todo;
xbt_dict_cursor_t cursor;
xbt_dynar_t todo;
xbt_dict_cursor_t cursor;
if (path) {
xbt_action_fp = fopen(path, "r");
if (path) {
xbt_action_fp = fopen(path, "r");
- xbt_assert(xbt_action_fp != NULL, "Cannot open %s: %s", path, strerror(errno));
+ xbt_assert(xbt_action_fp != nullptr, "Cannot open %s: %s", path, strerror(errno));
if (path)
fclose(xbt_action_fp);
xbt_dict_free(&xbt_action_queues);
if (path)
fclose(xbt_action_fp);
xbt_dict_free(&xbt_action_queues);
- xbt_action_queues = xbt_dict_new_homogeneous(NULL);
+ xbt_action_queues = xbt_dict_new_homogeneous(nullptr);
const char *MSG_environment_as_get_property_value(msg_as_t as, const char *name)
{
xbt_dict_t dict = (xbt_dict_t) xbt_lib_get_or_null(as_router_lib, MSG_environment_as_get_name(as), ROUTING_PROP_ASR_LEVEL);
const char *MSG_environment_as_get_property_value(msg_as_t as, const char *name)
{
xbt_dict_t dict = (xbt_dict_t) xbt_lib_get_or_null(as_router_lib, MSG_environment_as_get_name(as), ROUTING_PROP_ASR_LEVEL);
- if (dict==NULL)
- return NULL;
+ if (dict==nullptr)
+ return nullptr;
return (char*) xbt_dict_get_or_null(dict, name);
}
return (char*) xbt_dict_get_or_null(dict, name);
}
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
-MSG_Global_t msg_global = NULL;
+MSG_Global_t msg_global = nullptr;
static void MSG_exit(void);
/********************************* MSG **************************************/
static void MSG_exit(void);
/********************************* MSG **************************************/
SIMIX_global_init(argc, argv);
msg_global->sent_msg = 0;
SIMIX_global_init(argc, argv);
msg_global->sent_msg = 0;
- msg_global->task_copy_callback = NULL;
- msg_global->process_data_cleanup = NULL;
+ msg_global->task_copy_callback = nullptr;
+ msg_global->process_data_cleanup = nullptr;
SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
}
static void MSG_exit(void) {
}
static void MSG_exit(void) {
+ if (msg_global==nullptr)
return;
TRACE_surf_resource_utilization_release();
TRACE_end();
free(msg_global);
return;
TRACE_surf_resource_utilization_release();
TRACE_end();
free(msg_global);
}
/** \ingroup msg_simulation
}
/** \ingroup msg_simulation
TRACE_msg_task_execute_start(task);
xbt_assert((!simdata->compute) && (task->simdata->isused == 0),
TRACE_msg_task_execute_start(task);
xbt_assert((!simdata->compute) && (task->simdata->isused == 0),
- "This task is executed somewhere else. Go fix your code! %d", task->simdata->isused!=NULL);
+ "This task is executed somewhere else. Go fix your code! %d", task->simdata->isused!=nullptr);
XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self()));
XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self()));
p_simdata->waiting_action = simdata->compute;
comp_state = simcall_execution_wait(simdata->compute);
p_simdata->waiting_action = simdata->compute;
comp_state = simcall_execution_wait(simdata->compute);
- p_simdata->waiting_action = NULL;
+ p_simdata->waiting_action = nullptr;
if (msg_global->debug_multiple_use && simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)simdata->isused);
if (msg_global->debug_multiple_use && simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)simdata->isused);
- /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ /* action ended, set comm and compute = nullptr, the actions is already destroyed in the main function */
simdata->flops_amount = 0.0;
simdata->flops_amount = 0.0;
- simdata->comm = NULL;
- simdata->compute = NULL;
+ simdata->comm = nullptr;
+ simdata->compute = nullptr;
TRACE_msg_task_execute_end(task);
MSG_RETURN(status);
TRACE_msg_task_execute_end(task);
MSG_RETURN(status);
*/
msg_error_t MSG_task_receive_with_timeout(msg_task_t * task, const char *alias, double timeout)
{
*/
msg_error_t MSG_task_receive_with_timeout(msg_task_t * task, const char *alias, double timeout)
{
- return MSG_task_receive_ext(task, alias, timeout, NULL);
+ return MSG_task_receive_ext(task, alias, timeout, nullptr);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
*/
msg_error_t MSG_task_receive_with_timeout_bounded(msg_task_t * task, const char *alias, double timeout,double rate)
{
*/
msg_error_t MSG_task_receive_with_timeout_bounded(msg_task_t * task, const char *alias, double timeout,double rate)
{
- return MSG_task_receive_ext_bounded(task, alias, timeout, NULL, rate);
+ return MSG_task_receive_ext_bounded(task, alias, timeout, nullptr, rate);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
int (*match_fun)(void*,void*, smx_synchro_t),
void *match_data, void_f_pvoid_t cleanup, int detached)
{
int (*match_fun)(void*,void*, smx_synchro_t),
void *match_data, void_f_pvoid_t cleanup, int detached)
{
- simdata_task_t t_simdata = NULL;
+ simdata_task_t t_simdata = nullptr;
msg_process_t process = MSG_process_self();
msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
int call_end = TRACE_msg_task_put_start(task);
msg_process_t process = MSG_process_self();
msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
int call_end = TRACE_msg_task_put_start(task);
MSG_BT(t_simdata->isused, "Using Backtrace");
else
t_simdata->isused = (void*)1;
MSG_BT(t_simdata->isused, "Using Backtrace");
else
t_simdata->isused = (void*)1;
- t_simdata->comm = NULL;
+ t_simdata->comm = nullptr;
msg_global->sent_msg++;
/* Send it by calling SIMIX network layer */
smx_synchro_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->bytes_amount, t_simdata->rate,
msg_global->sent_msg++;
/* Send it by calling SIMIX network layer */
smx_synchro_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->bytes_amount, t_simdata->rate,
- task, sizeof(void *), match_fun, cleanup, NULL, match_data,detached);
+ task, sizeof(void *), match_fun, cleanup, nullptr, match_data,detached);
t_simdata->comm = static_cast<simgrid::simix::Comm*>(act); /* FIXME: is the field t_simdata->comm still useful? */
msg_comm_t comm;
if (detached) {
t_simdata->comm = static_cast<simgrid::simix::Comm*>(act); /* FIXME: is the field t_simdata->comm still useful? */
msg_comm_t comm;
if (detached) {
} else {
comm = xbt_new0(s_msg_comm_t, 1);
comm->task_sent = task;
} else {
comm = xbt_new0(s_msg_comm_t, 1);
comm->task_sent = task;
- comm->task_received = NULL;
+ comm->task_received = nullptr;
comm->status = MSG_OK;
comm->s_comm = act;
}
comm->status = MSG_OK;
comm->s_comm = act;
}
*/
msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
{
*/
msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
{
- return MSG_task_isend_internal(task, alias, NULL, NULL, NULL, 0);
+ return MSG_task_isend_internal(task, alias, nullptr, nullptr, nullptr, 0);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate)
{
task->simdata->rate = maxrate;
msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate)
{
task->simdata->rate = maxrate;
- return MSG_task_isend_internal(task, alias, NULL, NULL, NULL, 0);
+ return MSG_task_isend_internal(task, alias, nullptr, nullptr, nullptr, 0);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias,
int (*match_fun)(void*, void*, smx_synchro_t), void *match_data)
{
msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias,
int (*match_fun)(void*, void*, smx_synchro_t), void *match_data)
{
- return MSG_task_isend_internal(task, alias, match_fun, match_data, NULL, 0);
+ return MSG_task_isend_internal(task, alias, match_fun, match_data, nullptr, 0);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
* \param task a #msg_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
* \param cleanup a function to destroy the task if the communication fails, e.g. MSG_task_destroy
* \param task a #msg_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
* \param cleanup a function to destroy the task if the communication fails, e.g. MSG_task_destroy
- * (if NULL, no function will be called)
+ * (if nullptr, no function will be called)
*/
void MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup)
{
*/
void MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup)
{
- MSG_task_isend_internal(task, alias, NULL, NULL, cleanup, 1);
+ MSG_task_isend_internal(task, alias, nullptr, nullptr, cleanup, 1);
}
/** \ingroup msg_task_usage
}
/** \ingroup msg_task_usage
* \param alias name of the mailbox to sent the task to
* \param cleanup a function to destroy the task if the
* communication fails, e.g. MSG_task_destroy
* \param alias name of the mailbox to sent the task to
* \param cleanup a function to destroy the task if the
* communication fails, e.g. MSG_task_destroy
- * (if NULL, no function will be called)
+ * (if nullptr, no function will be called)
* \param maxrate the maximum communication rate for sending this task
*
*/
* \param maxrate the maximum communication rate for sending this task
*
*/
/* Try to receive it by calling SIMIX network layer */
msg_comm_t comm = xbt_new0(s_msg_comm_t, 1);
/* Try to receive it by calling SIMIX network layer */
msg_comm_t comm = xbt_new0(s_msg_comm_t, 1);
- comm->task_sent = NULL;
+ comm->task_sent = nullptr;
comm->task_received = task;
comm->status = MSG_OK;
comm->task_received = task;
comm->status = MSG_OK;
- comm->s_comm = simcall_comm_irecv(MSG_process_self(), rdv, task, NULL, NULL, NULL, NULL, rate);
+ comm->s_comm = simcall_comm_irecv(MSG_process_self(), rdv, task, nullptr, nullptr, nullptr, nullptr, rate);
TRY {
finished = simcall_comm_test(comm->s_comm);
TRY {
finished = simcall_comm_test(comm->s_comm);
- if (finished && comm->task_received != NULL) {
+ if (finished && comm->task_received != nullptr) {
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
int finished_index = -1;
/* create the equivalent dynar with SIMIX objects */
int finished_index = -1;
/* create the equivalent dynar with SIMIX objects */
- xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL);
+ xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), nullptr);
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach(comms, cursor, comm) {
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach(comms, cursor, comm) {
/* the communication is finished */
comm->status = status;
/* the communication is finished */
comm->status = status;
- if (status == MSG_OK && comm->task_received != NULL) {
+ if (status == MSG_OK && comm->task_received != nullptr) {
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
TRY {
simcall_comm_wait(comm->s_comm, timeout);
TRY {
simcall_comm_wait(comm->s_comm, timeout);
- if (comm->task_received != NULL) {
+ if (comm->task_received != nullptr) {
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
int finished_index = -1;
/* create the equivalent dynar with SIMIX objects */
int finished_index = -1;
/* create the equivalent dynar with SIMIX objects */
- xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL);
+ xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), nullptr);
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach(comms, cursor, comm) {
msg_comm_t comm;
unsigned int cursor;
xbt_dynar_foreach(comms, cursor, comm) {
/* the communication is finished */
comm->status = status;
/* the communication is finished */
comm->status = status;
- if (comm->task_received != NULL) {
+ if (comm->task_received != nullptr) {
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
/* I am the receiver */
if (msg_global->debug_multiple_use && (*comm->task_received)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*comm->task_received)->simdata->isused);
msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout)
{
msg_error_t ret = MSG_OK;
msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout)
{
msg_error_t ret = MSG_OK;
- simdata_task_t t_simdata = NULL;
+ simdata_task_t t_simdata = nullptr;
msg_process_t process = MSG_process_self();
simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data();
msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
msg_process_t process = MSG_process_self();
simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data();
msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
MSG_BT(t_simdata->isused, "Using Backtrace");
else
t_simdata->isused = (void*)1;
MSG_BT(t_simdata->isused, "Using Backtrace");
else
t_simdata->isused = (void*)1;
- t_simdata->comm = NULL;
+ t_simdata->comm = nullptr;
msg_global->sent_msg++;
p_simdata->waiting_task = task;
msg_global->sent_msg++;
p_simdata->waiting_task = task;
xbt_ex_t e;
/* Try to send it by calling SIMIX network layer */
TRY {
xbt_ex_t e;
/* Try to send it by calling SIMIX network layer */
TRY {
- smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simix call */
+ smx_synchro_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simix call */
comm = simcall_comm_isend(SIMIX_process_self(), mailbox,t_simdata->bytes_amount,
comm = simcall_comm_isend(SIMIX_process_self(), mailbox,t_simdata->bytes_amount,
- t_simdata->rate, task, sizeof(void *), NULL, NULL, NULL, task, 0);
+ t_simdata->rate, task, sizeof(void *), nullptr, nullptr, nullptr, task, 0);
if (TRACE_is_enabled())
simcall_set_category(comm, task->category);
t_simdata->comm = static_cast<simgrid::simix::Comm*>(comm);
if (TRACE_is_enabled())
simcall_set_category(comm, task->category);
t_simdata->comm = static_cast<simgrid::simix::Comm*>(comm);
- p_simdata->waiting_task = NULL;
+ p_simdata->waiting_task = nullptr;
if (call_end)
TRACE_msg_task_put_end();
MSG_RETURN(ret);
if (call_end)
TRACE_msg_task_put_end();
MSG_RETURN(ret);
- if (NULL == (task = MSG_mailbox_front(MSG_mailbox_get_by_alias(alias))))
+ if (nullptr == (task = MSG_mailbox_front(MSG_mailbox_get_by_alias(alias))))
return -1;
return MSG_process_get_PID(task->simdata->sender);
return -1;
return MSG_process_get_PID(task->simdata->sender);
*
* \see MSG_task_set_category
*
*
* \see MSG_task_set_category
*
- * \return Returns the name of the tracing category of the given task, NULL otherwise
+ * \return Returns the name of the tracing category of the given task, nullptr otherwise
*/
const char *MSG_task_get_category (msg_task_t task)
{
*/
const char *MSG_task_get_category (msg_task_t task)
{
*
* \param asr the name of a router or AS
* \param name a property name
*
* \param asr the name of a router or AS
* \param name a property name
- * \return value of a property (or NULL if property not set)
+ * \return value of a property (or nullptr if property not set)
*/
const char *MSG_as_router_get_property_value(const char* asr, const char *name)
{
*/
const char *MSG_as_router_get_property_value(const char* asr, const char *name)
{
priv->dp_updated_by_deleted_tasks = 0;
priv->is_migrating = 0;
priv->dp_updated_by_deleted_tasks = 0;
priv->is_migrating = 0;
- priv->affinity_mask_db = xbt_dict_new_homogeneous(NULL);
+ priv->affinity_mask_db = xbt_dict_new_homogeneous(nullptr);
- priv->file_descriptor_table = xbt_dynar_new(sizeof(int), NULL);
+ priv->file_descriptor_table = xbt_dynar_new(sizeof(int), nullptr);
for (int i=1023; i>=0;i--)
xbt_dynar_push_as(priv->file_descriptor_table, int, i);
for (int i=1023; i>=0;i--)
xbt_dynar_push_as(priv->file_descriptor_table, int, i);
*/
msg_host_t MSG_host_self(void)
{
*/
msg_host_t MSG_host_self(void)
{
- return MSG_process_get_host(NULL);
+ return MSG_process_get_host(nullptr);
}
/** \ingroup m_host_management
}
/** \ingroup m_host_management
*/
void __MSG_host_priv_free(msg_host_priv_t priv)
{
*/
void __MSG_host_priv_free(msg_host_priv_t priv)
{
return;
unsigned int size = xbt_dict_size(priv->dp_objs);
if (size > 0)
return;
unsigned int size = xbt_dict_size(priv->dp_objs);
if (size > 0)
*/
xbt_swag_t MSG_host_get_process_list(msg_host_t host)
{
*/
xbt_swag_t MSG_host_get_process_list(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
+ xbt_assert((host != nullptr), "Invalid parameters");
return host->processes();
}
return host->processes();
}
*
* \param host a host
* \param name a property name
*
* \param host a host
* \param name a property name
- * \return value of a property (or NULL if property not set)
+ * \return value of a property (or nullptr if property not set)
*/
const char *MSG_host_get_property_value(msg_host_t host, const char *name)
{
*/
const char *MSG_host_get_property_value(msg_host_t host, const char *name)
{
*/
xbt_dict_t MSG_host_get_properties(msg_host_t host)
{
*/
xbt_dict_t MSG_host_get_properties(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
+ xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
return host->properties();
}
return host->properties();
}
* \return Returns the processor speed associated with pstate_index
*/
double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
* \return Returns the processor speed associated with pstate_index
*/
double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
- xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
+ xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
return host->powerPeakAt(pstate_index);
}
return host->powerPeakAt(pstate_index);
}
* \return Returns the current processor speed
*/
double MSG_host_get_current_power_peak(msg_host_t host) {
* \return Returns the current processor speed
*/
double MSG_host_get_current_power_peak(msg_host_t host) {
- xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
+ xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
return host->currentPowerPeak();
}
return host->currentPowerPeak();
}
*/
xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host)
{
*/
xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
+ xbt_assert((host != nullptr), "Invalid parameters");
return host->mountedStoragesAsDict();
}
return host->mountedStoragesAsDict();
}
*/
xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host)
{
*/
xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
+ xbt_assert((host != nullptr), "Invalid parameters");
return host->attachedStorages();
}
return host->attachedStorages();
}
*/
xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
{
*/
xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
- xbt_dict_t contents = xbt_dict_new_homogeneous(NULL);
+ xbt_assert((host != nullptr), "Invalid parameters");
+ xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
msg_storage_t storage;
char* storage_name;
char* mount_name;
msg_storage_t storage;
char* storage_name;
char* mount_name;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
xbt_dict_t storage_list = host->mountedStoragesAsDict();
xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
storage = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib,storage_name);
xbt_dict_t content = simcall_storage_get_content(storage);
xbt_dict_t storage_list = host->mountedStoragesAsDict();
xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
storage = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib,storage_name);
xbt_dict_t content = simcall_storage_get_content(storage);
- xbt_dict_set(contents,mount_name, content,NULL);
+ xbt_dict_set(contents,mount_name, content,nullptr);
}
xbt_dict_free(&storage_list);
return contents;
}
xbt_dict_free(&storage_list);
return contents;
if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, read_size);
if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, read_size);
- msg_host_t *m_host_list = NULL;
+ msg_host_t *m_host_list = nullptr;
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = MSG_host_self();
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = MSG_host_self();
double bytes_amount[] = { 0, 0, (double)read_size, 0 };
msg_task_t task = MSG_parallel_task_create("file transfer for read", 2, m_host_list, flops_amount, bytes_amount,
double bytes_amount[] = { 0, 0, (double)read_size, 0 };
msg_task_t task = MSG_parallel_task_create("file transfer for read", 2, m_host_list, flops_amount, bytes_amount,
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, size);
if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", storage_priv_src->hostname, size);
- msg_host_t *m_host_list = NULL;
+ msg_host_t *m_host_list = nullptr;
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = MSG_host_self();
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = MSG_host_self();
double bytes_amount[] = { 0, (double)size, 0, 0 };
msg_task_t task = MSG_parallel_task_create("file transfer for write", 2, m_host_list, flops_amount, bytes_amount,
double bytes_amount[] = { 0, (double)size, 0, 0 };
msg_task_t task = MSG_parallel_task_create("file transfer for write", 2, m_host_list, flops_amount, bytes_amount,
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
}
const char *MSG_file_get_name(msg_file_t fd) {
}
const char *MSG_file_get_name(msg_file_t fd) {
- xbt_assert((fd != NULL), "Invalid parameters");
+ xbt_assert((fd != nullptr), "Invalid parameters");
msg_file_priv_t priv = MSG_file_priv(fd);
return priv->fullpath;
}
msg_file_priv_t priv = MSG_file_priv(fd);
return priv->fullpath;
}
read_size = simcall_file_read(file_priv->simdata->smx_file, file_priv->size, attached_host);
/* Find the real host destination where the file will be physically stored */
read_size = simcall_file_read(file_priv->simdata->smx_file, file_priv->size, attached_host);
/* Find the real host destination where the file will be physically stored */
- xbt_dict_cursor_t cursor = NULL;
- msg_storage_t storage_dest = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
+ msg_storage_t storage_dest = nullptr;
msg_host_t host_dest;
size_t longest_prefix_length = 0;
msg_host_t host_dest;
size_t longest_prefix_length = 0;
XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, storage_priv_src->hostname,
host_name_dest);
XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, storage_priv_src->hostname,
host_name_dest);
- msg_host_t *m_host_list = NULL;
+ msg_host_t *m_host_list = nullptr;
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = attached_host;
m_host_list = (msg_host_t*) calloc(2, sizeof(msg_host_t));
m_host_list[0] = attached_host;
double bytes_amount[] = { 0, (double)read_size, 0, 0 };
msg_task_t task =
double bytes_amount[] = { 0, (double)read_size, 0, 0 };
msg_task_t task =
- MSG_parallel_task_create("file transfer for write", 2, m_host_list, flops_amount, bytes_amount, NULL);
+ MSG_parallel_task_create("file transfer for write", 2, m_host_list, flops_amount, bytes_amount, nullptr);
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
msg_error_t transfer = MSG_parallel_task_execute(task);
MSG_task_destroy(task);
free(m_host_list);
* This functions checks whether a storage is a valid pointer or not and return its name.
*/
const char *MSG_storage_get_name(msg_storage_t storage) {
* This functions checks whether a storage is a valid pointer or not and return its name.
*/
const char *MSG_storage_get_name(msg_storage_t storage) {
- xbt_assert((storage != NULL), "Invalid parameters");
+ xbt_assert((storage != nullptr), "Invalid parameters");
return SIMIX_storage_get_name(storage);
}
return SIMIX_storage_get_name(storage);
}
*/
xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
{
*/
xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
{
- xbt_assert((storage != NULL), "Invalid parameters (storage is NULL)");
+ xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)");
return (simcall_storage_get_properties(storage));
}
return (simcall_storage_get_properties(storage));
}
*
* \param storage a storage
* \param name a property name
*
* \param storage a storage
* \param name a property name
- * \return value of a property (or NULL if property not set)
+ * \return value of a property (or nullptr if property not set)
*/
const char *MSG_storage_get_property_value(msg_storage_t storage, const char *name)
{
*/
const char *MSG_storage_get_property_value(msg_storage_t storage, const char *name)
{
xbt_lib_cursor_t cursor;
char *key;
void **data;
xbt_lib_cursor_t cursor;
char *key;
void **data;
- xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),NULL);
+ xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),nullptr);
xbt_lib_foreach(storage_lib, cursor, key, data) {
xbt_lib_foreach(storage_lib, cursor, key, data) {
- if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), MSG_STORAGE_LEVEL) != NULL) {
+ if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), MSG_STORAGE_LEVEL) != nullptr) {
xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
xbt_dynar_push(res, &elm);
}
xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
xbt_dynar_push(res, &elm);
}
*/
void *MSG_storage_get_data(msg_storage_t storage)
{
*/
void *MSG_storage_get_data(msg_storage_t storage)
{
- xbt_assert((storage != NULL), "Invalid parameters");
+ xbt_assert((storage != nullptr), "Invalid parameters");
msg_storage_priv_t priv = MSG_storage_priv(storage);
return priv->data;
}
msg_storage_priv_t priv = MSG_storage_priv(storage);
return priv->data;
}
* This functions checks whether a storage is a valid pointer or not and return its name.
*/
const char *MSG_storage_get_host(msg_storage_t storage) {
* This functions checks whether a storage is a valid pointer or not and return its name.
*/
const char *MSG_storage_get_host(msg_storage_t storage) {
- xbt_assert((storage != NULL), "Invalid parameters");
+ xbt_assert((storage != nullptr), "Invalid parameters");
msg_storage_priv_t priv = MSG_storage_priv(storage);
return priv->hostname;
}
msg_storage_priv_t priv = MSG_storage_priv(storage);
return priv->hostname;
}
int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
{
int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
{
- return (NULL == simcall_mbox_front(mailbox));
+ return (nullptr == simcall_mbox_front(mailbox));
}
msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
}
msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(simcall_mbox_front(mailbox));
if (!comm)
simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(simcall_mbox_front(mailbox));
if (!comm)
return (msg_task_t) comm->src_data;
}
return (msg_task_t) comm->src_data;
}
/* Try to receive it by calling SIMIX network layer */
TRY {
/* Try to receive it by calling SIMIX network layer */
TRY {
- simcall_comm_recv(MSG_process_self(), mailbox, task, NULL, NULL, NULL, NULL, timeout, rate);
+ simcall_comm_recv(MSG_process_self(), mailbox, task, nullptr, nullptr, nullptr, nullptr, timeout, rate);
XBT_DEBUG("Got task %s from %p",(*task)->name,mailbox);
if (msg_global->debug_multiple_use && (*task)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*task)->simdata->isused);
XBT_DEBUG("Got task %s from %p",(*task)->name,mailbox);
if (msg_global->debug_multiple_use && (*task)->simdata->isused!=0)
xbt_ex_free(*(xbt_ex_t*)(*task)->simdata->isused);
if (smx_proc == SIMIX_process_self()) {
/* avoid a SIMIX request if this function is called by the process itself */
msg_proc = (simdata_process_t) SIMIX_process_self_get_data();
if (smx_proc == SIMIX_process_self()) {
/* avoid a SIMIX request if this function is called by the process itself */
msg_proc = (simdata_process_t) SIMIX_process_self_get_data();
- SIMIX_process_self_set_data(NULL);
+ SIMIX_process_self_set_data(nullptr);
} else {
msg_proc = (simdata_process_t) simcall_process_get_data(smx_proc);
} else {
msg_proc = (simdata_process_t) simcall_process_get_data(smx_proc);
- simcall_process_set_data(smx_proc, NULL);
+ simcall_process_set_data(smx_proc, nullptr);
}
TRACE_msg_process_destroy(smx_proc->name.c_str(), smx_proc->pid);
}
TRACE_msg_process_destroy(smx_proc->name.c_str(), smx_proc->pid);
*/
msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
{
*/
msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
{
- return MSG_process_create_with_environment(name, code, data, host, 0, NULL, NULL);
+ return MSG_process_create_with_environment(name, code, data, host, 0, nullptr, nullptr);
}
/** \ingroup m_process_management
}
/** \ingroup m_process_management
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
- * \param name a name for the object. It is for user-level information and can be NULL.
+ * \param name a name for the object. It is for user-level information and can be nullptr.
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
- * can be NULL. It can be retrieved with the function \ref MSG_process_get_data.
+ * can be nullptr. It can be retrieved with the function \ref MSG_process_get_data.
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code
msg_process_t MSG_process_create_with_arguments(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv)
{
msg_process_t MSG_process_create_with_arguments(const char *name, xbt_main_func_t code, void *data, msg_host_t host,
int argc, char **argv)
{
- return MSG_process_create_with_environment(name, code, data, host, argc, argv, NULL);
+ return MSG_process_create_with_environment(name, code, data, host, argc, argv, nullptr);
}
/** \ingroup m_process_management
}
/** \ingroup m_process_management
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
* A constructor for #msg_process_t taking four arguments and returning the corresponding object. The structure (and
* the corresponding thread) is created, and put in the list of ready process.
- * \param name a name for the object. It is for user-level information and can be NULL.
+ * \param name a name for the object. It is for user-level information and can be nullptr.
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
* \param code is a function describing the behavior of the process. It should then only use functions described
* in \ref m_process_management (to create a new #msg_process_t for example),
in \ref m_host_management (only the read-only functions i.e. whose name contains the word get),
in \ref m_task_management (to create or destroy some #msg_task_t for example) and
in \ref msg_task_usage (to handle file transfers and task processing).
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and
- * can be NULL. It can be retrieved with the function \ref MSG_process_get_data.
+ * can be nullptr. It can be retrieved with the function \ref MSG_process_get_data.
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code. WARNING, these strings are freed by the SimGrid kernel when the
* \param host the location where the new process is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code. WARNING, these strings are freed by the SimGrid kernel when the
const char *name, std::function<void()> code, void *data,
msg_host_t host, xbt_dict_t properties)
{
const char *name, std::function<void()> code, void *data,
msg_host_t host, xbt_dict_t properties)
{
- xbt_assert(code != NULL && host != NULL, "Invalid parameters: host and code params must not be NULL");
+ xbt_assert(code != nullptr && host != nullptr, "Invalid parameters: host and code params must not be nullptr");
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
- simdata->waiting_action = NULL;
- simdata->waiting_task = NULL;
+ simdata->waiting_action = nullptr;
+ simdata->waiting_task = nullptr;
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
if (!process) {
/* Undo everything we have just changed */
xbt_free(simdata);
if (!process) {
/* Undo everything we have just changed */
xbt_free(simdata);
}
else {
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
}
else {
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
*/
msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_t properties)
{
*/
msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_dict_t properties)
{
- xbt_assert(host != NULL, "Invalid parameters: host and code params must not be NULL");
+ xbt_assert(host != nullptr, "Invalid parameters: host and code params must not be nullptr");
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
msg_process_t process;
/* Simulator data for MSG */
- simdata->waiting_action = NULL;
- simdata->waiting_task = NULL;
+ simdata->waiting_action = nullptr;
+ simdata->waiting_task = nullptr;
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
/* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
simdata->m_host = host;
simdata->data = data;
simdata->last_errno = MSG_OK;
/* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
- process = SIMIX_process_attach(name, simdata, sg_host_get_name(host), properties, NULL);
+ process = SIMIX_process_attach(name, simdata, sg_host_get_name(host), properties, nullptr);
if (!process)
xbt_die("Could not attach");
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
if (!process)
xbt_die("Could not attach");
simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
*/
void* MSG_process_get_data(msg_process_t process)
{
*/
void* MSG_process_get_data(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: first parameter must not be NULL!");
+ xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
/* get from SIMIX the MSG process data, and then the user data */
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
if (simdata)
return simdata->data;
else
/* get from SIMIX the MSG process data, and then the user data */
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
if (simdata)
return simdata->data;
else
}
/** \ingroup m_process_management
}
/** \ingroup m_process_management
*/
msg_error_t MSG_process_set_data(msg_process_t process, void *data)
{
*/
msg_error_t MSG_process_set_data(msg_process_t process, void *data)
{
- xbt_assert(process != NULL, "Invalid parameter: first parameter must not be NULL!");
+ xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
simdata->data = data;
simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process);
simdata->data = data;
/** \ingroup m_process_management
* \brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
/** \ingroup m_process_management
* \brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
- * \param data_cleanup a cleanup function for the userdata of a process, or NULL to call no function
+ * \param data_cleanup a cleanup function for the userdata of a process, or nullptr to call no function
*/
XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) {
msg_global->process_data_cleanup = data_cleanup;
*/
XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) {
msg_global->process_data_cleanup = data_cleanup;
/** \ingroup m_process_management
* \brief Return the location on which a process is running.
/** \ingroup m_process_management
* \brief Return the location on which a process is running.
- * \param process a process (NULL means the current one)
+ * \param process a process (nullptr means the current one)
* \return the msg_host_t corresponding to the location on which \a process is running.
*/
msg_host_t MSG_process_get_host(msg_process_t process)
{
simdata_process_t simdata;
* \return the msg_host_t corresponding to the location on which \a process is running.
*/
msg_host_t MSG_process_get_host(msg_process_t process)
{
simdata_process_t simdata;
+ if (process == nullptr) {
simdata = (simdata_process_t) SIMIX_process_self_get_data();
}
else {
simdata = (simdata_process_t) simcall_process_get_data(process);
}
simdata = (simdata_process_t) SIMIX_process_self_get_data();
}
else {
simdata = (simdata_process_t) simcall_process_get_data(process);
}
- return simdata ? simdata->m_host : NULL;
+ return simdata ? simdata->m_host : nullptr;
}
/** \ingroup m_process_management
}
/** \ingroup m_process_management
* \brief Return a #msg_process_t given its PID.
*
* This function search in the list of all the created msg_process_t for a msg_process_t whose PID is equal to \a PID.
* \brief Return a #msg_process_t given its PID.
*
* This function search in the list of all the created msg_process_t for a msg_process_t whose PID is equal to \a PID.
- * If no host is found, \c NULL is returned.
+ * If no host is found, \c nullptr is returned.
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
msg_process_t MSG_process_from_PID(int PID)
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
msg_process_t MSG_process_from_PID(int PID)
{
/* Do not raise an exception here: this function is called by the logs
* and the exceptions, so it would be called back again and again */
{
/* Do not raise an exception here: this function is called by the logs
* and the exceptions, so it would be called back again and again */
+ if (process == nullptr) {
return 0;
}
return simcall_process_get_PID(process);
return 0;
}
return simcall_process_get_PID(process);
*/
int MSG_process_get_PPID(msg_process_t process)
{
*/
int MSG_process_get_PPID(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
return simcall_process_get_PPID(process);
}
return simcall_process_get_PPID(process);
}
*/
const char *MSG_process_get_name(msg_process_t process)
{
*/
const char *MSG_process_get_name(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
return simcall_process_get_name(process);
}
return simcall_process_get_name(process);
}
*
* \param process a process
* \param name a property name
*
* \param process a process
* \param name a property name
- * \return value of a property (or NULL if the property is not set)
+ * \return value of a property (or nullptr if the property is not set)
*/
const char *MSG_process_get_property_value(msg_process_t process, const char *name)
{
*/
const char *MSG_process_get_property_value(msg_process_t process, const char *name)
{
*/
xbt_dict_t MSG_process_get_properties(msg_process_t process)
{
*/
xbt_dict_t MSG_process_get_properties(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
return simcall_process_get_properties(process);
}
return simcall_process_get_properties(process);
}
*/
msg_error_t MSG_process_suspend(msg_process_t process)
{
*/
msg_error_t MSG_process_suspend(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
TRACE_msg_process_suspend(process);
simcall_process_suspend(process);
TRACE_msg_process_suspend(process);
simcall_process_suspend(process);
*/
msg_error_t MSG_process_resume(msg_process_t process)
{
*/
msg_error_t MSG_process_resume(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
TRACE_msg_process_resume(process);
simcall_process_resume(process);
TRACE_msg_process_resume(process);
simcall_process_resume(process);
*/
int MSG_process_is_suspended(msg_process_t process)
{
*/
int MSG_process_is_suspended(msg_process_t process)
{
- xbt_assert(process != NULL, "Invalid parameter: First argument must not be NULL");
+ xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
return simcall_process_is_suspended(process);
}
return simcall_process_is_suspended(process);
}
* \brief Creates a new #msg_task_t.
*
* A constructor for #msg_task_t taking four arguments and returning the corresponding object.
* \brief Creates a new #msg_task_t.
*
* A constructor for #msg_task_t taking four arguments and returning the corresponding object.
- * \param name a name for the object. It is for user-level information and can be NULL.
+ * \param name a name for the object. It is for user-level information and can be nullptr.
* \param flop_amount a value of the processing amount (in flop) needed to process this new task.
* If 0, then it cannot be executed with MSG_task_execute(). This value has to be >=0.
* \param message_size a value of the amount of data (in bytes) needed to transfer this new task. If 0, then it cannot
* be transfered with MSG_task_send() and MSG_task_recv(). This value has to be >=0.
* \param data a pointer to any data may want to attach to the new object. It is for user-level information and can
* \param flop_amount a value of the processing amount (in flop) needed to process this new task.
* If 0, then it cannot be executed with MSG_task_execute(). This value has to be >=0.
* \param message_size a value of the amount of data (in bytes) needed to transfer this new task. If 0, then it cannot
* be transfered with MSG_task_send() and MSG_task_recv(). This value has to be >=0.
* \param data a pointer to any data may want to attach to the new object. It is for user-level information and can
- * be NULL. It can be retrieved with the function \ref MSG_task_get_data.
+ * be nullptr. It can be retrieved with the function \ref MSG_task_get_data.
* \see msg_task_t
* \return The new corresponding object.
*/
* \see msg_task_t
* \return The new corresponding object.
*/
task->data = data;
/* Simulator Data */
task->data = data;
/* Simulator Data */
- simdata->compute = NULL;
- simdata->comm = NULL;
+ simdata->compute = nullptr;
+ simdata->comm = nullptr;
simdata->bytes_amount = message_size;
simdata->flops_amount = flop_amount;
simdata->bytes_amount = message_size;
simdata->flops_amount = flop_amount;
- simdata->sender = NULL;
- simdata->receiver = NULL;
- simdata->source = NULL;
+ simdata->sender = nullptr;
+ simdata->receiver = nullptr;
+ simdata->source = nullptr;
simdata->priority = 1.0;
simdata->bound = 0;
simdata->priority = 1.0;
simdata->bound = 0;
- simdata->affinity_mask_db = xbt_dict_new_homogeneous(NULL);
+ simdata->affinity_mask_db = xbt_dict_new_homogeneous(nullptr);
simdata->rate = -1.0;
simdata->isused = 0;
simdata->host_nb = 0;
simdata->rate = -1.0;
simdata->isused = 0;
simdata->host_nb = 0;
- simdata->host_list = NULL;
- simdata->flops_parallel_amount = NULL;
- simdata->bytes_parallel_amount = NULL;
+ simdata->host_list = nullptr;
+ simdata->flops_parallel_amount = nullptr;
+ simdata->bytes_parallel_amount = nullptr;
TRACE_msg_task_create(task);
return task;
TRACE_msg_task_create(task);
return task;
* \brief Creates a new #msg_task_t (a parallel one....).
*
* A constructor for #msg_task_t taking six arguments and returning the corresponding object.
* \brief Creates a new #msg_task_t (a parallel one....).
*
* A constructor for #msg_task_t taking six arguments and returning the corresponding object.
- * \param name a name for the object. It is for user-level information and can be NULL.
+ * \param name a name for the object. It is for user-level information and can be nullptr.
* \param host_nb the number of hosts implied in the parallel task.
* \param host_list an array of \p host_nb msg_host_t.
* \param flops_amount an array of \p host_nb doubles.
* flops_amount[i] is the total number of operations that have to be performed on host_list[i].
* \param bytes_amount an array of \p host_nb* \p host_nb doubles.
* \param data a pointer to any data may want to attach to the new object.
* \param host_nb the number of hosts implied in the parallel task.
* \param host_list an array of \p host_nb msg_host_t.
* \param flops_amount an array of \p host_nb doubles.
* flops_amount[i] is the total number of operations that have to be performed on host_list[i].
* \param bytes_amount an array of \p host_nb* \p host_nb doubles.
* \param data a pointer to any data may want to attach to the new object.
- * It is for user-level information and can be NULL.
+ * It is for user-level information and can be nullptr.
* It can be retrieved with the function \ref MSG_task_get_data.
* \see msg_task_t
* \return The new corresponding object.
* It can be retrieved with the function \ref MSG_task_get_data.
* \see msg_task_t
* \return The new corresponding object.
*/
void *MSG_task_get_data(msg_task_t task)
{
*/
void *MSG_task_get_data(msg_task_t task)
{
- xbt_assert((task != NULL), "Invalid parameter");
+ xbt_assert((task != nullptr), "Invalid parameter");
*/
void MSG_task_set_data(msg_task_t task, void *data)
{
*/
void MSG_task_set_data(msg_task_t task, void *data)
{
- xbt_assert((task != NULL), "Invalid parameter");
+ xbt_assert((task != nullptr), "Invalid parameter");
*/
msg_error_t MSG_task_destroy(msg_task_t task)
{
*/
msg_error_t MSG_task_destroy(msg_task_t task)
{
- xbt_assert((task != NULL), "Invalid parameter");
+ xbt_assert((task != nullptr), "Invalid parameter");
if (task->simdata->isused) {
/* the task is being sent or executed: cancel it first */
if (task->simdata->isused) {
/* the task is being sent or executed: cancel it first */
*/
msg_error_t MSG_task_cancel(msg_task_t task)
{
*/
msg_error_t MSG_task_cancel(msg_task_t task)
{
- xbt_assert((task != NULL), "Cannot cancel a NULL task");
+ xbt_assert((task != nullptr), "Cannot cancel a nullptr task");
if (task->simdata->compute) {
simcall_execution_cancel(task->simdata->compute);
if (task->simdata->compute) {
simcall_execution_cancel(task->simdata->compute);
*/
double MSG_task_get_bytes_amount(msg_task_t task)
{
*/
double MSG_task_get_bytes_amount(msg_task_t task)
{
- xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter");
+ xbt_assert((task != nullptr) && (task->simdata != nullptr), "Invalid parameter");
return task->simdata->bytes_amount;
}
return task->simdata->bytes_amount;
}
*/
void MSG_task_set_priority(msg_task_t task, double priority)
{
*/
void MSG_task_set_priority(msg_task_t task, double priority)
{
- xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter");
+ xbt_assert((task != nullptr) && (task->simdata != nullptr), "Invalid parameter");
task->simdata->priority = 1 / priority;
if (task->simdata->compute)
simcall_execution_set_priority(task->simdata->compute,
task->simdata->priority = 1 / priority;
if (task->simdata->compute)
simcall_execution_set_priority(task->simdata->compute,
/* 0 means clear */
/* We need remove_ext() not throwing exception. */
void *ret = xbt_dict_get_or_null_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(msg_host_t));
/* 0 means clear */
/* We need remove_ext() not throwing exception. */
void *ret = xbt_dict_get_or_null_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(msg_host_t));
xbt_dict_remove_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(host));
} else
xbt_dict_remove_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(host));
} else
- xbt_dict_set_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(host), (void *)(uintptr_t) mask, NULL);
+ xbt_dict_set_ext(task->simdata->affinity_mask_db, (char *) host, sizeof(host), (void *)(uintptr_t) mask, nullptr);
/* We set affinity data of this task. If the task is being executed, we actually change the affinity setting of the
* task. Otherwise, this change will be applied when the task is executed. */
/* We set affinity data of this task. If the task is being executed, we actually change the affinity setting of the
* task. Otherwise, this change will be applied when the task is executed. */
*
* \param vm a vm
* \param name a property name
*
* \param vm a vm
* \param name a property name
- * \return value of a property (or NULL if property not set)
+ * \return value of a property (or nullptr if property not set)
*/
const char *MSG_vm_get_property_value(msg_vm_t vm, const char *name)
{
*/
const char *MSG_vm_get_property_value(msg_vm_t vm, const char *name)
{
*/
xbt_dict_t MSG_vm_get_properties(msg_vm_t vm)
{
*/
xbt_dict_t MSG_vm_get_properties(msg_vm_t vm)
{
- xbt_assert((vm != NULL), "Invalid parameters (vm is NULL)");
+ xbt_assert((vm != nullptr), "Invalid parameters (vm is nullptr)");
return vm->properties();
}
return vm->properties();
}
- msg_task_t task = NULL;
+ msg_task_t task = nullptr;
ret = MSG_task_recv(&task, ms->mbox);
{
if (ret != MSG_OK) {
ret = MSG_task_recv(&task, ms->mbox);
{
if (ret != MSG_OK) {
// Inform the SRC that the migration has been correctly performed
{
char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4);
// Inform the SRC that the migration has been correctly performed
{
char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4);
- msg_task_t task = MSG_task_create(task_name, 0, 0, NULL);
+ msg_task_t task = MSG_task_create(task_name, 0, 0, nullptr);
msg_error_t ret = MSG_task_send(task, ms->mbox_ctl);
// xbt_assert(ret == MSG_OK);
if(ret == MSG_HOST_FAILURE){
msg_error_t ret = MSG_task_send(task, ms->mbox_ctl);
// xbt_assert(ret == MSG_OK);
if(ret == MSG_HOST_FAILURE){
{
msg_host_priv_t priv = sg_host_msg(vm);
{
msg_host_priv_t priv = sg_host_msg(vm);
- char *key = NULL;
- xbt_dict_cursor_t cursor = NULL;
- dirty_page_t dp = NULL;
+ char *key = nullptr;
+ xbt_dict_cursor_t cursor = nullptr;
+ dirty_page_t dp = nullptr;
xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
dp->prev_clock = MSG_get_clock();
xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
dp->prev_clock = MSG_get_clock();
msg_host_priv_t priv = sg_host_msg(vm);
double total = 0;
msg_host_priv_t priv = sg_host_msg(vm);
double total = 0;
- char *key = NULL;
- xbt_dict_cursor_t cursor = NULL;
- dirty_page_t dp = NULL;
+ char *key = nullptr;
+ xbt_dict_cursor_t cursor = nullptr;
+ dirty_page_t dp = nullptr;
xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
dp->prev_remaining = remaining;
}
dp->prev_remaining = remaining;
}
- xbt_assert(xbt_dict_get_or_null(priv->dp_objs, key) == NULL);
- xbt_dict_set(priv->dp_objs, key, dp, NULL);
+ xbt_assert(xbt_dict_get_or_null(priv->dp_objs, key) == nullptr);
+ xbt_dict_set(priv->dp_objs, key, dp, nullptr);
XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, sg_host_get_name(host), remaining, priv->dp_enabled);
xbt_free(key);
XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, sg_host_get_name(host), remaining, priv->dp_enabled);
xbt_free(key);
{
sg_size_t sent = 0;
char *task_name = get_mig_task_name(vm, src_pm, dst_pm, stage);
{
sg_size_t sent = 0;
char *task_name = get_mig_task_name(vm, src_pm, dst_pm, stage);
- msg_task_t task = MSG_task_create(task_name, 0, (double)size, NULL);
+ msg_task_t task = MSG_task_create(task_name, 0, (double)size, nullptr);
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_rx_name;
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_rx_name;
/*rx_process = */ MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
}
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_tx_name;
/*rx_process = */ MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
}
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_tx_name;
/* tx_process = */MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
}
#endif
/* tx_process = */MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
}
#endif
/* wait until the migration have finished or on error has occurred */
{
XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed");
/* wait until the migration have finished or on error has occurred */
{
XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed");
- msg_task_t task = NULL;
+ msg_task_t task = nullptr;
msg_error_t ret = MSG_TIMEOUT;
while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o
ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4);
msg_error_t ret = MSG_TIMEOUT;
while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o
ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4);
if (mask == 0)
xbt_dict_remove_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm));
else
if (mask == 0)
xbt_dict_remove_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm));
else
- xbt_dict_set_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm), (void *)(uintptr_t) mask, NULL);
+ xbt_dict_set_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm), (void *)(uintptr_t) mask, nullptr);
msg_host_t pm_now = MSG_vm_get_pm(vm);
if (pm_now == pm) {
msg_host_t pm_now = MSG_vm_get_pm(vm);
if (pm_now == pm) {