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
Merge pull request #259 from simgrid/configfix
[simgrid.git]
/
src
/
surf
/
cpu_interface.cpp
diff --git
a/src/surf/cpu_interface.cpp
b/src/surf/cpu_interface.cpp
index
a223b68
..
bbac0ef
100644
(file)
--- a/
src/surf/cpu_interface.cpp
+++ b/
src/surf/cpu_interface.cpp
@@
-20,31
+20,28
@@
namespace surf {
* Model *
*********/
* Model *
*********/
-void CpuModel::update
ActionsStateL
azy(double now, double /*delta*/)
+void CpuModel::update
_actions_state_l
azy(double now, double /*delta*/)
{
while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
CpuAction* action = static_cast<CpuAction*>(actionHeapPop());
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
{
while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
CpuAction* action = static_cast<CpuAction*>(actionHeapPop());
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
- Cpu* cpu = static_cast<Cpu*>(action->get
V
ariable()->get_constraint(0)->get_id());
- TRACE_surf_host_set_utilization(cpu->getCname(), action->get
Category(), action->getV
ariable()->get_value(),
- action->get
LastUpdate(), now - action->getLastU
pdate());
+ Cpu* cpu = static_cast<Cpu*>(action->get
_v
ariable()->get_constraint(0)->get_id());
+ TRACE_surf_host_set_utilization(cpu->getCname(), action->get
_category(), action->get_v
ariable()->get_value(),
+ action->get
_last_update(), now - action->get_last_u
pdate());
}
action->finish(kernel::resource::Action::State::done);
XBT_CDEBUG(surf_kernel, "Action %p finished", action);
}
action->finish(kernel::resource::Action::State::done);
XBT_CDEBUG(surf_kernel, "Action %p finished", action);
-
- /* set the remains to 0 due to precision problems when updating the remaining amount */
- action->setRemains(0);
}
if (TRACE_is_enabled()) {
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
}
if (TRACE_is_enabled()) {
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
- for (kernel::resource::Action const& action : *get
RunningActionS
et()) {
- if (smaller < 0 || action.get
LastU
pdate() < smaller)
- smaller = action.get
LastU
pdate();
+ for (kernel::resource::Action const& action : *get
_running_action_s
et()) {
+ if (smaller < 0 || action.get
_last_u
pdate() < smaller)
+ smaller = action.get
_last_u
pdate();
}
if (smaller > 0) {
TRACE_last_timestamp_to_dump = smaller;
}
if (smaller > 0) {
TRACE_last_timestamp_to_dump = smaller;
@@
-52,25
+49,25
@@
void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
}
}
}
}
-void CpuModel::update
ActionsStateF
ull(double now, double delta)
+void CpuModel::update
_actions_state_f
ull(double now, double delta)
{
{
- for (auto it = std::begin(*get
RunningActionSet()); it != std::end(*getRunningActionS
et());) {
+ for (auto it = std::begin(*get
_running_action_set()); it != std::end(*get_running_action_s
et());) {
CpuAction& action = static_cast<CpuAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (TRACE_is_enabled()) {
CpuAction& action = static_cast<CpuAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (TRACE_is_enabled()) {
- Cpu* cpu = static_cast<Cpu*>(action.get
V
ariable()->get_constraint(0)->get_id());
- TRACE_surf_host_set_utilization(cpu->getCname(), action.get
Category(), action.getV
ariable()->get_value(),
+ Cpu* cpu = static_cast<Cpu*>(action.get
_v
ariable()->get_constraint(0)->get_id());
+ TRACE_surf_host_set_utilization(cpu->getCname(), action.get
_category(), action.get_v
ariable()->get_value(),
now - delta, delta);
TRACE_last_timestamp_to_dump = now - delta;
}
now - delta, delta);
TRACE_last_timestamp_to_dump = now - delta;
}
- action.update
Remains(action.getV
ariable()->get_value() * delta);
+ action.update
_remains(action.get_v
ariable()->get_value() * delta);
- if (action.get
MaxD
uration() != NO_MAX_DURATION)
- action.update
MaxD
uration(delta);
+ if (action.get
_max_d
uration() != NO_MAX_DURATION)
+ action.update
_max_d
uration(delta);
- if (((action.get
RemainsNoUpdate() <= 0) && (action.getV
ariable()->get_weight() > 0)) ||
- ((action.get
MaxDuration() != NO_MAX_DURATION) && (action.getMaxD
uration() <= 0))) {
+ if (((action.get
_remains_no_update() <= 0) && (action.get_v
ariable()->get_weight() > 0)) ||
+ ((action.get
_max_duration() != NO_MAX_DURATION) && (action.get_max_d
uration() <= 0))) {
action.finish(kernel::resource::Action::State::done);
}
}
action.finish(kernel::resource::Action::State::done);
}
}
@@
-173,59
+170,61
@@
void Cpu::setSpeedTrace(tmgr_trace_t trace)
* Action *
**********/
* Action *
**********/
-void CpuAction::update
RemainingL
azy(double now)
+void CpuAction::update
_remains_l
azy(double now)
{
{
- xbt_assert(getStateSet() == getModel()->getRunningActionSet(), "You're updating an action that is not running.");
- xbt_assert(getPriority() > 0, "You're updating an action that seems suspended.");
+ xbt_assert(get_state_set() == get_model()->get_running_action_set(),
+ "You're updating an action that is not running.");
+ xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
- double delta = now - get
LastU
pdate();
+ double delta = now - get
_last_u
pdate();
- if (get
RemainsNoU
pdate() > 0) {
- XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, get
RemainsNoU
pdate(),
- get
LastU
pdate());
- update
Remains(getLastV
alue() * delta);
+ if (get
_remains_no_u
pdate() > 0) {
+ XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, get
_remains_no_u
pdate(),
+ get
_last_u
pdate());
+ update
_remains(get_last_v
alue() * delta);
if (TRACE_is_enabled()) {
if (TRACE_is_enabled()) {
- Cpu* cpu = static_cast<Cpu*>(get
V
ariable()->get_constraint(0)->get_id());
- TRACE_surf_host_set_utilization(cpu->getCname(), get
Category(), getLastValue(), getLastU
pdate(),
- now - get
LastU
pdate());
+ Cpu* cpu = static_cast<Cpu*>(get
_v
ariable()->get_constraint(0)->get_id());
+ TRACE_surf_host_set_utilization(cpu->getCname(), get
_category(), get_last_value(), get_last_u
pdate(),
+ now - get
_last_u
pdate());
}
}
- XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get
RemainsNoU
pdate());
+ XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get
_remains_no_u
pdate());
}
}
-
refreshLastU
pdate();
- set
LastValue(getV
ariable()->get_value());
+
set_last_u
pdate();
+ set
_last_value(get_v
ariable()->get_value());
}
simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
void CpuAction::suspend(){
}
simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
void CpuAction::suspend(){
- Action::State previous = get
S
tate();
+ Action::State previous = get
_s
tate();
onStateChange(this, previous);
Action::suspend();
}
void CpuAction::resume(){
onStateChange(this, previous);
Action::suspend();
}
void CpuAction::resume(){
- Action::State previous = get
S
tate();
+ Action::State previous = get
_s
tate();
onStateChange(this, previous);
Action::resume();
}
onStateChange(this, previous);
Action::resume();
}
-void CpuAction::setState(Action::State state){
- Action::State previous = getState();
- Action::setState(state);
+void CpuAction::set_state(Action::State state)
+{
+ Action::State previous = get_state();
+ Action::set_state(state);
onStateChange(this, previous);
}
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;
onStateChange(this, previous);
}
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;
- int llen = get
V
ariable()->get_number_of_constraint();
+ int llen = get
_v
ariable()->get_number_of_constraint();
for (int i = 0; i < llen; i++) {
/* Beware of composite actions: ptasks put links and cpus together */
// extra pb: we cannot dynamic_cast from void*...
kernel::resource::Resource* resource =
for (int i = 0; i < llen; i++) {
/* Beware of composite actions: ptasks put links and cpus together */
// extra pb: we cannot dynamic_cast from void*...
kernel::resource::Resource* resource =
- static_cast<kernel::resource::Resource*>(get
V
ariable()->get_constraint(i)->get_id());
+ static_cast<kernel::resource::Resource*>(get
_v
ariable()->get_constraint(i)->get_id());
Cpu* cpu = dynamic_cast<Cpu*>(resource);
if (cpu != nullptr)
retlist.push_back(cpu);
Cpu* cpu = dynamic_cast<Cpu*>(resource);
if (cpu != nullptr)
retlist.push_back(cpu);