return;
if (timestamp_ < 1e-12)
- stream << eventType_ << " " << 0 << " " << type->getId() << " " << container->getId();
+ stream << eventType_ << " " << 0 << " ";
else
- stream << eventType_ << " " << timestamp_ << " " << type->getId() << " " << container->getId();
- stream << " " << val->getId();
+ stream << eventType_ << " " << timestamp_ << " ";
+ stream << getType()->getId() << " " << getContainer()->getId() << " " << val->getId();
XBT_DEBUG("Dump %s", stream.str().c_str());
fprintf(tracing_file, "%s\n", stream.str().c_str());
}
if (instr_fmt_type != instr_fmt_paje)
return;
if (timestamp_ < 1e-12)
- stream << eventType_ << " " << 0 << " " << type->getId() << " " << container->getId() << " " << value_;
+ stream << eventType_ << " " << 0 << " " << getType()->getId() << " " << getContainer()->getId();
else
- stream << eventType_ << " " << timestamp_ << " " << type->getId() << " " << container->getId() << " " << value_;
+ stream << eventType_ << " " << timestamp_ << " " << getType()->getId() << " " << getContainer()->getId();
- stream << " " << endpoint_->getId() << " " << key_;
+ stream << " " << value_ << " " << endpoint_->getId() << " " << key_;
if (TRACE_display_sizes()) {
stream << " " << size_;
return;
if (timestamp_ < 1e-12)
- stream << eventType_ << " " << 0 << " " << type->getId() << " " << container->getId() << " " << value;
+ stream << eventType_ << " " << 0 << " ";
else
- stream << eventType_ << " " << timestamp_ << " " << type->getId() << " " << container->getId() << " " << value;
+ stream << eventType_ << " " << timestamp_ << " ";
+ stream << getType()->getId() << " " << getContainer()->getId() << " " << value;
XBT_DEBUG("Dump %s", stream.str().c_str());
fprintf(tracing_file, "%s\n", stream.str().c_str());
}
XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
if (instr_fmt_type == instr_fmt_paje) {
if (timestamp_ < 1e-12)
- stream << eventType_ << " " << 0 << " " << type->getId() << " " << container->getId();
+ stream << eventType_ << " " << 0 << " " << getType()->getId() << " " << getContainer()->getId();
else
- stream << eventType_ << " " << timestamp_ << " " << type->getId() << " " << container->getId();
+ stream << eventType_ << " " << timestamp_ << " " << getType()->getId() << " " << getContainer()->getId();
if (value != nullptr) // PAJE_PopState Event does not need to have a value
stream << " " << value->getId();
instr_extra_data extra = (instr_extra_data)extra_;
// FIXME: dirty extract "rank-" from the name, as we want the bare process id here
- if (container->getName().find("rank-") != 0)
- stream << container->getName() << " ";
+ if (getContainer()->getName().find("rank-") != 0)
+ stream << getContainer()->getName() << " ";
else
- stream << container->getName().erase(0, 5) << " ";
+ stream << getContainer()->getName().erase(0, 5) << " ";
- FILE* trace_file = tracing_files.at(container);
+ FILE* trace_file = tracing_files.at(getContainer());
switch (extra->type) {
case TRACING_INIT:
};
class PajeEvent {
-protected:
- Container* container;
- Type* type;
+ Container* container_;
+ Type* type_;
+protected:
+ Type* getType() { return type_; }
+ Container* getContainer() { return container_; }
public:
double timestamp_;
e_event_type eventType_;
PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
- : container(container), type(type), timestamp_(timestamp), eventType_(eventType){};
+ : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType){};
virtual ~PajeEvent() = default;
virtual void print() = 0;
void insertIntoBuffer();
bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
if (not strcmp(optim, "Full")) {
- updateMechanism_ = UM_FULL;
+ setUpdateMechanism(UM_FULL);
selectiveUpdate_ = select;
} else if (not strcmp(optim, "Lazy")) {
- updateMechanism_ = UM_LAZY;
+ setUpdateMechanism(UM_LAZY);
selectiveUpdate_ = true;
xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
"Disabling selective update while using the lazy update mechanism is dumb!");
, requestedCore_(requestedCore)
{
if (model->getUpdateMechanism() == UM_LAZY) {
- indexHeap_ = -1;
+ updateIndexHeap(-1);
refreshLastUpdate();
setLastValue(0.0);
}
|| action->getState() == Action::State::not_in_the_system) {
action->setFinishTime(date);
action->setState(Action::State::failed);
- if (action->indexHeap_ >= 0) {
+ if (action->getIndexHeap() >= 0) {
CpuTiAction* heap_act = static_cast<CpuTiAction*>(
- xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->indexHeap_));
+ xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->getIndexHeap()));
if (heap_act != action)
DIE_IMPOSSIBLE;
}
min_finish = action->getStartTime() + action->getMaxDuration();
}
/* add in action heap */
- XBT_DEBUG("action(%p) index %d", action, action->indexHeap_);
- if (action->indexHeap_ >= 0) {
+ XBT_DEBUG("action(%p) index %d", action, action->getIndexHeap());
+ if (action->getIndexHeap() >= 0) {
CpuTiAction* heap_act = static_cast<CpuTiAction*>(
- xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->indexHeap_));
+ xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->getIndexHeap()));
if (heap_act != action)
DIE_IMPOSSIBLE;
}
: CpuAction(model_, cost, failed)
, cpu_(cpu)
{
- indexHeap_ = -1;
+ updateIndexHeap(-1);
cpu_->modified(true);
}
void CpuTiAction::updateIndexHeap(int i)
{
- indexHeap_ = i;
+ Action::updateIndexHeap(i);
}
void CpuTiAction::setState(Action::State state)
if (action_ti_hook.is_linked())
cpu_->actionSet_->erase(cpu_->actionSet_->iterator_to(*this));
/* remove from heap */
- xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->tiActionHeap_, this->indexHeap_);
+ xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->tiActionHeap_, getIndexHeap());
cpu_->modified(true);
delete this;
return 1;
void CpuTiAction::cancel()
{
this->setState(Action::State::failed);
- xbt_heap_remove(getModel()->getActionHeap(), this->indexHeap_);
+ xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap());
cpu_->modified(true);
}
XBT_IN("(%p)", this);
if (suspended_ != 2) {
suspended_ = 1;
- xbt_heap_remove(getModel()->getActionHeap(), indexHeap_);
+ xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap());
cpu_->modified(true);
}
XBT_OUT();
min_finish = getFinishTime();
/* add in action heap */
- if (indexHeap_ >= 0) {
- CpuTiAction *heap_act = static_cast<CpuTiAction*>(xbt_heap_remove(getModel()->getActionHeap(), indexHeap_));
+ if (getIndexHeap() >= 0) {
+ CpuTiAction* heap_act = static_cast<CpuTiAction*>(xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap()));
if (heap_act != this)
DIE_IMPOSSIBLE;
}
void CpuTiAction::setSharingWeight(double priority)
{
XBT_IN("(%p,%g)", this, priority);
- sharingWeight_ = priority;
+ setSharingWeightNoUpdate(priority);
cpu_->modified(true);
XBT_OUT();
}
bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
if (not strcmp(optim, "Full")) {
- updateMechanism_ = UM_FULL;
+ setUpdateMechanism(UM_FULL);
selectiveUpdate_ = select;
} else if (not strcmp(optim, "Lazy")) {
- updateMechanism_ = UM_LAZY;
+ setUpdateMechanism(UM_LAZY);
selectiveUpdate_ = true;
xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
"You cannot disable selective update when using the lazy update mechanism");
maxminSystem_ = lmm_system_new(selectiveUpdate_);
loopback_ = createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
- if (updateMechanism_ == UM_LAZY) {
+ if (getUpdateMechanism() == UM_LAZY) {
actionHeap_ = xbt_heap_new(8, nullptr);
xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
modifiedSet_ = new ActionLmmList();
action->weight_ = latency;
action->latency_ = latency;
action->rate_ = rate;
- if (updateMechanism_ == UM_LAZY) {
- action->indexHeap_ = -1;
+ if (getUpdateMechanism() == UM_LAZY) {
+ action->updateIndexHeap(-1);
action->refreshLastUpdate();
}
if (action->latency_ > 0) {
action->setVariable(lmm_variable_new(maxminSystem_, action, 0.0, -1.0, constraints_per_variable));
- if (updateMechanism_ == UM_LAZY) {
+ if (getUpdateMechanism() == UM_LAZY) {
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
action->heapInsert(actionHeap_, action->latency_ + action->getLastUpdate(), route->empty() ? NORMAL : LATENCY);
{
XBT_IN("(%p)", this);
if (suspended_ != 2) {
- lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), sharingWeight_);
+ lmm_update_variable_weight(getModel()->getMaxminSystem(), getVariable(), getPriority());
suspended_ = 0;
if (getModel()->getUpdateMechanism() == UM_LAZY)
heapRemove(getModel()->getActionHeap());
double getPriority() { return sharingWeight_; };
/** @brief Set the priority of the current Action */
virtual void setSharingWeight(double priority);
+ void setSharingWeightNoUpdate(double weight) { sharingWeight_ = weight; }
/** @brief Get the state set in which the action is */
ActionList* getStateSet() {return stateSet_;};
protected:
ActionList* stateSet_;
- double sharingWeight_ = 1.0; /**< priority (1.0 by default) */
int refcount_ = 1;
private:
+ double sharingWeight_ = 1.0; /**< priority (1.0 by default) */
double maxDuration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
double remains_; /**< How much of that cost remains to be done in the currently running task */
double start_; /**< start time */
double lastValue_ = 0;
lmm_variable_t variable_ = nullptr;
enum heap_action_type hat_ = NOTSET;
+ int indexHeap_;
public:
virtual void updateRemainingLazy(double now) { THROW_IMPOSSIBLE; };
void setLastValue(double val) { lastValue_ = val; }
enum heap_action_type getHat() { return hat_; }
bool is_linked() {return action_lmm_hook.is_linked();}
-
+ int getIndexHeap() { return indexHeap_; }
protected:
int suspended_ = 0;
- int indexHeap_;
};
typedef Action::ActionList ActionList;
* @see e_UM_t
*/
e_UM_t getUpdateMechanism() {return updateMechanism_;}
+ void setUpdateMechanism(e_UM_t mechanism) { updateMechanism_ = mechanism; }
/** @brief Get Action heap */
xbt_heap_t getActionHeap() {return actionHeap_;}
protected:
ActionLmmListPtr modifiedSet_;
lmm_system_t maxminSystem_ = nullptr;
- e_UM_t updateMechanism_ = UM_UNDEFINED;
bool selectiveUpdate_;
xbt_heap_t actionHeap_;
private:
+ e_UM_t updateMechanism_ = UM_UNDEFINED;
ActionList* readyActionSet_; /**< Actions in state SURF_ACTION_READY */
ActionList* runningActionSet_; /**< Actions in state SURF_ACTION_RUNNING */
ActionList* failedActionSet_; /**< Actions in state SURF_ACTION_FAILED */