Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Keep cleaning up func_f, func_fp, func_fpip...
[simgrid.git] / src / surf / workstation_KCCFLN05.c
index 9f80c8e..4f30af0 100644 (file)
@@ -76,7 +76,14 @@ static void __update_cpu_usage(cpu_KCCFLN05_t cpu)
 
 static void *name_service(const char *name)
 {
-  return xbt_dict_get_or_null(workstation_set, name);
+  xbt_ex_t e;
+  void *res=NULL;
+  TRY {
+     res = xbt_dict_get(workstation_set, name);
+  } CATCH(e) {
+     RETHROW1("Host '%s' not found (dict raised this exception: %s)",name);
+  }
+  return res;
 }
 
 static const char *get_resource_name(void *resource_id)
@@ -353,6 +360,9 @@ static void update_resource_state(void *id,
        if(action->suspended==0)
          lmm_update_variable_weight(maxmin_system, action->variable, 
                                     action->lat_current);
+       lmm_update_variable_latency(maxmin_system, action->variable, delta);
+       
+
       }
     } else if (event_type == nw_link->state_event) {
       if (value > 0)
@@ -491,6 +501,7 @@ static double get_available_speed(void *cpu)
   return ((cpu_KCCFLN05_t) cpu)->power_current;
 }
 
+
 static surf_action_t communicate(void *src, void *dst, double size, double rate)
 {
   surf_action_workstation_KCCFLN05_t action = NULL;
@@ -555,6 +566,8 @@ static surf_action_t communicate(void *src, void *dst, double size, double rate)
       lmm_update_variable_bound(maxmin_system, action->variable, action->rate);
   }
 
+  lmm_update_variable_latency(maxmin_system, action->variable, action->latency);
+  
   for (i = 0; i < route_size; i++)
     lmm_expand(maxmin_system, route->links[i]->constraint, action->variable, 1.0);
   if (card_src->bus)
@@ -920,11 +933,16 @@ static void parse_route_set_endpoints(void)
 
 static void parse_route_elem(void)
 {
+  xbt_ex_t e;
   if (nb_link == link_list_capacity) {
     link_list_capacity *= 2;
     link_list = xbt_realloc(link_list, (link_list_capacity) * sizeof(network_link_KCCFLN05_t));
   }
-  link_list[nb_link++] = xbt_dict_get_or_null(network_link_set, A_surfxml_route_element_name);
+  TRY {
+     link_list[nb_link++] = xbt_dict_get(network_link_set, A_surfxml_route_element_name);
+  } CATCH(e) {
+     RETHROW1("Link %s not found (dict raised this exception: %s)",A_surfxml_route_element_name);
+  }
 }
 
 static void parse_route_set_route(void)
@@ -1062,14 +1080,45 @@ void surf_workstation_resource_init_KCCFLN05(const char *filename)
   xbt_dynar_push(resource_list, &surf_workstation_resource);
 }
 
-void surf_workstation_resource_init_KCCFLN05_proportionnal(const char *filename)
+void surf_workstation_resource_init_KCCFLN05_proportional(const char *filename)
 {
   xbt_assert0(!surf_cpu_resource, "CPU resource type already defined");
   xbt_assert0(!surf_network_resource, "network resource type already defined");
   resource_init_internal();
   parse_file(filename);
 
-  surf_workstation_resource->common_public->name = "Workstation KCCFLN05 (proportionnal)";
+  surf_workstation_resource->common_public->name = "Workstation KCCFLN05 (proportional)";
   use_sdp_solver=1;
   xbt_dynar_push(resource_list, &surf_workstation_resource);
 }
+
+void surf_workstation_resource_init_KCCFLN05_Vegas(const char *filename)
+{
+  xbt_assert0(!surf_cpu_resource, "CPU resource type already defined");
+  xbt_assert0(!surf_network_resource, "network resource type already defined");
+  resource_init_internal();
+  parse_file(filename);
+
+  lmm_set_default_protocol_functions(func_vegas_fpi);
+
+  surf_workstation_resource->common_public->name = "Workstation KCCFLN05 (Vegas)";
+  use_lagrange_solver=1;
+  xbt_dynar_push(resource_list, &surf_workstation_resource);
+}
+
+void surf_workstation_resource_init_KCCFLN05_Reno(const char *filename)
+{
+  xbt_assert0(!surf_cpu_resource, "CPU resource type already defined");
+  xbt_assert0(!surf_network_resource, "network resource type already defined");
+  resource_init_internal();
+  parse_file(filename);
+
+  lmm_set_default_protocol_functions(func_reno_fpi);
+
+  surf_workstation_resource->common_public->name = "Workstation KCCFLN05 (Reno)";
+  use_lagrange_solver=1;
+  xbt_dynar_push(resource_list, &surf_workstation_resource);
+}
+
+
+