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. */
11 #include "src/surf/host_interface.hpp"
14 #ifndef ENERGY_CALLBACK_HPP_
15 #define ENERGY_CALLBACK_HPP_
20 class XBT_PRIVATE HostEnergy;
22 extern XBT_PRIVATE std::map<simgrid::surf::Host*, HostEnergy*> *surf_energy;
26 typedef std::pair<double,double> power_range;
28 HostEnergy(simgrid::surf::Host *ptr);
31 double getCurrentWattsValue(double cpu_load);
32 double getConsumedEnergy();
33 double getWattMinAt(int pstate);
34 double getWattMaxAt(int pstate);
36 void unref() {if (--refcount == 0) delete this;}
37 void ref() {refcount++;}
40 void initWattsRangeList();
42 simgrid::surf::Host *host;
43 std::vector<power_range> power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
45 double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
46 double total_energy = 0.0; /*< Total energy consumed by the host */
47 double last_updated; /*< Timestamp of the last energy update event*/
50 XBT_PUBLIC(double) surf_host_get_wattmin_at(sg_host_t resource, int pstate);
51 XBT_PUBLIC(double) surf_host_get_wattmax_at(sg_host_t resource, int pstate);
52 XBT_PUBLIC(double) surf_host_get_consumed_energy(sg_host_t host);
58 #endif /* ENERGY_CALLBACK_HPP_ */