Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Useless cleanups
[simgrid.git] / src / surf / workstation_ptask_L07.c
index f95cc84..425a720 100644 (file)
@@ -25,7 +25,7 @@ typedef struct cpu_L07 {
   double power_scale;
   double power_current;
   tmgr_trace_event_t power_event;
-  e_surf_cpu_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
   int id;                       /* cpu and network card are a single object... */
 } s_cpu_L07_t, *cpu_L07_t;
@@ -42,7 +42,7 @@ typedef struct link_L07 {
   tmgr_trace_event_t lat_event;
   double bw_current;
   tmgr_trace_event_t bw_event;
-  e_surf_link_state_t state_current;
+  e_surf_resource_state_t state_current;
   tmgr_trace_event_t state_event;
 } s_link_L07_t, *link_L07_t;
 
@@ -298,10 +298,10 @@ static void update_actions_state(double now, double delta)
         if (((((link_L07_t) constraint_id)->type ==
               SURF_WORKSTATION_RESOURCE_LINK) &&
              (((link_L07_t) constraint_id)->state_current ==
-              SURF_LINK_OFF)) ||
+              SURF_RESOURCE_OFF)) ||
             ((((cpu_L07_t) constraint_id)->type ==
               SURF_WORKSTATION_RESOURCE_CPU) &&
-             (((cpu_L07_t) constraint_id)->state_current == SURF_CPU_OFF))) {
+             (((cpu_L07_t) constraint_id)->state_current == SURF_RESOURCE_OFF))) {
           DEBUG1("Action (%p) Failed!!", action);
           action->generic_action.finish = surf_get_clock();
           surf_action_state_set((surf_action_t) action,
@@ -322,7 +322,7 @@ static void update_resource_state(void *id,
   link_L07_t nw_link = id;
 
   if (nw_link->type == SURF_WORKSTATION_RESOURCE_LINK) {
-    DEBUG2("Updating link %s (%p)", nw_link->generic_resource.name, nw_link);
+    DEBUG2("Updating link %s (%p)", surf_resource_name(nw_link), nw_link);
     if (event_type == nw_link->bw_event) {
       nw_link->bw_current = value;
       lmm_update_constraint_bound(ptask_maxmin_system, nw_link->constraint,
@@ -343,25 +343,25 @@ static void update_resource_state(void *id,
 
     } else if (event_type == nw_link->state_event) {
       if (value > 0)
-        nw_link->state_current = SURF_LINK_ON;
+        nw_link->state_current = SURF_RESOURCE_ON;
       else
-        nw_link->state_current = SURF_LINK_OFF;
+        nw_link->state_current = SURF_RESOURCE_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
     }
     return;
   } else if (cpu->type == SURF_WORKSTATION_RESOURCE_CPU) {
-    DEBUG3("Updating cpu %s (%p) with value %g", cpu->generic_resource.name, cpu, value);
+    DEBUG3("Updating cpu %s (%p) with value %g", surf_resource_name(cpu), cpu, value);
     if (event_type == cpu->power_event) {
       cpu->power_current = value;
       lmm_update_constraint_bound(ptask_maxmin_system, cpu->constraint,
                                   cpu->power_current * cpu->power_scale);
     } else if (event_type == cpu->state_event) {
       if (value > 0)
-        cpu->state_current = SURF_CPU_ON;
+        cpu->state_current = SURF_RESOURCE_ON;
       else
-        cpu->state_current = SURF_CPU_OFF;
+        cpu->state_current = SURF_RESOURCE_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
@@ -384,7 +384,7 @@ static void finalize(void)
   surf_network_model = NULL;
   used_routing->finalize();
 
-  host_count = 0; // FIXME: KILLME?
+  host_count = 0;
 
   if (ptask_maxmin_system) {
     lmm_system_free(ptask_maxmin_system);
@@ -396,7 +396,7 @@ static void finalize(void)
 /******* Resource Private    **********/
 /**************************************/
 
-static e_surf_cpu_state_t resource_get_state(void *cpu)
+static e_surf_resource_state_t resource_get_state(void *cpu)
 {
   return ((cpu_L07_t) cpu)->state_current;
 }
@@ -542,7 +542,7 @@ static surf_action_t action_sleep(void *cpu, double duration)
 {
   surf_action_workstation_L07_t action = NULL;
 
-  XBT_IN2("(%s,%g)", ((cpu_L07_t) cpu)->generic_resource.name, duration);
+  XBT_IN2("(%s,%g)", surf_resource_name(cpu), duration);
 
   action = (surf_action_workstation_L07_t) execute(cpu, 1.0);
   action->generic_action.max_duration = duration;
@@ -583,7 +583,7 @@ static int link_shared(const void *link)
 static cpu_L07_t cpu_new(const char *name, double power_scale,
                          double power_initial,
                          tmgr_trace_t power_trace,
-                         e_surf_cpu_state_t state_initial,
+                         e_surf_resource_state_t state_initial,
                          tmgr_trace_t state_trace, xbt_dict_t cpu_properties)
 {
   cpu_L07_t cpu = xbt_new0(s_cpu_L07_t, 1);
@@ -624,21 +624,21 @@ static void parse_cpu_init(void)
   double power_scale = 0.0;
   double power_initial = 0.0;
   tmgr_trace_t power_trace = NULL;
-  e_surf_cpu_state_t state_initial = SURF_CPU_OFF;
+  e_surf_resource_state_t state_initial = SURF_RESOURCE_OFF;
   tmgr_trace_t state_trace = NULL;
 
   power_scale = get_cpu_power(A_surfxml_host_power);
   surf_parse_get_double(&power_initial, A_surfxml_host_availability);
 surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
               "Invalid state");
   if (A_surfxml_host_state == A_surfxml_host_state_ON)
-    state_initial = SURF_CPU_ON;
+    state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
-    state_initial = SURF_CPU_OFF;
-  surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
+    state_initial = SURF_RESOURCE_OFF;
+  state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
   cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
@@ -650,7 +650,7 @@ static link_L07_t link_new(char *name,
                            tmgr_trace_t bw_trace,
                            double lat_initial,
                            tmgr_trace_t lat_trace,
-                           e_surf_link_state_t
+                           e_surf_resource_state_t
                            state_initial,
                            tmgr_trace_t state_trace,
                            e_surf_link_sharing_policy_t
@@ -696,23 +696,23 @@ static void parse_link_init(void)
   tmgr_trace_t bw_trace;
   double lat_initial;
   tmgr_trace_t lat_trace;
-  e_surf_link_state_t state_initial_link = SURF_LINK_ON;
+  e_surf_resource_state_t state_initial_link = SURF_RESOURCE_ON;
   e_surf_link_sharing_policy_t policy_initial_link = SURF_LINK_SHARED;
   tmgr_trace_t state_trace;
 
   name_link = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
-  surf_parse_get_trace(&bw_trace, A_surfxml_link_bandwidth_file);
+  bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
-  surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
+  lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
 
   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
               || (A_surfxml_link_state ==
                   A_surfxml_link_state_OFF), "Invalid state");
   if (A_surfxml_link_state == A_surfxml_link_state_ON)
-    state_initial_link = SURF_LINK_ON;
+    state_initial_link = SURF_RESOURCE_ON;
   else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
-    state_initial_link = SURF_LINK_OFF;
+    state_initial_link = SURF_RESOURCE_OFF;
 
   if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
     policy_initial_link = SURF_LINK_SHARED;
@@ -720,7 +720,7 @@ static void parse_link_init(void)
            A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
-  surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
+  state_trace = tmgr_trace_new(A_surfxml_link_state_file);
 
   current_property_set = xbt_dict_new();
   link_new(name_link, bw_initial, bw_trace, lat_initial, lat_trace,
@@ -850,7 +850,7 @@ static void model_init_internal(void)
   routing_model_create(sizeof(link_L07_t),
         link_new(xbt_strdup("__loopback__"),
             498000000, NULL, 0.000015, NULL,
-            SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL));
+            SURF_RESOURCE_ON, NULL, SURF_LINK_FATPIPE, NULL));
 
 }