Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
pass netElm&CPU as parameter to the host constructor
[simgrid.git] / src / surf / sg_platf.cpp
index 54229a8..820a60e 100644 (file)
@@ -135,15 +135,29 @@ void sg_platf_exit(void) {
   surf_parse_models_setup_already_called = 0;
 }
 
-void sg_platf_new_host(sg_platf_host_cbarg_t h){
-  routing_parse_init(h);
-  cpu_parse_init(h);
-  host_parse_init(h);
+void sg_platf_new_host(sg_platf_host_cbarg_t host)
+{
+  RoutingEdge *net = NULL;
+  As* current_routing = routing_get_current();
+  if (current_routing)
+    net = routing_add_host(current_routing, host);
+
+  Cpu *cpu = surf_cpu_model_pm->createCpu(
+        host->id,
+        host->power_peak,
+        host->pstate,
+        host->power_scale,
+        host->power_trace,
+        host->core_amount,
+        host->initial_state,
+        host->state_trace,
+        host->properties);
+  surf_host_model->createHost(host->id, net, cpu);
 
   unsigned int iterator;
   sg_platf_host_cb_t fun;
   xbt_dynar_foreach(sg_platf_host_cb_list, iterator, fun) {
-    fun(h);
+    fun(host);
   }
 }
 void sg_platf_new_host_link(sg_platf_host_link_cbarg_t h){