1 #ifndef MAMMUT_ENERGY_HPP_
2 #define MAMMUT_ENERGY_HPP_
4 #include "../communicator.hpp"
5 #include "../module.hpp"
6 #include "../topology/topology.hpp"
11 typedef double Joules;
38 virtual void reset() = 0;
44 virtual bool init() = 0;
50 virtual CounterType
getType() = 0;
62 virtual void reset() = 0;
63 virtual bool init() = 0;
64 CounterType
getType(){
return COUNTER_PLUG;}
76 std::vector<topology::Cpu*> _cpus;
83 const std::vector<topology::Cpu*>&
getCpus(){
return _cpus;}
228 virtual void reset() = 0;
229 virtual bool init() = 0;
235 MAMMUT_MODULE_DECL(
Energy)
240 Energy(Communicator*
const communicator);
242 bool processMessage(
const std::string& messageIdIn,
const std::string& messageIn,
243 std::string& messageIdOut, std::string& messageOut);
277 friend std::ostream& operator<<(std::ostream& os,
const JoulesCpu& obj);
284 JoulesCpu():cpu(0), cores(0), graphic(0), dram(0){;}
286 JoulesCpu(Joules cpu, Joules cores, Joules graphic, Joules dram):
287 cpu(cpu), cores(cores), graphic(graphic), dram(dram){;}
292 void zero(){cpu = 0; cores = 0; graphic = 0; dram = 0;}
298 swap(cores, x.cores);
299 swap(graphic, x.graphic);
303 JoulesCpu& operator=(JoulesCpu rhs){
308 JoulesCpu& operator+=(
const JoulesCpu& rhs){
311 graphic += rhs.graphic;
316 JoulesCpu& operator-=(
const JoulesCpu& rhs){
319 graphic -= rhs.graphic;
324 JoulesCpu& operator*=(
const JoulesCpu& rhs){
327 graphic *= rhs.graphic;
332 JoulesCpu& operator/=(
const JoulesCpu& rhs){
335 graphic /= rhs.graphic;
340 JoulesCpu operator/=(
double x){
348 JoulesCpu operator*=(
double x){
357 inline JoulesCpu operator+(
const JoulesCpu& lhs,
const JoulesCpu& rhs){
363 inline JoulesCpu operator-(
const JoulesCpu& lhs,
const JoulesCpu& rhs){
369 inline JoulesCpu operator*(
const JoulesCpu& lhs,
const JoulesCpu& rhs){
375 inline JoulesCpu operator/(
const JoulesCpu& lhs,
const JoulesCpu& rhs){
381 inline JoulesCpu operator/(
const JoulesCpu& lhs,
double x){
387 inline JoulesCpu operator*(
const JoulesCpu& lhs,
double x){
393 inline std::ostream& operator<<(std::ostream& os,
const JoulesCpu& obj){
394 os << obj.cpu <<
"\t";
395 os << obj.cores <<
"\t";
396 os << obj.graphic <<
"\t";
397 os << obj.dram <<
"\t";
virtual Joules getJoulesCoresAll()
virtual Joules getJoules()=0
virtual Joules getJoulesDram(topology::CpuId cpuId)=0
CounterType getType()
Definition: energy.hpp:64
Definition: topology.hpp:127
CounterType getType()
Definition: energy.hpp:231
virtual Joules getJoulesCores(topology::CpuId cpuId)=0
virtual bool hasJoulesDram()=0
Counter * getCounter() const
virtual Joules getJoulesGraphicAll()
Definition: topology.hpp:56
void zero()
Definition: energy.hpp:292
virtual CounterType getType()=0
Represents the values that can be read from a Cpu energy counter.
Definition: energy.hpp:276
virtual Joules getJoulesCpuAll()
virtual Joules getJoulesCpu(topology::CpuId cpuId)=0
virtual Joules getJoulesDramAll()
Definition: energy.hpp:73
virtual bool hasJoulesGraphic()=0
Definition: energy.hpp:234
Definition: energy.hpp:25
const std::vector< topology::Cpu * > & getCpus()
Definition: energy.hpp:83
virtual JoulesCpu getJoulesComponents(topology::CpuId cpuId)=0
std::vector< CounterType > getCountersTypes() const
virtual JoulesCpu getJoulesComponentsAll()
virtual Joules getJoules()=0
virtual Joules getJoulesGraphic(topology::CpuId cpuId)=0
Definition: energy.hpp:59