/**
* \brief Auxiliary function to calculate the integral between a and b.
- * It simply calculates the integral at point a and b and returns the difference
+ * It simply calculates the integral at point a and b and returns the difference
* between them.
* \param trace Trace structure
* \param a Initial point
("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f",
a, ind, integral, p_integral[ind + 1], p_integral[ind],
p_timePoints[ind + 1], p_timePoints[ind]);
- double_update(&a_aux, p_timePoints[ind]);
+ double_update(&a_aux, p_timePoints[ind], sg_maxmin_precision*sg_surf_precision);
if (a_aux > 0)
integral +=
((p_integral[ind + 1] -
* It returns the date when the requested amount of flops is available
* \param trace Trace structure
* \param a Initial point
- * \param amount Amount of flops
+ * \param amount Amount of flops
* \return The date when amount is available.
*/
double CpuTiTrace::solveSimple(double a, double amount)
if (!power_trace) {
m_type = TRACE_FIXED;
m_value = value;
- XBT_DEBUG("No availability trace. Constant value = %lf", value);
+ XBT_DEBUG("No availability trace. Constant value = %f", value);
return;
}
m_lastTime = total_time;
m_total = p_trace->integrateSimple(0, total_time);
- XBT_DEBUG("Total integral %lf, last_time %lf ",
+ XBT_DEBUG("Total integral %f, last_time %f ",
m_total, m_lastTime);
}
/**
* \brief Binary search in array.
- * It returns the first point of the interval in which "a" is.
+ * It returns the first point of the interval in which "a" is.
* \param array Array
* \param a Value to search
* \param low Low bound to search in array
* CallBacks *
*************/
-static void parse_cpu_ti_init(sg_platf_host_cbarg_t host){
- ((CpuTiModelPtr)surf_cpu_model_pm)->parseInit(host);
-}
-
-static void add_traces_cpu_ti(){
- surf_cpu_model_pm->addTraces();
-}
-
static void cpu_ti_define_callbacks()
{
- sg_platf_host_add_cb(parse_cpu_ti_init);
- sg_platf_postparse_add_cb(add_traces_cpu_ti);
+ sg_platf_host_add_cb(parse_cpu_init);
+ sg_platf_postparse_add_cb(add_traces_cpu);
}
/*********
xbt_heap_free(p_tiActionHeap);
}
-void CpuTiModel::parseInit(sg_platf_host_cbarg_t host)
-{
- createResource(host->id,
- host->power_peak,
- host->pstate,
- host->power_scale,
- host->power_trace,
- host->core_amount,
- host->initial_state,
- host->state_trace,
- host->properties);
-}
-
-CpuTiPtr CpuTiModel::createResource(const char *name,
+CpuPtr CpuTiModel::createResource(const char *name,
xbt_dynar_t powerPeak,
int pstate,
double powerScale,
return cpu;
}
-CpuTiActionPtr CpuTiModel::createAction(double /*cost*/, bool /*failed*/)
-{
- return NULL;//new CpuTiAction(this, cost, failed);
-}
-
double CpuTiModel::shareResources(double now)
{
void *_cpu, *_cpu_next;
setState(stateInitial);
m_powerScale = powerScale;
m_core = core;
- tmgr_trace_t empty_trace;
- s_tmgr_event_t val;
+ tmgr_trace_t empty_trace;
+ s_tmgr_event_t val;
xbt_assert(core==1,"Multi-core not handled with this model yet");
- XBT_DEBUG("power scale %lf", powerScale);
+ XBT_DEBUG("power scale %f", powerScale);
p_availTrace = new CpuTiTgmr(powerTrace, powerScale);
CpuTiActionPtr action = NULL;
if (stateTrace)
p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, static_cast<ResourcePtr>(this));
if (powerTrace && xbt_dynar_length(powerTrace->s_list.event_list) > 1) {
- // add a fake trace event if periodicity == 0
+ // add a fake trace event if periodicity == 0
xbt_dynar_get_cpy(powerTrace->s_list.event_list,
xbt_dynar_length(powerTrace->s_list.event_list) - 1, &val);
if (val.delta == 0) {
CpuTiTgmrPtr trace;
s_tmgr_event_t val;
- XBT_DEBUG("Finish trace date: %f value %lf date %f", surf_get_clock(),
+ XBT_DEBUG("Finish trace date: %f value %f date %f", surf_get_clock(),
value, date);
/* update remaining of actions and put in modified cpu swag */
updateRemainingAmount(date);
CpuActionPtr CpuTi::sleep(double duration)
{
if (duration > 0)
- duration = MAX(duration, MAXMIN_PRECISION);
+ duration = MAX(duration, sg_surf_precision);
XBT_IN("(%s,%g)", getName(), duration);
CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), 1.0, getState() != SURF_RESOURCE_ON, this);
void CpuTiAction::setState(e_surf_action_state_t state)
{
- Action::setState(state);
+ CpuAction::setState(state);
xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}