X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2589a5617fe05b8b2aaf2bc9bb998e6ad4271518..669af35fa6a1fb42422d0844ba289c51554ee4ac:/src/surf/cpu_interface.cpp diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 652259da77..7dc2d1a599 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -10,9 +10,11 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_kernel); XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, "Logging specific to the SURF cpu module"); +int autoload_surf_cpu_model = 1; +void_f_void_t surf_cpu_model_init_preparse = NULL; + CpuModelPtr surf_cpu_model_pm; CpuModelPtr surf_cpu_model_vm; - /************* * Callbacks * *************/ @@ -28,16 +30,32 @@ surf_callback(void, CpuPtr) cpuDestructedCallbacks; surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks; surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks; +void cpu_parse_init(sg_platf_host_cbarg_t host){ + surf_cpu_model_pm->createCpu( + host->id, + host->power_peak, + host->pstate, + host->power_scale, + host->power_trace, + host->core_amount, + host->initial_state, + host->state_trace, + host->properties); +} + +void cpu_add_traces(){ + surf_cpu_model_pm->addTraces(); +} + /********* * Model * *********/ - void CpuModel::updateActionsStateLazy(double now, double /*delta*/) { CpuActionPtr action; while ((xbt_heap_size(getActionHeap()) > 0) && (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) { - action = static_cast(static_cast(xbt_heap_pop(getActionHeap()))); + action = static_cast(xbt_heap_pop(getActionHeap())); XBT_CDEBUG(surf_kernel, "Something happened to action %p", action); #ifdef HAVE_TRACING if (TRACE_is_enabled()) { @@ -185,6 +203,11 @@ Cpu::~Cpu(){ xbt_free(p_constraintCoreId); } +double Cpu::getCurrentPowerPeak() +{ + return m_powerPeak; +} + double Cpu::getSpeed(double load) { return load * m_powerPeak;