A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[ENERGY] Instead of using plain integers, use constants
[simgrid.git]
/
src
/
surf
/
plugins
/
host_energy.cpp
diff --git
a/src/surf/plugins/host_energy.cpp
b/src/surf/plugins/host_energy.cpp
index
3096d22
..
0436ec2
100644
(file)
--- a/
src/surf/plugins/host_energy.cpp
+++ b/
src/surf/plugins/host_energy.cpp
@@
-152,6
+152,7
@@
private:
* with the old pstate!)
*/
int pstate = 0;
* with the old pstate!)
*/
int pstate = 0;
+ const int pstate_off = -1;
public:
double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
public:
double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
@@
-200,7
+201,7
@@
void HostEnergy::update()
double previous_energy = this->total_energy;
double instantaneous_consumption;
double previous_energy = this->total_energy;
double instantaneous_consumption;
- if (this->pstate ==
-1
) // The host was off at the beginning of this time interval
+ if (this->pstate ==
pstate_off
) // The host was off at the beginning of this time interval
instantaneous_consumption = this->watts_off;
else
instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
instantaneous_consumption = this->watts_off;
else
instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
@@
-219,7
+220,7
@@
void HostEnergy::update()
}
/* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */
}
/* Save data for the upcoming time interval: whether it's on/off and the pstate if it's on */
- this->pstate = host->isOn() ? host->getPstate() :
-1
;
+ this->pstate = host->isOn() ? host->getPstate() :
pstate_off
;
}
HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_get_clock())
}
HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host(ptr), last_updated(surf_get_clock())