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
7519162
..
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,28
+80,28
@@
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());
}
}
-sg_host_t
SIMIX
_host_self()
+sg_host_t
sg
_host_self()
{
smx_actor_t process = SIMIX_process_self();
return (process == nullptr) ? nullptr : process->host;
}
/* needs to be public and without simcall for exceptions and logging events */
-const char*
SIMIX
_host_self_get_name()
+const char*
sg
_host_self_get_name()
{
- sg_host_t host =
SIMIX
_host_self();
+ sg_host_t host =
sg
_host_self();
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,24
+137,28
@@
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();
}
-smx_activity_t simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount,
- double priority, double bound) {
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> 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){
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
+SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound)
+{
/* alloc structures and initialize */
simgrid::kernel::activity::ExecImplPtr exec =
@@
-169,7
+169,7
@@
smx_activity_t SIMIX_execution_start(smx_actor_t issuer, const char *name, doubl
exec->surf_exec = issuer->host->pimpl_cpu->execution_start(flops_amount);
exec->surf_exec->setData(exec.get());
- exec->surf_exec->set
Priority
(priority);
+ exec->surf_exec->set
SharingWeight
(priority);
if (bound > 0)
static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
@@
-180,8
+180,9
@@
smx_activity_t SIMIX_execution_start(smx_actor_t issuer, const char *name, doubl
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, double timeout)
+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 rate, double timeout)
{
/* alloc structures and initialize */
@@
-229,7
+230,7
@@
void SIMIX_execution_set_priority(smx_activity_t synchro, double priority)
simgrid::kernel::activity::ExecImplPtr exec =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
if(exec->surf_exec)
- exec->surf_exec->set
Priority
(priority);
+ exec->surf_exec->set
SharingWeight
(priority);
}
void SIMIX_execution_set_bound(smx_activity_t synchro, double bound)
@@
-273,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;