Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename a test in order to easily select it
[simgrid.git] / src / surf / surf_c_bindings.cpp
index cb638c0..5ab27f2 100644 (file)
@@ -356,12 +356,25 @@ int surf_workstation_get_nb_pstates(surf_resource_t resource){
   return get_casted_workstation(resource)->getNbPstates();
 }
 
-void surf_workstation_set_power_peak_at(surf_resource_t resource, int pstate_index){
-  return get_casted_workstation(resource)->setPowerPeakAt(pstate_index);
+void surf_workstation_set_pstate(surf_resource_t resource, int pstate_index){
+  get_casted_workstation(resource)->setPstate(pstate_index);
+}
+int surf_workstation_get_pstate(surf_resource_t resource){
+  return get_casted_workstation(resource)->getPstate();
+}
+double surf_workstation_get_wattmin_at(surf_resource_t resource, int pstate){
+  xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+  std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
+  return cpuIt->second->getWattMinAt(pstate);
+}
+double surf_workstation_get_wattmax_at(surf_resource_t resource, int pstate){
+  xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+  std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
+  return cpuIt->second->getWattMaxAt(pstate);
 }
 
 double surf_workstation_get_consumed_energy(surf_resource_t resource){
-  xbt_assert(surf_energy!=NULL, "The Energy plugin is not active.");
+  xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
   std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
   return cpuIt->second->getConsumedEnergy();
 }