Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Storage API
[simgrid.git] / src / surf / surf_routing.c
index 563bcc0..e10de03 100644 (file)
@@ -20,7 +20,8 @@ int ROUTING_HOST_LEVEL;         //Routing level
 int SURF_CPU_LEVEL;             //Surf cpu level
 int SURF_WKS_LEVEL;             //Surf workstation level
 int SIMIX_HOST_LEVEL;           //Simix level
-int MSG_HOST_LEVEL;             //Msg level
+int SIMIX_STORAGE_LEVEL;           //Simix level
+int MSG_HOST_LEVEL;             //Msg host level
 int SD_HOST_LEVEL;              //Simdag level
 int COORD_HOST_LEVEL=0;         //Coordinates level
 int NS3_HOST_LEVEL;             //host node for ns3
@@ -745,7 +746,10 @@ static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet)
     s_sg_platf_host_cbarg_t host;
     memset(&host, 0, sizeof(host));
     host.initial_state = SURF_RESOURCE_ON;
-    host.power_peak = cabinet->power;
+    xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
+    xbt_dynar_push(power_state_list,&cabinet->power);
+    host.power_peak = power_state_list;
+    host.pstate = 0;
     host.power_scale = 1.0;
     host.core_amount = 1;
 
@@ -861,7 +865,12 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         XBT_DEBUG("\tstate_file=\"\"");
       }
 
-      host.power_peak = cluster->power;
+      xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
+      xbt_dynar_push(power_state_list,&cluster->power);
+      host.power_peak = power_state_list;
+      host.pstate = 0;
+
+      //host.power_peak = cluster->power;
       host.power_scale = 1.0;
       host.core_amount = cluster->core_amount;
       host.initial_state = SURF_RESOURCE_ON;
@@ -1006,7 +1015,12 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
   memset(&host, 0, sizeof(host));
   host.initial_state = SURF_RESOURCE_ON;
   host.id = host_id;
-  host.power_peak = peer->power;
+
+  xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL);
+  xbt_dynar_push(power_state_list,&peer->power);
+  host.power_peak = power_state_list;
+  host.pstate = 0;
+  //host.power_peak = peer->power;
   host.power_scale = 1.0;
   host.power_trace = peer->availability_trace;
   host.state_trace = peer->state_trace;
@@ -1227,3 +1241,36 @@ void routing_exit(void) {
   finalize_rec(routing_platf->root);
   xbt_free(routing_platf);
 }
+
+AS_t surf_AS_get_routing_root() {
+  return routing_platf->root;  
+}
+
+const char *surf_AS_get_name(AS_t as) {
+  return as->name;
+}
+
+xbt_dict_t surf_AS_get_routing_sons(AS_t as) {
+  return as->routing_sons;
+}
+
+const char *surf_AS_get_model(AS_t as) {
+  return as->model_desc->name;
+}
+
+xbt_dynar_t surf_AS_get_hosts(AS_t as) {
+  xbt_dynar_t elms = as->index_network_elm;
+  sg_routing_edge_t relm;
+  xbt_dictelm_t delm;
+  int index;
+  int count = xbt_dynar_length(elms);
+  xbt_dynar_t res =  xbt_dynar_new(sizeof(xbt_dictelm_t), NULL);
+  for (index = 0; index < count; index++) {
+     relm = xbt_dynar_get_as(elms, index, sg_routing_edge_t);
+     delm = xbt_lib_get_elm_or_null(host_lib, relm->name);
+     if (delm!=NULL) {
+       xbt_dynar_push(res, &delm);
+     }
+  }
+  return res;
+}