Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Canceled RPC are a pain right now (until we move to a N/1-port model, they are likely...
[simgrid.git] / src / surf / cpu.c
index c24f936..57ceb53 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "cpu_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cpu, surf,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
                                "Logging specific to the SURF CPU module");
 
 surf_cpu_resource_t surf_cpu_resource = NULL;
@@ -128,7 +128,6 @@ static void action_cancel(surf_action_t action)
 static void action_recycle(surf_action_t action)
 {
   DIE_IMPOSSIBLE;
-  return;
 }
 
 static void action_change_state(surf_action_t action,
@@ -312,6 +311,12 @@ static double get_speed(void *cpu, double load)
   return load*(((cpu_Cas01_t) cpu)->power_scale);
 }
 
+static double get_available_speed(void *cpu)
+{
+  /* number between 0 and 1 */
+  return ((cpu_Cas01_t) cpu)->power_current;
+}
+
 static void finalize(void)
 {
   xbt_dict_free(&cpu_set);
@@ -382,6 +387,7 @@ static void surf_cpu_resource_init_internal(void)
 
   surf_cpu_resource->extension_public->get_state = get_state;
   surf_cpu_resource->extension_public->get_speed = get_speed;
+  surf_cpu_resource->extension_public->get_available_speed = get_available_speed;
 
   cpu_set = xbt_dict_new();