- xbt_dict_cursor_t cursor = NULL;
- char *trace_name, *elm;
- static int called = 0;
- if (called)
- return;
- called = 1;
-
- /* connect all traces relative to hosts */
- xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
- tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuCas01Ptr host = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
-
- xbt_assert(host, "Host %s undefined", elm);
- xbt_assert(trace, "Trace %s undefined", trace_name);
-
- host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
- }
-
- xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
- tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuCas01Ptr host = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
-
- xbt_assert(host, "Host %s undefined", elm);
- xbt_assert(trace, "Trace %s undefined", trace_name);
-
- host->p_powerEvent =
- tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
- }
-}
-
-/************
- * Resource *
- ************/
-CpuCas01::CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t powerPeak,
- int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
- e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
- xbt_dict_t properties)
-: Cpu(model, name, properties,
- lmm_constraint_new(model->getMaxminSystem(), this, core * powerScale * xbt_dynar_get_as(powerPeak, pstate, double)),
- core, xbt_dynar_get_as(powerPeak, pstate, double), powerScale) {
- p_powerEvent = NULL;
- p_powerPeakList = powerPeak;
- m_pstate = pstate;
-
- XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_powerPeak, m_pstate);
-
- m_core = core;
- m_stateCurrent = stateInitial;
- if (powerTrace)
- p_powerEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, static_cast<ResourcePtr>(this));
-
- if (stateTrace)
- p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, static_cast<ResourcePtr>(this));