- if (!sg_host_simix(host)->auto_restart_processes) {
- sg_host_simix(host)->auto_restart_processes = xbt_dynar_new(sizeof(smx_process_arg_t),_SIMIX_host_free_process_arg);
- }
- smx_process_arg_t arg = new simgrid::simix::ProcessArg();
- arg->name = name;
- arg->code = std::move(code);
- arg->data = data;
- arg->hostname = hostname;
- arg->kill_time = kill_time;
- arg->properties = properties;
- arg->auto_restart = auto_restart;
-
- if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){
- xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,nullptr);
- XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host));
- }
- xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg);
-}
-/** @brief Restart the list of processes that have been registered to the host */
-void SIMIX_host_autorestart(sg_host_t host)
-{
- unsigned int cpt;
- smx_process_arg_t arg;
- xbt_dynar_t process_list = sg_host_simix(host)->auto_restart_processes;
- if (!process_list)
- return;
-
- xbt_dynar_foreach (process_list, cpt, arg) {
-
- XBT_DEBUG("Restarting Process %s(%s) right now", arg->name.c_str(), arg->hostname);
- simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->hostname, arg->kill_time,
- arg->properties, arg->auto_restart, nullptr);
- }
- xbt_dynar_reset(process_list);
-}
-
-smx_activity_t simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount,
- double priority, double bound) {
- return SIMIX_execution_start(simcall->issuer, name,flops_amount,priority,bound);
-}
-
-smx_activity_t SIMIX_execution_start(smx_actor_t issuer, const char *name, double flops_amount, double priority,
- double bound){
-
- /* alloc structures and initialize */
- simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, issuer->host);
-
- /* set surf's action */
- if (!MC_is_active() && !MC_record_replay_is_active()) {
-
- exec->surf_exec = issuer->host->pimpl_cpu->execution_start(flops_amount);
- exec->surf_exec->setData(exec);
- exec->surf_exec->setPriority(priority);
-
- if (bound > 0)
- static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
- }
-
- XBT_DEBUG("Create execute synchro %p: %s", exec, exec->name.c_str());
-
- return exec;
-}
-
-smx_activity_t SIMIX_execution_parallel_start(const char *name, int host_nb, sg_host_t *host_list, double *flops_amount,
- double *bytes_amount, double amount, double rate){
-
- /* alloc structures and initialize */
- simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, nullptr);
-
- /* set surf's synchro */
- sg_host_t *host_list_cpy = xbt_new0(sg_host_t, host_nb);
- for (int i = 0; i < host_nb; i++)
- host_list_cpy[i] = host_list[i];