From afb806d0615c22ac119575596b71691f4e2bc9d1 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 11 Jan 2016 11:43:06 +0100 Subject: [PATCH] remove completely the energy concern from the core - It is moved to the plugin only. - In particular, there is nothing in the core headers anymore - SMPI still defines some energy methods - the command-line config still needs to know the init method Also, I'm sorry, but I renamed simgrid::Host->(p_cpu/p_netcard) to pimpl_cpu/pimpl_netcard. I should have separated the rename, sorry. --- .../energy/consumption/energy_consumption.c | 20 +- examples/msg/energy/onoff/onoff.c | 14 +- examples/msg/energy/vm/energy_vm.c | 2 +- include/simgrid/Host.hpp | 6 +- include/simgrid/host.h | 1 - include/simgrid/msg.h | 4 - include/simgrid/plugins.h | 19 -- include/simgrid/simix.h | 2 - src/include/surf/surf.h | 12 -- src/instr/instr_paje_containers.cpp | 2 +- src/msg/msg_host.cpp | 25 --- src/simgrid/host.cpp | 40 +--- src/simix/libsmx.cpp | 14 -- src/simix/smx_host.cpp | 6 +- src/smpi/smpi_dvfs.c | 1 + src/surf/cpu_cas01.cpp | 4 +- src/surf/cpu_interface.cpp | 2 +- src/surf/cpu_ti.cpp | 4 +- src/surf/host_clm03.cpp | 10 +- src/surf/host_ptask_L07.cpp | 8 +- src/surf/plugins/energy.cpp | 175 +++++++++++------- src/surf/plugins/energy.hpp | 9 +- src/surf/surf_c_bindings.cpp | 39 +--- src/surf/surf_interface.cpp | 2 + src/surf/surf_routing.cpp | 6 +- src/surf/surf_routing_generic.cpp | 2 +- src/surf/vm_hl13.cpp | 12 +- teshsuite/simdag/platforms/flatifier.cpp | 6 +- teshsuite/surf/surf_usage/surf_usage.cpp | 8 +- teshsuite/surf/surf_usage/surf_usage2.cpp | 4 +- tools/cmake/DefinePackages.cmake | 2 +- 31 files changed, 196 insertions(+), 265 deletions(-) delete mode 100644 include/simgrid/plugins.h diff --git a/examples/msg/energy/consumption/energy_consumption.c b/examples/msg/energy/consumption/energy_consumption.c index e058370b19..d523bbc132 100644 --- a/examples/msg/energy/consumption/energy_consumption.c +++ b/examples/msg/energy/consumption/energy_consumption.c @@ -8,7 +8,7 @@ #include "simgrid/msg.h" #include "xbt/sysdep.h" /* calloc */ -#include "simgrid/plugins.h" +#include "simgrid/plugins/energy.h" /* Create a log channel to have nice outputs. */ #include "xbt/log.h" @@ -30,14 +30,14 @@ int dvfs(int argc, char *argv[]) XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host,"watt_per_state")); XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", - MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); double start = MSG_get_clock(); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); // Run a task start = MSG_get_clock(); @@ -47,9 +47,9 @@ int dvfs(int argc, char *argv[]) MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW depending on load; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), MSG_host_get_wattmin_at(host,MSG_host_get_pstate(host)), - MSG_host_get_wattmax_at(host,MSG_host_get_pstate(host)), - MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_wattmin_at(host,MSG_host_get_pstate(host)), + sg_host_get_wattmax_at(host,MSG_host_get_pstate(host)), + sg_host_get_consumed_energy(host)); // ========= Change power peak ========= int pstate=2; @@ -67,24 +67,24 @@ int dvfs(int argc, char *argv[]) MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); start = MSG_get_clock(); XBT_INFO("Sleep for 4 seconds"); MSG_process_sleep(4); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", - MSG_host_get_consumed_energy(MSG_host_by_name("MyHost2")) ); + sg_host_get_consumed_energy(MSG_host_by_name("MyHost2")) ); MSG_host_off(MSG_host_by_name("MyHost2")); start = MSG_get_clock(); MSG_process_sleep(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); return 0; } diff --git a/examples/msg/energy/onoff/onoff.c b/examples/msg/energy/onoff/onoff.c index 6287a86764..56ce160d9a 100644 --- a/examples/msg/energy/onoff/onoff.c +++ b/examples/msg/energy/onoff/onoff.c @@ -4,11 +4,11 @@ /* 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 +#include #include "simgrid/msg.h" #include "xbt/sysdep.h" /* calloc */ -#include "simgrid/plugins.h" +#include "simgrid/plugins/energy.h" /* Create a log channel to have nice outputs. */ #include "xbt/log.h" @@ -70,25 +70,25 @@ static int onoff(int argc, char *argv[]) { XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host1,"watt_per_state")); XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", - MSG_host_get_current_power_peak(host1), MSG_host_get_consumed_energy(host1)); + MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", - MSG_host_get_current_power_peak(host1), MSG_host_get_consumed_energy(host1)); + MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); simulate_shutdown(host1); XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_host_get_current_power_peak(host1), MSG_host_get_consumed_energy(host1)); + MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", - MSG_host_get_current_power_peak(host1), MSG_host_get_consumed_energy(host1)); + MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); simulate_bootup(host1); XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_host_get_current_power_peak(host1), MSG_host_get_consumed_energy(host1)); + MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); return 0; diff --git a/examples/msg/energy/vm/energy_vm.c b/examples/msg/energy/vm/energy_vm.c index d05c3ffe15..ee2b7fe266 100644 --- a/examples/msg/energy/vm/energy_vm.c +++ b/examples/msg/energy/vm/energy_vm.c @@ -8,7 +8,7 @@ #include "simgrid/msg.h" #include "xbt/sysdep.h" /* calloc */ -#include "simgrid/plugins.h" +#include "simgrid/plugins/energy.h" /* Create a log channel to have nice outputs. */ #include "xbt/log.h" diff --git a/include/simgrid/Host.hpp b/include/simgrid/Host.hpp index 6e1f6c0784..7d1a51b61c 100644 --- a/include/simgrid/Host.hpp +++ b/include/simgrid/Host.hpp @@ -30,8 +30,8 @@ public: int getCoreAmount(); /* FIXME: these should be protected, but it leads to many errors */ - surf::Cpu *p_cpu = nullptr; - surf::NetCard *p_netcard = nullptr; + surf::Cpu *pimpl_cpu = nullptr; + surf::NetCard *pimpl_netcard = nullptr; private: simgrid::xbt::string name_ = "noname"; public: @@ -48,8 +48,6 @@ public: double getPowerPeakAt(int pstate_index); void setPState(int pstate_index); int getPState(); - double getWattMinAt(int pstate); - double getWattMaxAt(int pstate); void getParams(vm_params_t params); void setParams(vm_params_t params); xbt_dict_t getMountedStorageList(); diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 2c3ab3892e..e66461d220 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -61,7 +61,6 @@ XBT_PUBLIC(int) sg_host_is_on(sg_host_t host); XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host); XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate); -XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host); SG_END_DECL() diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 11fa465a37..de9e014756 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -305,8 +305,6 @@ XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h); XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h); XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h); XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h); -XBT_PUBLIC(double) MSG_host_get_wattmin_at(msg_host_t host, int pstate); -XBT_PUBLIC(double) MSG_host_get_wattmax_at(msg_host_t host, int pstate); XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate); XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h); @@ -321,8 +319,6 @@ XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host); XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host); XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host); -XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h); - /*property handlers*/ XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host); XBT_PUBLIC(const char *) MSG_host_get_property_value(msg_host_t host, diff --git a/include/simgrid/plugins.h b/include/simgrid/plugins.h deleted file mode 100644 index 0855430e45..0000000000 --- a/include/simgrid/plugins.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2014. The SimGrid Team. - * All rights reserved. */ - -/* 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. */ - -#ifndef PLUGINS_H_ -#define PLUGINS_H_ - -SG_BEGIN_DECL() - -/** \ingroup SURF_plugins - * \brief The cpu energy consumption plugin - */ -XBT_PUBLIC(void) sg_energy_plugin_init(void); - -SG_END_DECL() - -#endif /* PLUGINS_H_ */ diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 52f292a25a..8cfd2db1ae 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -258,8 +258,6 @@ XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data); XBT_PUBLIC(double) simcall_host_get_current_power_peak(sg_host_t host); XBT_PUBLIC(double) simcall_host_get_power_peak_at(sg_host_t host, int pstate_index); -XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate); -XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate); XBT_PUBLIC(smx_synchro_t) simcall_process_execute(const char *name, double flops_amount, diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 04a4b1c699..14af54214c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -20,7 +20,6 @@ #include "surf/surf_routing.h" #include "simgrid/platf_interface.h" #include "simgrid/datatypes.h" -#include "simgrid/plugins.h" #include "simgrid/forward.h" SG_BEGIN_DECL() @@ -447,17 +446,6 @@ XBT_PUBLIC(double) surf_host_get_current_power_peak(sg_host_t host); */ XBT_PUBLIC(double) surf_host_get_power_peak_at(sg_host_t host, int pstate_index); -XBT_PUBLIC(double) surf_host_get_wattmin_at(sg_host_t resource, int pstate); -XBT_PUBLIC(double) surf_host_get_wattmax_at(sg_host_t resource, int pstate); - -/** - * @brief Get the consumed energy (in joules) of an host - * - * @param host The surf host - * @return The consumed energy - */ -XBT_PUBLIC(double) surf_host_get_consumed_energy(sg_host_t host); - /** * @brief Get the list of storages mounted on an host * diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 3ce483c41d..f9606bd78b 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -60,7 +60,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe //Search for network_element_t switch (kind){ case INSTR_HOST: - newContainer->net_elm = sg_host->p_netcard; + newContainer->net_elm = sg_host->pimpl_netcard; if(!newContainer->net_elm) xbt_die("Element '%s' not found",name); break; case INSTR_ROUTER: diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 31fd77f1cf..8bf412515f 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -348,31 +348,6 @@ int MSG_host_get_nb_pstates(msg_host_t host) { return sg_host_get_nb_pstates(host); } -/** \ingroup m_host_management - * \brief Return the total energy consumed by a host (in Joules). See also @ref SURF_plugin_energy. - * - * \param host host to test - * \return Returns the consumed energy - */ -double MSG_host_get_consumed_energy(msg_host_t host) { - xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return sg_host_get_consumed_energy(host); -} -/** \ingroup m_host_management - * \brief Returns the amount of watt dissipated at the given pstate when the host is idling - * - */ -double MSG_host_get_wattmin_at(msg_host_t host, int pstate){ - return host->getWattMinAt(pstate); -} -/** \ingroup m_host_management - * \brief Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100% - * - */ -double MSG_host_get_wattmax_at(msg_host_t host, int pstate){ - return host->getWattMaxAt(pstate); -} - /** \ingroup m_host_management * \brief Return the list of mount point names on an host. * \param host a host diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 9d3255bd83..0f618931f0 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -138,15 +138,7 @@ double sg_host_get_available_speed(sg_host_t host){ * @return 1 if the host is active or 0 if it has crashed. */ int sg_host_is_on(sg_host_t host) { - return host->p_cpu->isOn(); -} - -/** @brief Returns the total energy consumed by the host (in Joules). - * - * See also @ref SURF_plugin_energy. - */ -double sg_host_get_consumed_energy(sg_host_t host) { - return surf_host_get_consumed_energy(host); + return host->pimpl_cpu->isOn(); } /** @brief Returns the number of power states for a host. @@ -154,7 +146,7 @@ double sg_host_get_consumed_energy(sg_host_t host) { * See also @ref SURF_plugin_energy. */ int sg_host_get_nb_pstates(sg_host_t host) { - return host->p_cpu->getNbPStates(); + return host->pimpl_cpu->getNbPStates(); } /** @brief Gets the pstate at which that host currently runs. @@ -198,10 +190,10 @@ void Host::turnOff() } bool Host::isOn() { - return p_cpu->isOn(); + return pimpl_cpu->isOn(); } bool Host::isOff() { - return ! p_cpu->isOn(); + return ! pimpl_cpu->isOn(); } @@ -233,11 +225,11 @@ double Host::getPowerPeakAt(int pstate_index) /** @brief Get the speed of the cpu associated to a host */ double Host::getSpeed() { - return p_cpu->getSpeed(1.0); + return pimpl_cpu->getSpeed(1.0); } /** @brief Returns the number of core of the processor. */ int Host::getCoreAmount() { - return p_cpu->getCore(); + return pimpl_cpu->getCore(); } Host* Host::by_name_or_null(const char* name) @@ -259,29 +251,13 @@ Host* Host::by_name_or_create(const char* name) void Host::setPState(int pstate_index) { simgrid::simix::kernel(std::bind( - &simgrid::surf::Cpu::setPState, p_cpu, pstate_index + &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index )); } /** @brief Retrieve the pstate at which the host is currently running */ int Host::getPState() { - return p_cpu->getPState(); -} - -/** Get the amount of watt dissipated at the given pstate when the host is idling */ -double Host::getWattMinAt(int pstate) -{ - return simgrid::simix::kernel(std::bind( - surf_host_get_wattmin_at, this, pstate - )); -} - -/** Get the amount of watt dissipated at the given pstate when the host burns CPU at 100% */ -double Host::getWattMaxAt(int pstate) -{ - return simgrid::simix::kernel(std::bind( - surf_host_get_wattmax_at, this, pstate - )); + return pimpl_cpu->getPState(); } void Host::getParams(vm_params_t params) diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 4f1d8cd0fd..7d8618afa3 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -63,20 +63,6 @@ double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index) return host->getPowerPeakAt(pstate_index); } -/** \ingroup simix_host_management - * \deprecated */ -double simcall_host_get_wattmin_at(msg_host_t host, int pstate) -{ - return host->getWattMinAt(pstate); -} - -/** \ingroup simix_host_management - * \deprecated */ -double simcall_host_get_wattmax_at(msg_host_t host, int pstate) -{ - return host->getWattMaxAt(pstate); -} - /** \deprecated */ void simcall_host_get_params(sg_host_t vm, vm_params_t params) { diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 91b7ef9f73..92cf8eeb54 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -313,7 +313,7 @@ smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name, /* set surf's action */ if (!MC_is_active() && !MC_record_replay_is_active()) { - synchro->execution.surf_exec = issuer->host->p_cpu->execute(flops_amount); + synchro->execution.surf_exec = issuer->host->pimpl_cpu->execute(flops_amount); synchro->execution.surf_exec->setData(synchro); synchro->execution.surf_exec->setPriority(priority); @@ -325,7 +325,7 @@ smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name, /* just a double check to confirm that this host is the host where this task is running. */ xbt_assert(synchro->execution.host == issuer->host); static_cast(synchro->execution.surf_exec) - ->setAffinity(issuer->host->p_cpu, affinity_mask); + ->setAffinity(issuer->host->pimpl_cpu, affinity_mask); } } @@ -432,7 +432,7 @@ void SIMIX_process_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, /* just a double check to confirm that this host is the host where this task is running. */ xbt_assert(synchro->execution.host == host); static_cast(synchro->execution.surf_exec) - ->setAffinity(host->p_cpu, mask); + ->setAffinity(host->pimpl_cpu, mask); } } diff --git a/src/smpi/smpi_dvfs.c b/src/smpi/smpi_dvfs.c index feb2051c9b..6b8d99e186 100644 --- a/src/smpi/smpi_dvfs.c +++ b/src/smpi/smpi_dvfs.c @@ -4,6 +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 "simgrid/plugins/energy.h" // FIXME: this plugin should be separated from the core #include "xbt/log.h" #include "simgrid/simix.h" #include "smpi/smpi.h" diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index ae4a965a76..9893b57cf8 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -115,7 +115,7 @@ void CpuCas01Model::addTraces() /* connect all traces relative to hosts */ xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuCas01 *host = static_cast(sg_host_by_name(elm)->p_cpu); + CpuCas01 *host = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); @@ -125,7 +125,7 @@ void CpuCas01Model::addTraces() xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuCas01 *host = static_cast(sg_host_by_name(elm)->p_cpu); + CpuCas01 *host = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index ab78cd7e94..e50e704156 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -149,7 +149,7 @@ Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint, , m_speedScale(speedScale) , m_host(host) { - host->p_cpu = this; + host->pimpl_cpu = this; xbt_assert(m_speedScale > 0, "Available speed has to be >0"); // Copy the power peak array: diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 8490a1ee3f..f3feb36580 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -501,7 +501,7 @@ void CpuTiModel::addTraces() /* connect all traces relative to hosts */ xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuTi *cpu = static_cast(sg_host_by_name(elm)->p_cpu); + CpuTi *cpu = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); @@ -517,7 +517,7 @@ void CpuTiModel::addTraces() xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuTi *cpu = static_cast(sg_host_by_name(elm)->p_cpu); + CpuTi *cpu = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(cpu, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 1df2fb2ac8..2987833074 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -81,11 +81,11 @@ Action *HostCLM03Model::executeParallelTask(int host_nb, Action *action =NULL; if ((host_nb == 1) && (cost_or_zero(bytes_amount, 0) == 0.0)){ - action = host_list[0]->p_cpu->execute(flops_amount[0]); + action = host_list[0]->pimpl_cpu->execute(flops_amount[0]); } else if ((host_nb == 1) && (cost_or_zero(flops_amount, 0) == 0.0)) { - action = surf_network_model->communicate(host_list[0]->p_netcard, - host_list[0]->p_netcard, + action = surf_network_model->communicate(host_list[0]->pimpl_netcard, + host_list[0]->pimpl_netcard, bytes_amount[0], rate); } else if ((host_nb == 2) && (cost_or_zero(flops_amount, 0) == 0.0) @@ -100,8 +100,8 @@ Action *HostCLM03Model::executeParallelTask(int host_nb, } } if (nb == 1){ - action = surf_network_model->communicate(host_list[0]->p_netcard, - host_list[1]->p_netcard, + action = surf_network_model->communicate(host_list[0]->pimpl_netcard, + host_list[1]->pimpl_netcard, value, rate); } } else diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index cd1c12a43d..72a1aef240 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -201,7 +201,7 @@ L07Action::L07Action(Model *model, int host_nb, this->p_netcardList->reserve(host_nb); for (int i = 0; ip_netcardList->push_back(host_list[i]->p_netcard); + this->p_netcardList->push_back(host_list[i]->pimpl_netcard); /* Compute the number of affected resources... */ for (int i = 0; i < host_nb; i++) { @@ -249,7 +249,7 @@ L07Action::L07Action(Model *model, int host_nb, for (int i = 0; i < host_nb; i++) lmm_expand(model->getMaxminSystem(), - host_list[i]->p_cpu->getConstraint(), + host_list[i]->pimpl_cpu->getConstraint(), this->getVariable(), flops_amount[i]); for (int i = 0; i < host_nb; i++) { @@ -341,7 +341,7 @@ void HostL07Model::addTraces() /* Connect traces relative to cpu */ xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuL07 *host = static_cast(sg_host_by_name(elm)->p_cpu); + CpuL07 *host = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); @@ -351,7 +351,7 @@ void HostL07Model::addTraces() xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) { tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name); - CpuL07 *host = static_cast(sg_host_by_name(elm)->p_cpu); + CpuL07 *host = static_cast(sg_host_by_name(elm)->pimpl_cpu); xbt_assert(host, "Host %s undefined", elm); xbt_assert(trace, "Trace %s undefined", trace_name); diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index feacbf1a7b..8ebcc67d85 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -4,6 +4,8 @@ /* 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 +#include #include #include #include @@ -86,72 +88,6 @@ static void update_consumption(simgrid::surf::Host *host, HostEnergy *host_energ host->getName(), start_time, finish_time, host->p_cpu->m_speedPeak, previous_energy, energy_this_step); } -/** \ingroup SURF_plugin_energy - * \brief Enable energy plugin - * \details Enable energy plugin to get joules consumption of each cpu. You should call this function before #MSG_init(). - */ -void sg_energy_plugin_init() { - if (simgrid::energy::surf_energy == NULL) { - - simgrid::energy::surf_energy = new std::map(); - - /* The following attaches an anonymous function to the Host::onCreation signal */ - /* Search for "C++ lambda" for more information on the syntax used here */ - simgrid::surf::Host::onCreation.connect([](simgrid::surf::Host *host) { - if (dynamic_cast(host)) // Ignore virtual machines - return; - - (*simgrid::energy::surf_energy)[host] = new HostEnergy(host); - }); - - simgrid::surf::Host::onDestruction.connect([](simgrid::surf::Host *host) { - if (dynamic_cast(host)) // Ignore virtual machines - return; - - std::map::iterator host_energy_it = simgrid::energy::surf_energy->find(host); - xbt_assert(host_energy_it != simgrid::energy::surf_energy->end(), "The host is not in surf_energy."); - - HostEnergy *host_energy = host_energy_it->second; - update_consumption(host, host_energy); - - XBT_INFO("Total energy of host %s: %f Joules", host->getName(), host_energy->getConsumedEnergy()); - host_energy_it->second->unref(); - simgrid::energy::surf_energy->erase(host_energy_it); - }); - - simgrid::surf::CpuAction::onStateChange.connect([](simgrid::surf::CpuAction *action, - e_surf_action_state_t old, - e_surf_action_state_t cur) { - const char *name = getActionCpu(action)->getName(); - simgrid::surf::Host *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(); - - HostEnergy *host_energy = (*simgrid::energy::surf_energy)[host]; - - if(host_energy->last_updated < surf_get_clock()) - update_consumption(host, host_energy); - - }); - - simgrid::surf::Host::onStateChange.connect([] (simgrid::surf::Host *host) { - if (dynamic_cast(host)) // Ignore virtual machines - return; - - HostEnergy *host_energy = (*simgrid::energy::surf_energy)[host]; - - if(host_energy->last_updated < surf_get_clock()) - update_consumption(host, host_energy); - }); - - simgrid::surf::surfExitCallbacks.connect([]() { - delete simgrid::energy::surf_energy; - simgrid::energy::surf_energy = NULL; - }); - } -} - namespace simgrid { namespace energy { @@ -277,5 +213,112 @@ xbt_dynar_t HostEnergy::getWattsRangeList() return power_range_list; } + +double surf_host_get_wattmin_at(sg_host_t host, int pstate){ + xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); + std::map::iterator hostIt = surf_energy->find(host->extension()); + return hostIt->second->getWattMinAt(pstate); +} +double surf_host_get_wattmax_at(sg_host_t host, int pstate){ + xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); + std::map::iterator hostIt = surf_energy->find(host->extension()); + return hostIt->second->getWattMaxAt(pstate); +} + +double surf_host_get_consumed_energy(sg_host_t host){ + xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); + std::map::iterator hostIt = surf_energy->find(host->extension()); + return hostIt->second->getConsumedEnergy(); +} + +} +} + +/* **************************** Public interface *************************** */ + +/** \ingroup SURF_plugin_energy + * \brief Enable energy plugin + * \details Enable energy plugin to get joules consumption of each cpu. You should call this function before #MSG_init(). + */ +void sg_energy_plugin_init() { + if (simgrid::energy::surf_energy == NULL) { + + simgrid::energy::surf_energy = new std::map(); + + /* The following attaches an anonymous function to the Host::onCreation signal */ + /* Search for "C++ lambda" for more information on the syntax used here */ + simgrid::surf::Host::onCreation.connect([](simgrid::surf::Host *host) { + if (dynamic_cast(host)) // Ignore virtual machines + return; + + (*simgrid::energy::surf_energy)[host] = new HostEnergy(host); + }); + + simgrid::surf::Host::onDestruction.connect([](simgrid::surf::Host *host) { + if (dynamic_cast(host)) // Ignore virtual machines + return; + + std::map::iterator host_energy_it = simgrid::energy::surf_energy->find(host); + xbt_assert(host_energy_it != simgrid::energy::surf_energy->end(), "The host is not in surf_energy."); + + HostEnergy *host_energy = host_energy_it->second; + update_consumption(host, host_energy); + + XBT_INFO("Total energy of host %s: %f Joules", host->getName(), host_energy->getConsumedEnergy()); + host_energy_it->second->unref(); + simgrid::energy::surf_energy->erase(host_energy_it); + }); + + simgrid::surf::CpuAction::onStateChange.connect([](simgrid::surf::CpuAction *action, + e_surf_action_state_t old, + e_surf_action_state_t cur) { + const char *name = getActionCpu(action)->getName(); + simgrid::surf::Host *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(); + + HostEnergy *host_energy = (*simgrid::energy::surf_energy)[host]; + + if(host_energy->last_updated < surf_get_clock()) + update_consumption(host, host_energy); + + }); + + simgrid::surf::Host::onStateChange.connect([] (simgrid::surf::Host *host) { + if (dynamic_cast(host)) // Ignore virtual machines + return; + + HostEnergy *host_energy = (*simgrid::energy::surf_energy)[host]; + + if(host_energy->last_updated < surf_get_clock()) + update_consumption(host, host_energy); + }); + + simgrid::surf::surfExitCallbacks.connect([]() { + delete simgrid::energy::surf_energy; + simgrid::energy::surf_energy = NULL; + }); + } +} + +/** @brief Returns the total energy consumed by the host so far (in Joules) + * + * See also @ref SURF_plugin_energy. + */ +double sg_host_get_consumed_energy(sg_host_t host) { + return simgrid::energy::surf_host_get_consumed_energy(host); +} + +/** @brief Get the amount of watt dissipated at the given pstate when the host is idling */ +double sg_host_get_wattmin_at(sg_host_t host, int pstate) { + return simgrid::simix::kernel(std::bind( + simgrid::energy::surf_host_get_wattmin_at, host, pstate + )); } +/** @brief Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100% */ +double sg_host_get_wattmax_at(sg_host_t host, int pstate) { + return simgrid::simix::kernel(std::bind( + simgrid::energy::surf_host_get_wattmax_at, host, pstate + )); } diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index de22070f30..389abd9112 100644 --- a/src/surf/plugins/energy.hpp +++ b/src/surf/plugins/energy.hpp @@ -1,4 +1,6 @@ -/* Copyright (c) 2014-2015. The SimGrid Team. +/* energy.hpp: internal interface to the energy plugin */ + +/* Copyright (c) 2014-2016. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -41,7 +43,12 @@ public: int refcount = 1; }; +XBT_PUBLIC(double) surf_host_get_wattmin_at(sg_host_t resource, int pstate); +XBT_PUBLIC(double) surf_host_get_wattmax_at(sg_host_t resource, int pstate); +XBT_PUBLIC(double) surf_host_get_consumed_energy(sg_host_t host); } } + + #endif /* ENERGY_CALLBACK_HPP_ */ diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 20b8c08c39..82cd73b735 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -18,7 +18,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel); * TOOLS * *********/ -static simgrid::surf::Host *get_casted_host(sg_host_t host){ +static simgrid::surf::Host *get_casted_host(sg_host_t host){ //FIXME: killme return host->extension(); } @@ -236,7 +236,7 @@ void surf_vm_model_create(const char *name, sg_host_t ind_phys_host){ } surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate){ - return model->communicate(src->p_netcard, dst->p_netcard, size, rate); + return model->communicate(src->pimpl_netcard, dst->pimpl_netcard, size, rate); } const char *surf_resource_name(surf_cpp_resource_t resource){ @@ -244,7 +244,7 @@ const char *surf_resource_name(surf_cpp_resource_t resource){ } surf_action_t surf_host_sleep(sg_host_t host, double duration){ - return host->p_cpu->sleep(duration); + return host->pimpl_cpu->sleep(duration); } xbt_dict_t sg_host_get_properties(sg_host_t host) { @@ -252,36 +252,17 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) { } double surf_host_get_available_speed(sg_host_t host){ - return host->p_cpu->getAvailableSpeed(); + return host->pimpl_cpu->getAvailableSpeed(); } double surf_host_get_current_power_peak(sg_host_t host){ - return host->p_cpu->getCurrentPowerPeak(); + return host->pimpl_cpu->getCurrentPowerPeak(); } double surf_host_get_power_peak_at(sg_host_t host, int pstate_index){ - return host->p_cpu->getPowerPeakAt(pstate_index); + return host->pimpl_cpu->getPowerPeakAt(pstate_index); } -using simgrid::energy::HostEnergy; -using simgrid::energy::surf_energy; - -double surf_host_get_wattmin_at(sg_host_t resource, int pstate){ - xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); - return hostIt->second->getWattMinAt(pstate); -} -double surf_host_get_wattmax_at(sg_host_t resource, int pstate){ - xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); - return hostIt->second->getWattMaxAt(pstate); -} - -double surf_host_get_consumed_energy(sg_host_t resource){ - xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization."); - std::map::iterator hostIt = surf_energy->find(get_casted_host(resource)); - return hostIt->second->getConsumedEnergy(); -} xbt_dict_t surf_host_get_mounted_storage_list(sg_host_t host){ return get_casted_host(host)->getMountedStorageList(); @@ -355,8 +336,8 @@ void surf_host_set_params(sg_host_t host, vm_params_t params){ } void surf_vm_destroy(sg_host_t vm){ // FIXME:DEADCODE - vm->p_cpu = nullptr; - vm->p_netcard = nullptr; + vm->pimpl_cpu = nullptr; + vm->pimpl_netcard = nullptr; } void surf_vm_suspend(sg_host_t vm){ @@ -388,7 +369,7 @@ void surf_vm_set_bound(sg_host_t vm, double bound){ } void surf_vm_set_affinity(sg_host_t vm, sg_host_t host, unsigned long mask){ - return get_casted_vm(vm)->setAffinity(host->p_cpu, mask); + return get_casted_vm(vm)->setAffinity(host->pimpl_cpu, mask); } xbt_dict_t surf_storage_get_content(surf_resource_t resource){ @@ -464,7 +445,7 @@ double surf_action_get_cost(surf_action_t action){ } void surf_cpu_action_set_affinity(surf_action_t action, sg_host_t host, unsigned long mask) { - static_cast(action)->setAffinity(host->p_cpu, mask); + static_cast(action)->setAffinity(host->pimpl_cpu, mask); } void surf_cpu_action_set_bound(surf_action_t action, double bound) { diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 39ca1f47a4..a69aac5714 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -43,6 +43,8 @@ simgrid::surf::signal surfExitCallbacks; } } +#include // FIXME: this plugin should not be linked to the core + s_surf_model_description_t surf_plugin_description[] = { {"Energy", "Cpu energy consumption.", sg_energy_plugin_init}, {NULL, NULL, NULL} /* this array must be NULL terminated */ diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 857f147228..6e3d4f831f 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -59,7 +59,7 @@ static xbt_dict_t random_value = NULL; simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name) { sg_host_t h = sg_host_by_name(name); - simgrid::surf::NetCard *net_elm = h==NULL?NULL: h->p_netcard; + simgrid::surf::NetCard *net_elm = h==NULL?NULL: h->pimpl_netcard; if (!net_elm) net_elm = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); return net_elm; @@ -127,7 +127,7 @@ struct s_model_type routing_models[] = { */ void sg_platf_new_netcard(sg_platf_host_link_cbarg_t netcard) { - simgrid::surf::NetCard *info = sg_host_by_name(netcard->id)->p_netcard; + simgrid::surf::NetCard *info = sg_host_by_name(netcard->id)->pimpl_netcard; xbt_assert(info, "Host '%s' not found!", netcard->id); xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] || current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI], @@ -170,7 +170,7 @@ simgrid::surf::NetCard *routing_add_host( current_routing); netcard->setId(current_routing->parsePU(netcard)); sg_host_t h = sg_host_by_name_or_create(host->id); - h->p_netcard = netcard; + h->pimpl_netcard = netcard; XBT_DEBUG("Having set name '%s' id '%d'", host->id, netcard->getId()); simgrid::surf::routingEdgeCreatedCallbacks(netcard); diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index 1dc0d18201..3173d9c655 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -449,7 +449,7 @@ As *AsGeneric::autonomousSystemExist(char *element) As *AsGeneric::processingUnitsExist(char *element) { - As *element_as = sg_host_by_name(element)->p_netcard ->getRcComponent(); + As *element_as = sg_host_by_name(element)->pimpl_netcard ->getRcComponent(); if (element_as == this) return element_as; return asExist(element_as); diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 3109c8e86d..95bc2db8aa 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -135,7 +135,7 @@ Action *VMHL13Model::executeParallelTask(int host_nb, #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0) if ((host_nb == 1) && (cost_or_zero(bytes_amount, 0) == 0.0)) - return host_list[0]->p_cpu->execute(flops_amount[0]); + return host_list[0]->pimpl_cpu->execute(flops_amount[0]); else if ((host_nb == 1) && (cost_or_zero(flops_amount, 0) == 0.0)) return surf_network_model_communicate(surf_network_model, host_list[0], host_list[0],bytes_amount[0], rate); @@ -176,15 +176,15 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos * from the VM name, we have to make sure that the system does not call the * free callback for the network resource object. The network resource object * is still used by the physical machine. */ - p_netElm = host_PM->p_netcard; + p_netElm = host_PM->pimpl_netcard; sg_host_t host_VM = sg_host_by_name_or_create(name); - host_VM->p_netcard = p_netElm; + host_VM->pimpl_netcard = p_netElm; p_vm_state = SURF_VM_STATE_CREATED; // //// CPU RELATED STUFF //// // Roughly, create a vcpu resource by using the values of the sub_cpu one. - CpuCas01 *sub_cpu = static_cast(host_PM->p_cpu); + CpuCas01 *sub_cpu = static_cast(host_PM->pimpl_cpu); p_cpu = surf_cpu_model_vm->createCpu(host_VM, // the machine hosting the VM sub_cpu->getSpeedPeakList(), // host->power_peak, @@ -244,14 +244,14 @@ void VMHL13::migrate(sg_host_t host_dest) const char *pm_name_dst = surfHost_dst->getName(); /* update net_elm with that of the destination physical host */ - sg_host_by_name(vm_name)->p_netcard = p_netElm = sg_host_by_name(pm_name_dst)->p_netcard; + sg_host_by_name(vm_name)->pimpl_netcard = p_netElm = sg_host_by_name(pm_name_dst)->pimpl_netcard; p_hostPM = host_dest; /* Update vcpu's action for the new pm */ { /* create a cpu action bound to the pm model at the destination. */ - CpuAction *new_cpu_action = static_cast(host_dest->p_cpu->execute(0)); + CpuAction *new_cpu_action = static_cast(host_dest->pimpl_cpu->execute(0)); e_surf_action_state_t state = p_action->getState(); if (state != SURF_ACTION_DONE) diff --git a/teshsuite/simdag/platforms/flatifier.cpp b/teshsuite/simdag/platforms/flatifier.cpp index 4a2fd86e04..1adbc2cec8 100644 --- a/teshsuite/simdag/platforms/flatifier.cpp +++ b/teshsuite/simdag/platforms/flatifier.cpp @@ -193,14 +193,14 @@ int main(int argc, char **argv) sg_host_t host1, host2; xbt_dict_foreach(host_list, cursor_src, src, host1) // Routes from host { - value1 = sg_host_by_name(src)->p_netcard; + value1 = sg_host_by_name(src)->pimpl_netcard; xbt_dict_foreach(host_list, cursor_dst, dst, host2) //to host { printf(" \n " ,src ,dst); xbt_dynar_t route=NULL; - value2 = sg_host_by_name(dst)->p_netcard; + value2 = sg_host_by_name(dst)->pimpl_netcard; routing_get_route_and_latency(value1, value2, &route,NULL); for(i=0;i\n " ,src, dst); xbt_dynar_t route=NULL; - value2 = sg_host_by_name(dst)->p_netcard; + value2 = sg_host_by_name(dst)->pimpl_netcard; routing_get_route_and_latency((sg_netcard_t)value1,(sg_netcard_t)value2,&route, NULL); for(i=0;ip_cpu), hostA); - XBT_DEBUG("%s : %p", surf_cpu_name(hostB->p_cpu), hostB); + XBT_DEBUG("%s : %p", surf_cpu_name(hostA->pimpl_cpu), hostA); + XBT_DEBUG("%s : %p", surf_cpu_name(hostB->pimpl_cpu), hostB); /* Let's do something on it */ - actionA = hostA->p_cpu->execute(1000.0); - actionB = hostB->p_cpu->execute(1000.0); + actionA = hostA->pimpl_cpu->execute(1000.0); + actionB = hostB->pimpl_cpu->execute(1000.0); actionC = surf_host_sleep(hostB, 7.32); /* Use whatever calling style you want... */ diff --git a/teshsuite/surf/surf_usage/surf_usage2.cpp b/teshsuite/surf/surf_usage/surf_usage2.cpp index ed16cdbf61..8a2b672880 100644 --- a/teshsuite/surf/surf_usage/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage/surf_usage2.cpp @@ -58,8 +58,8 @@ void test(char *platform) XBT_DEBUG("%s : %p", sg_host_get_name(hostB), hostB); /* Let's do something on it */ - hostA->p_cpu->execute(1000.0); - hostB->p_cpu->execute(1000.0); + hostA->pimpl_cpu->execute(1000.0); + hostB->pimpl_cpu->execute(1000.0); surf_host_sleep(hostB, 7.32); surf_network_model_communicate(surf_network_model, hostA, hostB, 150.0, -1.0); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index f2bc31faf0..53f54d0e4f 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -660,6 +660,7 @@ set(headers_to_install include/simdag/simdag.h include/simdag/datatypes.h + include/simgrid/plugins/energy.h include/simgrid/instr.h include/simgrid/msg.h include/simgrid/simdag.h @@ -669,7 +670,6 @@ set(headers_to_install include/simgrid/forward.h include/simgrid/platf.h include/simgrid/platf_generator.h - include/simgrid/plugins.h include/simgrid/simix.h include/simgrid/simix.hpp include/simgrid/host.h -- 2.20.1