A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
simcall_mutex_unlock is back but keep the simplification of another
[simgrid.git]
/
src
/
simix
/
smx_host.cpp
diff --git
a/src/simix/smx_host.cpp
b/src/simix/smx_host.cpp
index
4a695aa
..
3fb82a4
100644
(file)
--- a/
src/simix/smx_host.cpp
+++ b/
src/simix/smx_host.cpp
@@
-29,17
+29,13
@@
namespace simgrid {
{
/* Clean Simulator data */
if (xbt_swag_size(process_list) != 0) {
- char *msg = xbt_strdup("Shutting down host, but it's not empty:");
- char *tmp;
+ std::string msg = std::string("Shutting down host, but it's not empty:");
smx_actor_t process = nullptr;
- xbt_swag_foreach(process, process_list) {
- tmp = bprintf("%s\n\t%s", msg, process->name.c_str());
- free(msg);
- msg = tmp;
- }
+ xbt_swag_foreach(process, process_list) msg = msg + "\n\t" + process->name.c_str();
+
SIMIX_display_process_status();
- THROWF(arg_error, 0, "%s", msg);
+ THROWF(arg_error, 0, "%s", msg
.c_str()
);
}
for (auto arg : auto_restart_processes)
delete arg;
@@
-57,13
+53,13
@@
namespace simgrid {
void Host::turnOn()
{
for (auto arg : boot_processes) {
- XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->
c
name());
+ XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->
getC
name());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
arg->properties, nullptr);
if (arg->kill_time >= 0)
simcall_process_set_kill_time(actor, arg->kill_time);
if (arg->auto_restart)
-
simcall_process_auto_restart_set(actor, arg->auto_restart)
;
+
actor->auto_restart = arg->auto_restart
;
}
}
@@
-84,11
+80,11
@@
void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
smx_actor_t process = nullptr;
xbt_swag_foreach(process, host->process_list) {
SIMIX_process_kill(process, issuer);
- XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->
c
name(), issuer->cname());
+ XBT_DEBUG("Killing %s@%s on behalf of %s", process->cname(), process->host->
getC
name(), issuer->cname());
}
}
} else {
- XBT_INFO("Host %s is already off", h->
c
name());
+ XBT_INFO("Host %s is already off", h->
getC
name());
}
}
@@
-105,7
+101,7
@@
const char* sg_host_self_get_name()
if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
return "";
- return host->
c
name();
+ return host->
getC
name();
}
/**
@@
-128,9
+124,9
@@
void SIMIX_host_add_auto_restart_process(
arg->properties = properties;
arg->auto_restart = auto_restart;
- if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->
c
name())) {
- xbt_dict_set(watched_hosts_lib, host->
c
name(), host, nullptr);
- XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->
c
name());
+ if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->
getC
name())) {
+ xbt_dict_set(watched_hosts_lib, host->
getC
name(), host, nullptr);
+ XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->
getC
name());
}
host->extension<simgrid::simix::Host>()->auto_restart_processes.push_back(arg);
}
@@
-141,13
+137,13
@@
void SIMIX_host_autorestart(sg_host_t host)
host->extension<simgrid::simix::Host>()->auto_restart_processes;
for (auto arg : process_list) {
- XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->
c
name());
+ XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->
getC
name());
smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
arg->properties, nullptr);
if (arg->kill_time >= 0)
simcall_process_set_kill_time(actor, arg->kill_time);
if (arg->auto_restart)
-
simcall_process_auto_restart_set(actor, arg->auto_restart)
;
+
actor->auto_restart = arg->auto_restart
;
}
process_list.clear();
}
@@
-186,7
+182,7
@@
SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount,
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
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, double timeout)
+ double* bytes_amount, double rate, double timeout)
{
/* alloc structures and initialize */
@@
-278,7
+274,7
@@
void SIMIX_execution_finish(simgrid::kernel::activity::ExecImplPtr exec)
break;
case SIMIX_FAILED:
- XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->
c
name());
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host->
getC
name());
simcall->issuer->context->iwannadie = 1;
SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
break;