surf_action_set_data(synchro->execution.surf_exec, synchro);
surf_action_set_priority(synchro->execution.surf_exec, priority);
- /* Note (hypervisor): for multicore, the bound value being passed to the
- * surf layer should not be zero (i.e., unlimited). It should be the
- * capacity of a CPU core.
- *
- * FIXME: this should probably not be part of Simix but of Surf directly.
- * That bound is part of the performance model, not of the synchronization
- */
- if (bound == 0)
- surf_cpu_action_set_bound(synchro->execution.surf_exec, sg_host_get_speed(issuer->host));
- else
+ if (bound != 0)
surf_cpu_action_set_bound(synchro->execution.surf_exec, bound);
if (affinity_mask != 0) {
return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
}
+/** @brief take into account changes of speed (either load or max) */
+void CpuCas01::onSpeedChange() {
+ lmm_variable_t var = NULL;
+ lmm_element_t elem = NULL;
+
+ lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
+ m_core * m_speedScale * m_speedPeak);
+ while ((var = lmm_get_var_from_cnst
+ (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+ CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
+
+ lmm_update_variable_bound(getModel()->getMaxminSystem(),
+ action->getVariable(),
+ m_speedScale * m_speedPeak);
+ }
+
+ Cpu::onSpeedChange();
+}
+
void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double date)
{
lmm_variable_t var = NULL;
xbt_assert(m_core == 1, "FIXME: add speed scaling code also for constraint_core[i]");
m_speedScale = value;
- lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
- m_core * m_speedScale *
- m_speedPeak);
- TRACE_surf_host_set_speed(date, getName(),
- m_core * m_speedScale *
- m_speedPeak);
- while ((var = lmm_get_var_from_cnst
- (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
- CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
+ onSpeedChange();
- lmm_update_variable_bound(getModel()->getMaxminSystem(),
- action->getVariable(),
- m_speedScale * m_speedPeak);
- }
if (tmgr_trace_event_free(event_type))
p_speedEvent = NULL;
} else if (event_type == p_stateEvent) {
void setStateEvent(tmgr_trace_event_t stateEvent);
void setPowerEvent(tmgr_trace_event_t stateEvent);
- xbt_dynar_t getSpeedPeakList();
+ xbt_dynar_t getSpeedPeakList(); // FIXME: killme to hide our internals
+
+protected:
+ void onSpeedChange() override;
+
private:
tmgr_trace_event_t p_stateEvent;
double new_peak_speed = xbt_dynar_get_as(plist, pstate_index, double);
m_pstate = pstate_index;
m_speedPeak = new_peak_speed;
+
+ onSpeedChange();
}
int Cpu::getPState()
return m_speedScale;
}
+void Cpu::onSpeedChange() {
+ TRACE_surf_host_set_speed(surf_get_clock(), getName(),
+ m_core * m_speedScale * m_speedPeak);
+}
+
+
int Cpu::getCore()
{
return m_core;
/** @brief Get the speed, accounting for the trace load and provided process load instead of the real current one */
virtual double getSpeed(double load);
+protected:
+ /** @brief Take speed changes (either load or max) into account */
+ virtual void onSpeedChange();
+
+public:
/** @brief Get the available speed of the current Cpu */
virtual double getAvailableSpeed();