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
start snake_casing NetZone. Many cleanups to come
[simgrid.git]
/
src
/
surf
/
cpu_interface.cpp
diff --git
a/src/surf/cpu_interface.cpp
b/src/surf/cpu_interface.cpp
index
6445903
..
ace74b4
100644
(file)
--- a/
src/surf/cpu_interface.cpp
+++ b/
src/surf/cpu_interface.cpp
@@
-60,7
+60,7
@@
Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, std::vector<d
Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
std::vector<double>* speedPerPstate, int core)
Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
std::vector<double>* speedPerPstate, int core)
- : Resource(model, host->get_cname(), constraint), core
sAm
ount_(core), host_(host)
+ : Resource(model, host->get_cname(), constraint), core
_c
ount_(core), host_(host)
{
xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->get_cname());
{
xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->get_cname());
@@
-71,69
+71,69
@@
Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::
// Copy the power peak array:
for (double const& value : *speedPerPstate) {
// Copy the power peak array:
for (double const& value : *speedPerPstate) {
- speed
PerP
state_.push_back(value);
+ speed
_per_p
state_.push_back(value);
}
}
}
}
-Cpu::~Cpu() = default;
+Cpu::~Cpu()
+{
+ if (get_model() == surf_cpu_model_pm)
+ speed_per_pstate_.clear();
+}
-int Cpu::get
NbPStates
()
+int Cpu::get
_pstate_count
()
{
{
- return speed
PerP
state_.size();
+ return speed
_per_p
state_.size();
}
}
-void Cpu::set
PS
tate(int pstate_index)
+void Cpu::set
_ps
tate(int pstate_index)
{
{
- xbt_assert(pstate_index <= static_cast<int>(speed
PerP
state_.size()),
+ xbt_assert(pstate_index <= static_cast<int>(speed
_per_p
state_.size()),
"Invalid parameters for CPU %s (pstate %d > length of pstates %d). Please fix your platform file, or your "
"call to change the pstate.",
"Invalid parameters for CPU %s (pstate %d > length of pstates %d). Please fix your platform file, or your "
"call to change the pstate.",
- get_cname(), pstate_index, static_cast<int>(speed
PerP
state_.size()));
+ get_cname(), pstate_index, static_cast<int>(speed
_per_p
state_.size()));
- double new_peak_speed = speed
PerP
state_[pstate_index];
+ double new_peak_speed = speed
_per_p
state_[pstate_index];
pstate_ = pstate_index;
speed_.peak = new_peak_speed;
pstate_ = pstate_index;
speed_.peak = new_peak_speed;
- on
SpeedC
hange();
+ on
_speed_c
hange();
}
}
-int Cpu::get
PS
tate()
+int Cpu::get
_ps
tate()
{
return pstate_;
}
{
return pstate_;
}
-double Cpu::get
PstateS
peed(int pstate_index)
+double Cpu::get
_pstate_peak_s
peed(int pstate_index)
{
{
- xbt_assert((pstate_index <= static_cast<int>(speedPerPstate_.size())), "Invalid parameters (pstate index out of bounds)");
+ xbt_assert((pstate_index <= static_cast<int>(speed_per_pstate_.size())),
+ "Invalid parameters (pstate index out of bounds)");
- return speed
PerP
state_[pstate_index];
+ return speed
_per_p
state_[pstate_index];
}
}
-double Cpu::get
S
peed(double load)
+double Cpu::get
_s
peed(double load)
{
return load * speed_.peak;
}
{
return load * speed_.peak;
}
-double Cpu::get_
available_speed
()
+double Cpu::get_
speed_ratio
()
{
/* number between 0 and 1 */
return speed_.scale;
}
{
/* number between 0 and 1 */
return speed_.scale;
}
-void Cpu::onSpeedChange() {
+void Cpu::on_speed_change()
+{
s4u::Host::on_speed_change(*host_);
}
s4u::Host::on_speed_change(*host_);
}
-int Cpu::
coreC
ount()
+int Cpu::
get_core_c
ount()
{
{
- return core
sAm
ount_;
+ return core
_c
ount_;
}
}
-void Cpu::setStateTrace(tmgr_trace_t trace)
-{
- xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Host %s", host_->get_cname());
-
- stateEvent_ = future_evt_set->add_trace(trace, this);
-}
void Cpu::set_speed_trace(tmgr_trace_t trace)
{
xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->get_cname());
void Cpu::set_speed_trace(tmgr_trace_t trace)
{
xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->get_cname());
@@
-166,26
+166,24
@@
void CpuAction::update_remains_lazy(double now)
set_last_value(get_variable()->get_value());
}
set_last_value(get_variable()->get_value());
}
-simgrid::xbt::signal<void(simgrid::surf::CpuAction*
, kernel::resource::Action::State)> CpuAction::onStateC
hange;
+simgrid::xbt::signal<void(simgrid::surf::CpuAction*
)> CpuAction::on_state_c
hange;
void CpuAction::suspend(){
void CpuAction::suspend(){
- Action::State previous = get_state();
- onStateChange(this, previous);
+ on_state_change(this);
Action::suspend();
}
void CpuAction::resume(){
Action::suspend();
}
void CpuAction::resume(){
- Action::State previous = get_state();
- onStateChange(this, previous);
+ on_state_change(this);
Action::resume();
}
void CpuAction::set_state(Action::State state)
{
Action::resume();
}
void CpuAction::set_state(Action::State state)
{
- Action::State previous = get_state();
Action::set_state(state);
Action::set_state(state);
- on
StateChange(this, previou
s);
+ on
_state_change(thi
s);
}
}
+
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;