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 HostEnergy(simgrid::surf::Host *ptr);
29 double getCurrentWattsValue(double cpu_load);
30 double getConsumedEnergy();
31 double getWattMinAt(int pstate);
32 double getWattMaxAt(int pstate);
34 xbt_dynar_t getWattsRangeList();
35 xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
36 double watts_off; /*< Consumption when the machine is turned off (shutdown) */
37 double total_energy; /*< Total energy consumed by the host */
38 double last_updated; /*< Timestamp of the last energy update event*/
39 simgrid::surf::Host *host;
41 void unref() {if (--refcount == 0) delete this;}
42 void ref() {refcount++;}
46 XBT_PUBLIC(double) surf_host_get_wattmin_at(sg_host_t resource, int pstate);
47 XBT_PUBLIC(double) surf_host_get_wattmax_at(sg_host_t resource, int pstate);
48 XBT_PUBLIC(double) surf_host_get_consumed_energy(sg_host_t host);
54 #endif /* ENERGY_CALLBACK_HPP_ */