From: Martin Quinson Date: Wed, 24 Feb 2016 21:14:21 +0000 (+0100) Subject: Let's call sg::surf::host a HostImplem X-Git-Tag: v3_13~687 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c8997e63383c66e43ffde29d356fdddb65d65d81 Let's call sg::surf::host a HostImplem --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 92434bce1e..4aaeaff68e 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -52,7 +52,7 @@ class NetworkModel; class StorageModel; class Resource; class ResourceLmm; -class Host; +class HostImplem; class HostCLM03; class NetworkCm02Link; class Action; @@ -72,7 +72,7 @@ typedef simgrid::surf::NetworkModel surf_NetworkModel; typedef simgrid::surf::StorageModel surf_StorageModel; typedef simgrid::surf::Resource surf_Resource; typedef simgrid::surf::ResourceLmm surf_ResourceLmm; -typedef simgrid::surf::Host surf_Host; +typedef simgrid::surf::HostImplem surf_Host; typedef simgrid::surf::HostCLM03 surf_HostCLM03; typedef simgrid::surf::NetworkCm02Link surf_NetworkCm02Link; typedef simgrid::surf::Action surf_Action; diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 6dc1000459..642671a0c0 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -10,15 +10,13 @@ #include -#include - +#include "simgrid/simix.hpp" +#include "src/surf/HostImplem.hpp" #include "xbt/log.h" #include "src/msg/msg_private.h" #include "src/simix/smx_process_private.h" #include "src/simix/smx_private.hpp" #include "src/surf/cpu_interface.hpp" -#include "src/surf/host_interface.hpp" - #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" @@ -115,7 +113,7 @@ boost::unordered_map const& Host::mountedStorages() { /** Get the properties assigned to a host */ xbt_dict_t Host::properties() { return simgrid::simix::kernel([&] { - simgrid::surf::Host* surf_host = this->extension(); + simgrid::surf::HostImplem* surf_host = this->extension(); return surf_host->getProperties(); }); } @@ -169,14 +167,14 @@ int Host::pstate() void Host::parameters(vm_params_t params) { simgrid::simix::kernel([&]() { - this->extension()->getParams(params); + this->extension()->getParams(params); }); } void Host::setParameters(vm_params_t params) { simgrid::simix::kernel([&]() { - this->extension()->setParams(params); + this->extension()->setParams(params); }); } @@ -188,7 +186,7 @@ void Host::setParameters(vm_params_t params) xbt_dict_t Host::mountedStoragesAsDict() { return simgrid::simix::kernel([&] { - return this->extension()->getMountedStorageList(); + return this->extension()->getMountedStorageList(); }); } @@ -200,7 +198,7 @@ xbt_dict_t Host::mountedStoragesAsDict() xbt_dynar_t Host::attachedStorages() { return simgrid::simix::kernel([&] { - return this->extension()->getAttachedStorageList(); + return this->extension()->getAttachedStorageList(); }); } diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index c9243b018e..abd82f6465 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -4,12 +4,10 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "src/surf/HostImplem.hpp" #include "src/surf/surf_interface.hpp" -#include "src/surf/host_interface.hpp" #include "src/simdag/simdag_private.h" #include "simgrid/simdag.h" -#include "xbt/sysdep.h" -#include "xbt/dynar.h" #include "src/instr/instr_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_task, sd, "Logging specific to SimDag (task)"); diff --git a/src/simdag/sd_workstation.cpp b/src/simdag/sd_workstation.cpp index a0fe6ec165..918b7697c2 100644 --- a/src/simdag/sd_workstation.cpp +++ b/src/simdag/sd_workstation.cpp @@ -4,14 +4,9 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "src/surf/host_interface.hpp" #include "src/simdag/simdag_private.h" -#include "simgrid/simdag.h" -#include "simgrid/host.h" #include -#include "xbt/dict.h" -#include "xbt/lib.h" -#include "xbt/sysdep.h" +#include "src/surf/HostImplem.hpp" #include "surf/surf.h" /** @brief Returns the route between two workstations diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 9b7c46c666..23a63f6a80 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -8,10 +8,11 @@ #include "simgrid/host.h" #include #include + +#include "src/surf/HostImplem.hpp" #include "surf/surf.h" // routing_get_network_element_type FIXME:killme #include "src/simix/smx_private.hpp" -#include "src/surf/host_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts"); @@ -126,11 +127,11 @@ void sg_host_simix_destroy(sg_host_t host) { // ========= storage related functions ============ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){ - return host->extension()->getMountedStorageList(); + return host->extension()->getMountedStorageList(); } xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){ - return host->extension()->getAttachedStorageList(); + return host->extension()->getAttachedStorageList(); } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index dae6231149..3a2bd4671b 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -6,12 +6,10 @@ #include "smx_private.h" #include "xbt/sysdep.h" -#include "xbt/log.h" -#include "xbt/dict.h" #include "mc/mc.h" #include "src/mc/mc_replay.h" #include "src/surf/virtual_machine.hpp" -#include "src/surf/host_interface.hpp" +#include "src/surf/HostImplem.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix, "SIMIX hosts"); @@ -28,8 +26,7 @@ void SIMIX_host_create(sg_host_t host) // FIXME: braindead prototype. Take sg_ho s_smx_process_t proc; /* Host structure */ - smx_host->process_list = - xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup)); + smx_host->process_list = xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup)); /* Update global variables */ sg_host_simix_set(host, smx_host); @@ -46,7 +43,7 @@ void SIMIX_host_on(sg_host_t h) xbt_assert((host != NULL), "Invalid parameters"); if (h->isOff()) { - simgrid::surf::Host* surf_host = h->extension(); + simgrid::surf::HostImplem* surf_host = h->extension(); surf_host->turnOn(); unsigned int cpt; @@ -95,7 +92,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer) xbt_assert((host != NULL), "Invalid parameters"); if (h->isOn()) { - simgrid::surf::Host* surf_host = h->extension(); + simgrid::surf::HostImplem* surf_host = h->extension(); surf_host->turnOff(); /* Clean Simulator data */ @@ -325,10 +322,10 @@ smx_synchro_t SIMIX_execution_parallel_start(const char *name, host_list_cpy[i] = host_list[i]; /* Check that we are not mixing VMs and PMs in the parallel task */ - simgrid::surf::Host *host = host_list[0]->extension(); + simgrid::surf::HostImplem *host = host_list[0]->extension(); bool is_a_vm = (nullptr != dynamic_cast(host)); for (i = 1; i < host_nb; i++) { - bool tmp_is_a_vm = (nullptr != dynamic_cast(host_list[i]->extension())); + bool tmp_is_a_vm = (nullptr != dynamic_cast(host_list[i]->extension())); xbt_assert(is_a_vm == tmp_is_a_vm, "parallel_execute: mixing VMs and PMs is not supported (yet)."); } diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index fe322159a9..93e4697180 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -5,12 +5,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "smx_private.h" -#include "xbt/sysdep.h" -#include "xbt/log.h" -#include "xbt/dict.h" #include "mc/mc.h" -#include "src/surf/host_interface.hpp" #include "src/surf/virtual_machine.hpp" +#include "src/surf/HostImplem.hpp" //If you need to log some stuffs, just uncomment these two lines and uses XBT_DEBUG for instance XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_vm, simix, "Logging specific to SIMIX (vms)"); @@ -40,7 +37,7 @@ sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host) static long host_get_ramsize(sg_host_t vm, int *overcommit) { s_vm_params_t params; - vm->extension()->getParams(¶ms); + vm->extension()->getParams(¶ms); if (overcommit) *overcommit = params.overcommit; @@ -68,7 +65,7 @@ static int __can_be_started(sg_host_t vm) } long total_ramsize_of_vms = 0; - xbt_dynar_t dyn_vms = pm->extension()->getVms(); + xbt_dynar_t dyn_vms = pm->extension()->getVms(); { unsigned int cursor = 0; sg_host_t another_vm; @@ -93,7 +90,7 @@ void SIMIX_vm_start(sg_host_t ind_vm) { if (__can_be_started(ind_vm)) static_cast( - ind_vm->extension() + ind_vm->extension() )->setState(SURF_VM_STATE_RUNNING); else THROWF(vm_error, 0, "The VM %s cannot be started", sg_host_get_name(ind_vm)); @@ -103,7 +100,7 @@ void SIMIX_vm_start(sg_host_t ind_vm) e_surf_vm_state_t SIMIX_vm_get_state(sg_host_t ind_vm) { return static_cast( - ind_vm->extension() + ind_vm->extension() )->getState(); } @@ -348,7 +345,7 @@ void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_process_t issuer) /* FIXME: we may have to do something at the surf layer, e.g., vcpu action */ static_cast( - ind_vm->extension() + ind_vm->extension() )->setState(SURF_VM_STATE_CREATED); } diff --git a/src/surf/host_interface.cpp b/src/surf/HostImplem.cpp similarity index 86% rename from src/surf/host_interface.cpp rename to src/surf/HostImplem.cpp index bda8a185db..f549c9bd5d 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/HostImplem.cpp @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "host_interface.hpp" +#include "HostImplem.hpp" #include @@ -27,15 +27,15 @@ simgrid::surf::HostModel *surf_host_model = NULL; namespace simgrid { namespace surf { -simgrid::xbt::Extension Host::EXTENSION_ID; +simgrid::xbt::Extension HostImplem::EXTENSION_ID; /********* * Model * *********/ -Host *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){ +HostImplem *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){ xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL); - Host *host = new simgrid::surf::Host(surf_host_model, name, props, storageList, cpu); + HostImplem *host = new simgrid::surf::HostImplem(surf_host_model, name, props, storageList, cpu); XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage)); return host; } @@ -117,14 +117,14 @@ Action *HostModel::executeParallelTask(int host_nb, ************/ -void Host::classInit() +void HostImplem::classInit() { if (!EXTENSION_ID.valid()) { - EXTENSION_ID = simgrid::s4u::Host::extension_create(); + EXTENSION_ID = simgrid::s4u::Host::extension_create(); } } -Host::Host(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, +HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, Cpu *cpu) : Resource(model, name) , PropertyHolder(props) @@ -133,7 +133,7 @@ Host::Host(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, p_params.ramsize = 0; } -Host::Host(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, +HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, Cpu *cpu) : Resource(model, name, constraint) , PropertyHolder(props) @@ -143,11 +143,11 @@ Host::Host(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, } /** @brief use destroy() instead of this destructor */ -Host::~Host() +HostImplem::~HostImplem() { } -void Host::attach(simgrid::s4u::Host* host) +void HostImplem::attach(simgrid::s4u::Host* host) { if (p_host != nullptr) xbt_die("Already attached to host %s", host->name().c_str()); @@ -155,26 +155,26 @@ void Host::attach(simgrid::s4u::Host* host) p_host = host; } -bool Host::isOn() { +bool HostImplem::isOn() { return p_cpu->isOn(); } -bool Host::isOff() { +bool HostImplem::isOff() { return p_cpu->isOff(); } -void Host::turnOn(){ +void HostImplem::turnOn(){ if (isOff()) { p_cpu->turnOn(); simgrid::s4u::Host::onStateChange(*this->p_host); } } -void Host::turnOff(){ +void HostImplem::turnOff(){ if (isOn()) { p_cpu->turnOff(); simgrid::s4u::Host::onStateChange(*this->p_host); } } -simgrid::surf::Storage *Host::findStorageOnMountList(const char* mount) +simgrid::surf::Storage *HostImplem::findStorageOnMountList(const char* mount) { simgrid::surf::Storage *st = NULL; s_mount_t mnt; @@ -193,7 +193,7 @@ simgrid::surf::Storage *Host::findStorageOnMountList(const char* mount) return st; } -xbt_dict_t Host::getMountedStorageList() +xbt_dict_t HostImplem::getMountedStorageList() { s_mount_t mnt; unsigned int i; @@ -207,7 +207,7 @@ xbt_dict_t Host::getMountedStorageList() return storage_list; } -xbt_dynar_t Host::getAttachedStorageList() +xbt_dynar_t HostImplem::getAttachedStorageList() { xbt_lib_cursor_t cursor; char *key; @@ -224,7 +224,7 @@ xbt_dynar_t Host::getAttachedStorageList() return result; } -Action *Host::open(const char* fullpath) { +Action *HostImplem::open(const char* fullpath) { simgrid::surf::Storage *st = NULL; s_mount_t mnt; @@ -268,25 +268,25 @@ Action *Host::open(const char* fullpath) { return action; } -Action *Host::close(surf_file_t fd) { +Action *HostImplem::close(surf_file_t fd) { simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName()); return st->close(fd); } -Action *Host::read(surf_file_t fd, sg_size_t size) { +Action *HostImplem::read(surf_file_t fd, sg_size_t size) { simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName()); return st->read(fd, size); } -Action *Host::write(surf_file_t fd, sg_size_t size) { +Action *HostImplem::write(surf_file_t fd, sg_size_t size) { simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName()); return st->write(fd, size); } -int Host::unlink(surf_file_t fd) { +int HostImplem::unlink(surf_file_t fd) { if (!fd){ XBT_WARN("No such file descriptor. Impossible to unlink"); return -1; @@ -313,11 +313,11 @@ int Host::unlink(surf_file_t fd) { } } -sg_size_t Host::getSize(surf_file_t fd){ +sg_size_t HostImplem::getSize(surf_file_t fd){ return fd->size; } -xbt_dynar_t Host::getInfo( surf_file_t fd) +xbt_dynar_t HostImplem::getInfo( surf_file_t fd) { simgrid::surf::Storage *st = findStorageOnMountList(fd->mount); sg_size_t *psize = xbt_new(sg_size_t, 1); @@ -332,11 +332,11 @@ xbt_dynar_t Host::getInfo( surf_file_t fd) return info; } -sg_size_t Host::fileTell(surf_file_t fd){ +sg_size_t HostImplem::fileTell(surf_file_t fd){ return fd->current_position; } -int Host::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){ +int HostImplem::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){ switch (origin) { case SEEK_SET: @@ -353,7 +353,7 @@ int Host::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){ } } -int Host::fileMove(surf_file_t fd, const char* fullpath){ +int HostImplem::fileMove(surf_file_t fd, const char* fullpath){ /* Check if the new full path is on the same mount point */ if(!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) { sg_size_t *psize, *new_psize; @@ -383,7 +383,7 @@ int Host::fileMove(surf_file_t fd, const char* fullpath){ } } -xbt_dynar_t Host::getVms() +xbt_dynar_t HostImplem::getVms() { xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), NULL); @@ -393,19 +393,19 @@ xbt_dynar_t Host::getVms() iter != simgrid::surf::VMModel::ws_vms.end(); ++iter) { simgrid::surf::VirtualMachine *ws_vm = &*iter; - if (this == ws_vm->p_hostPM->extension(simgrid::surf::Host::EXTENSION_ID)) + if (this == ws_vm->p_hostPM->extension(simgrid::surf::HostImplem::EXTENSION_ID)) xbt_dynar_push(dyn, &ws_vm); } return dyn; } -void Host::getParams(vm_params_t params) +void HostImplem::getParams(vm_params_t params) { *params = p_params; } -void Host::setParams(vm_params_t params) +void HostImplem::setParams(vm_params_t params) { /* may check something here. */ p_params = *params; diff --git a/src/surf/host_interface.hpp b/src/surf/HostImplem.hpp similarity index 94% rename from src/surf/host_interface.hpp rename to src/surf/HostImplem.hpp index f1c199dc60..d89f3cfe2e 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/HostImplem.hpp @@ -23,7 +23,7 @@ namespace simgrid { namespace surf { class XBT_PRIVATE HostModel; -class XBT_PRIVATE Host; +class XBT_PRIVATE HostImplem; class XBT_PRIVATE HostAction; @@ -52,7 +52,7 @@ public: HostModel() : Model() {} ~HostModel() override {} - Host *createHost(const char *name, NetCard *net, Cpu *cpu, xbt_dict_t props); + HostImplem *createHost(const char *name, NetCard *net, Cpu *cpu, xbt_dict_t props); virtual void adjustWeightOfDummyCpuActions(); virtual Action *executeParallelTask(int host_nb, @@ -71,11 +71,11 @@ public: * @brief SURF Host interface class * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage */ -class Host : +class HostImplem : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder { public: - static simgrid::xbt::Extension EXTENSION_ID; + static simgrid::xbt::Extension EXTENSION_ID; public: static void classInit(); // must be called before the first use of that class @@ -88,7 +88,7 @@ public: * @param storage The Storage associated to this Host * @param cpu The Cpu associated to this Host */ - Host(HostModel *model, const char *name, xbt_dict_t props, + HostImplem(HostModel *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, Cpu *cpu); /** @@ -101,12 +101,12 @@ public: * @param storage The Storage associated to this Host * @param cpu The Cpu associated to this Host */ - Host(HostModel *model, const char *name, xbt_dict_t props, + HostImplem(HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, Cpu *cpu); /* Host destruction logic */ /**************************/ - ~Host(); + ~HostImplem(); public: HostModel *getModel() diff --git a/src/surf/callbacks.cpp b/src/surf/callbacks.cpp index 7af364a0fc..2ba786589c 100644 --- a/src/surf/callbacks.cpp +++ b/src/surf/callbacks.cpp @@ -7,8 +7,9 @@ #include #include "src/surf/callbacks.h" + +#include "src/surf/HostImplem.hpp" #include "src/surf/surf_interface.hpp" -#include "src/surf/host_interface.hpp" void surf_on_storage_created(void (*callback)(sg_storage_t)) { diff --git a/src/surf/host_clm03.hpp b/src/surf/host_clm03.hpp index 4c66fc7da6..e225fb436b 100644 --- a/src/surf/host_clm03.hpp +++ b/src/surf/host_clm03.hpp @@ -8,7 +8,7 @@ #include "storage_interface.hpp" #include "cpu_interface.hpp" -#include "host_interface.hpp" +#include "src/surf/HostImplem.hpp" #include "network_interface.hpp" #ifndef SURF_HOST_CLM03_HPP_ diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 43efa0422a..566e8f2fd6 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -8,9 +8,10 @@ #include #include "network_ib.hpp" + +#include "src/surf/HostImplem.hpp" #include "simgrid/sg_config.h" #include "maxmin_private.hpp" -#include "src/surf/host_interface.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 3e0e899633..853d6c1196 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -5,8 +5,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/surf/network_ns3.hpp" + +#include "src/surf/HostImplem.hpp" #include "src/surf/surf_private.h" -#include "src/surf/host_interface.hpp" #include "simgrid/sg_config.h" #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index ae488a5852..16100e8c07 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -7,11 +7,11 @@ #include #include -#include -#include -#include -#include -#include +#include "simgrid/plugins/energy.h" +#include "simgrid/simix.hpp" +#include "src/surf/plugins/energy.hpp" +#include "src/surf/cpu_interface.hpp" +#include "src/surf/virtual_machine.hpp" /** @addtogroup SURF_plugin_energy @@ -65,7 +65,7 @@ simgrid::xbt::Extension HostEnergy::EXTENSION_ID /* Computes the consumption so far. Called lazily on need. */ void HostEnergy::update() { - simgrid::surf::Host* surf_host = host->extension(); + simgrid::surf::HostImplem* surf_host = host->extension(); double start_time = this->last_updated; double finish_time = surf_get_clock(); double cpu_load; @@ -199,7 +199,7 @@ void HostEnergy::initWattsRangeList() /* **************************** events callback *************************** */ static void onCreation(simgrid::s4u::Host& host) { - simgrid::surf::Host* surf_host = host.extension(); + simgrid::surf::HostImplem* surf_host = host.extension(); if (dynamic_cast(surf_host)) // Ignore virtual machines return; host.extension_set(new HostEnergy(&host)); @@ -207,10 +207,10 @@ static void onCreation(simgrid::s4u::Host& host) { static void onActionStateChange(simgrid::surf::CpuAction *action, e_surf_action_state_t previous) { const char *name = getActionCpu(action)->getName(); - simgrid::surf::Host *host = sg_host_by_name(name)->extension(); + simgrid::surf::HostImplem *host = sg_host_by_name(name)->extension(); simgrid::surf::VirtualMachine *vm = dynamic_cast(host); if (vm) // If it's a VM, take the corresponding PM - host = vm->getPm()->extension(); + host = vm->getPm()->extension(); HostEnergy *host_energy = host->p_host->extension(); @@ -219,7 +219,7 @@ static void onActionStateChange(simgrid::surf::CpuAction *action, e_surf_action_ } static void onHostStateChange(simgrid::s4u::Host &host) { - simgrid::surf::Host* surf_host = host.extension(); + simgrid::surf::HostImplem* surf_host = host.extension(); if (dynamic_cast(surf_host)) // Ignore virtual machines return; @@ -231,7 +231,7 @@ static void onHostStateChange(simgrid::s4u::Host &host) { static void onHostDestruction(simgrid::s4u::Host& host) { // Ignore virtual machines - simgrid::surf::Host* surf_host = host.extension(); + simgrid::surf::HostImplem* surf_host = host.extension(); if (dynamic_cast(surf_host)) return; HostEnergy *host_energy = host.extension(); diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index e2610ac157..d1ec557d8f 100644 --- a/src/surf/plugins/energy.hpp +++ b/src/surf/plugins/energy.hpp @@ -8,9 +8,10 @@ #include -#include "src/surf/host_interface.hpp" #include +#include "src/surf/HostImplem.hpp" + #ifndef ENERGY_CALLBACK_HPP_ #define ENERGY_CALLBACK_HPP_ diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index b414a95750..44d6b0cb14 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -167,7 +167,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { while ((cnst = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i++))) { void *constraint_id = lmm_constraint_id(cnst); - if (static_cast(constraint_id)->isOff()) { + if (static_cast(constraint_id)->isOff()) { XBT_DEBUG("Action (%p) Failed!!", action); action->finish(); action->setState(SURF_ACTION_FAILED); diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index eb7cb699e1..c53a2dd42d 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -10,7 +10,7 @@ #include -#include "host_interface.hpp" +#include "HostImplem.hpp" #ifndef HOST_L07_HPP_ #define HOST_L07_HPP_ diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index a1dcbb8bba..4a7b09a625 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -10,6 +10,7 @@ #include "xbt/dict.h" #include "xbt/RngStream.h" #include +#include "HostImplem.hpp" #include "surf/surf.h" #include "src/simix/smx_private.h" @@ -18,7 +19,6 @@ #include "src/surf/xml/platf_private.hpp" #include "src/surf/cpu_interface.hpp" -#include "src/surf/host_interface.hpp" #include "src/surf/network_interface.hpp" #include "surf/surf_routing.h" // FIXME: brain dead public header #include "src/surf/surf_routing_cluster.hpp" diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 20e209bac5..66effb92d2 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -4,7 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "host_interface.hpp" +#include "HostImplem.hpp" #include "surf_interface.hpp" #include "network_interface.hpp" #include "surf_routing_cluster.hpp" @@ -18,12 +18,12 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel); * TOOLS * *********/ -static simgrid::surf::Host *get_casted_host(sg_host_t host){ //FIXME: killme - return host->extension(); +static simgrid::surf::HostImplem *get_casted_host(sg_host_t host){ //FIXME: killme + return host->extension(); } static simgrid::surf::VirtualMachine *get_casted_vm(sg_host_t host){ - return static_cast(host->extension()); + return static_cast(host->extension()); } extern double NOW; diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index d138d20652..4b8196be5d 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -8,7 +8,7 @@ #include "surf_interface.hpp" #include "network_interface.hpp" #include "cpu_interface.hpp" -#include "host_interface.hpp" +#include "HostImplem.hpp" #include "src/simix/smx_host_private.h" #include "surf_routing.hpp" #include "simgrid/sg_config.h" @@ -321,7 +321,7 @@ void surf_init(int *argc, char **argv) ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib,routing_asr_prop_free); XBT_DEBUG("Add SURF levels"); - simgrid::surf::Host::classInit(); + simgrid::surf::HostImplem::classInit(); SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free); xbt_init(argc, argv); diff --git a/src/surf/virtual_machine.cpp b/src/surf/virtual_machine.cpp index 96b5ecb9e6..de4df13235 100644 --- a/src/surf/virtual_machine.cpp +++ b/src/surf/virtual_machine.cpp @@ -34,11 +34,11 @@ VMModel::vm_list_t VMModel::ws_vms; ************/ VirtualMachine::VirtualMachine(HostModel *model, const char *name, xbt_dict_t props, simgrid::s4u::Host *hostPM) -: Host(model, name, props, NULL, NULL, NULL) +: HostImplem(model, name, props, NULL, NULL, NULL) , p_hostPM(hostPM) { VMModel::ws_vms.push_back(*this); - simgrid::s4u::Host::by_name_or_create(name)->extension_set(this); + simgrid::s4u::Host::by_name_or_create(name)->extension_set(this); } /* diff --git a/src/surf/virtual_machine.hpp b/src/surf/virtual_machine.hpp index 21c48969d0..0ec2101dda 100644 --- a/src/surf/virtual_machine.hpp +++ b/src/surf/virtual_machine.hpp @@ -6,7 +6,7 @@ #include -#include "host_interface.hpp" +#include "HostImplem.hpp" #ifndef VM_INTERFACE_HPP_ #define VM_INTERFACE_HPP_ @@ -51,7 +51,7 @@ extern XBT_PRIVATE simgrid::xbt::signal VM * @brief SURF VM interface class * @details A VM represent a virtual machine */ -class VirtualMachine : public Host { +class VirtualMachine : public HostImplem { public: /** * @brief Constructor diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index ce54ea0288..1b534b49a9 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -181,7 +181,7 @@ void VMHL13::restore() */ void VMHL13::migrate(sg_host_t host_dest) { - Host *surfHost_dst = host_dest->extension(); + HostImplem *surfHost_dst = host_dest->extension(); const char *vm_name = getName(); const char *pm_name_src = p_hostPM->name().c_str(); const char *pm_name_dst = surfHost_dst->getName(); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 4fe036a375..10a5d604b7 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -81,7 +81,7 @@ set(EXTRA_DIST src/surf/PropertyHolder.hpp src/surf/virtual_machine.hpp src/surf/host_clm03.hpp - src/surf/host_interface.hpp + src/surf/HostImplem.hpp src/surf/ptask_L07.hpp src/xbt/automaton/automaton_lexer.yy.c src/xbt/automaton/parserPromela.lex @@ -339,7 +339,7 @@ set(SURF_SRC src/surf/vm_hl13.cpp src/surf/virtual_machine.cpp src/surf/host_clm03.cpp - src/surf/host_interface.cpp + src/surf/HostImplem.cpp src/surf/ptask_L07.cpp src/xbt/xbt_sg_stubs.c )