1 /* energy.hpp: internal interface to the energy plugin */
3 /* Copyright (c) 2014-2016. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
13 #include "src/surf/HostImpl.hpp"
15 #ifndef ENERGY_CALLBACK_HPP_
16 #define ENERGY_CALLBACK_HPP_
21 class XBT_PRIVATE HostEnergy;
29 PowerRange(double idle, double min, double max) : idle(idle), min(min), max(max) {
35 static simgrid::xbt::Extension<simgrid::s4u::Host, HostEnergy> EXTENSION_ID;
37 explicit HostEnergy(simgrid::s4u::Host *ptr);
40 double getCurrentWattsValue(double cpu_load);
41 double getConsumedEnergy();
42 double getWattMinAt(int pstate);
43 double getWattMaxAt(int pstate);
47 void initWattsRangeList();
48 simgrid::s4u::Host *host = nullptr;
49 std::vector<PowerRange> power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
51 double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
52 double total_energy = 0.0; /*< Total energy consumed by the host */
53 double last_updated; /*< Timestamp of the last energy update event*/
59 #endif /* ENERGY_CALLBACK_HPP_ */