X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab4418d8efe3144dcb84ebc13e7798bbc4fd7098..bd7708d5f81722d60f78bcf7dd0481d6a8e58a92:/src/surf/plugins/energy.hpp diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index 18af57fd29..26fa2999a3 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 @@ -6,32 +8,52 @@ #include -#include "../cpu_interface.hpp" -#include +#include + +#include "src/surf/HostImpl.hpp" #ifndef ENERGY_CALLBACK_HPP_ #define ENERGY_CALLBACK_HPP_ -class XBT_PRIVATE CpuEnergy; +namespace simgrid { +namespace energy { + +class XBT_PRIVATE HostEnergy; + +class PowerRange { + public: + double idle; + double min; + double max; -extern XBT_PRIVATE std::map *surf_energy; + PowerRange(double idle, double min, double max) : idle(idle), min(min), max(max) { + } +}; -class CpuEnergy { +class HostEnergy { public: - CpuEnergy(Cpu *ptr); - ~CpuEnergy(); + static simgrid::xbt::Extension EXTENSION_ID; + + explicit HostEnergy(simgrid::s4u::Host *ptr); + ~HostEnergy(); double getCurrentWattsValue(double cpu_load); double getConsumedEnergy(); double getWattMinAt(int pstate); double getWattMaxAt(int pstate); + void update(); - xbt_dynar_t getWattsRangeList(); - xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ - double watts_off; /*< Consumption when the machine is turned off (shutdown) */ - double total_energy; /*< Total energy consumed by the host */ - double last_updated; /*< Timestamp of the last energy update event*/ - Cpu *cpu; +private: + void initWattsRangeList(); + simgrid::s4u::Host *host = nullptr; + std::vector power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ +public: + double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */ + double total_energy = 0.0; /*< Total energy consumed by the host */ + double last_updated; /*< Timestamp of the last energy update event*/ }; +} +} + #endif /* ENERGY_CALLBACK_HPP_ */