Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8f8d5bd1daf8c1fdf0ef04670a2907d96546f0d4
[simgrid.git] / src / surf / plugins / energy.hpp
1 /* Copyright (c) 2014-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "../cpu_interface.hpp"
8 #include <map>
9
10 #ifndef CALLBACK_HPP_
11 #define CALLBACK_HPP_
12
13 class CpuEnergy;
14
15 extern std::map<Cpu*, CpuEnergy*> *surf_energy;
16
17 class CpuEnergy {
18 public:
19   CpuEnergy(Cpu *ptr);
20   ~CpuEnergy();
21
22   double getCurrentWattsValue(double cpu_load);
23   double getConsumedEnergy();
24   double getWattMinAt(int pstate);
25   double getWattMaxAt(int pstate);
26
27   xbt_dynar_t getWattsRangeList();
28   xbt_dynar_t power_range_watts_list;   /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
29   double watts_off;                      /*< Consumption when the machine is turned off (shutdown) */
30   double total_energy;                                  /*< Total energy consumed by the host */
31   double last_updated;                                  /*< Timestamp of the last energy update event*/
32   Cpu *cpu;
33 };
34
35 #endif /* CALLBACK_HPP_ */