int USER_HOST_LEVEL;
namespace simgrid {
+
+namespace xbt {
+template class Extendable<simgrid::s4u::Host>;
+}
+
namespace s4u {
simgrid::xbt::signal<void(Host&)> Host::onCreation;
}
Host::~Host() {
- if (mounts != NULL)
- delete mounts;
+ delete pimpl_cpu;
+ delete mounts;
}
Host *Host::by_name(std::string name) {
xbt_die("No such host: %s", name.c_str());
return host;
}
+Host* Host::by_name_or_null(const char* name)
+{
+ return (Host*) xbt_dict_get_or_null(host_list, name);
+}
+Host* Host::by_name_or_create(const char* name)
+{
+ Host* host = by_name_or_null(name);
+ if (host == nullptr) {
+ host = new Host(name);
+ xbt_dict_set(host_list, name, host, NULL);
+ }
+ return host;
+}
Host *Host::current(){
smx_process_t smx_proc = SIMIX_process_self();
}
void Host::turn_off() {
- simgrid::simix::simcall<void>(SIMCALL_HOST_OFF, this);
+ simgrid::simix::kernel(std::bind(SIMIX_host_off, this, SIMIX_process_self()));
}
bool Host::is_on() {
return pimpl_cpu->getCore();
}
-Host* Host::by_name_or_null(const char* name)
-{
- return (Host*) xbt_dict_get_or_null(host_list, name);
-}
-
-Host* Host::by_name_or_create(const char* name)
-{
- Host* host = by_name_or_null(name);
- if (host == nullptr) {
- host = new Host(name);
- xbt_dict_set(host_list, name, host, NULL);
- }
- return host;
-}
-
/** @brief Set the pstate at which the host should run */
void Host::set_pstate(int pstate_index)
{