Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
pass netElm&CPU as parameter to the host constructor
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Nov 2015 20:29:07 +0000 (21:29 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Nov 2015 20:29:11 +0000 (21:29 +0100)
It was passed implicitly through the set of existing netElm and CPU.

src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/host_interface.hpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/virtual_machine.hpp

index 29118fb..888956a 100644 (file)
@@ -42,12 +42,10 @@ void surf_host_model_init_compound()
   xbt_dynar_push(all_existing_models, &model);
 }
 
-Host *HostCLM03Model::createHost(const char *name){
-  sg_host_t sg_host = sg_host_by_name(name);
+Host *HostCLM03Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu){
   Host *host = new HostCLM03(surf_host_model, name, NULL,
                  (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
-                 sg_host_edge(sg_host),
-                 sg_host_surfcpu(sg_host));
+                 netElm, cpu);
   surf_callback_emit(hostCreatedCallbacks, host);
   XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host);
index e2d27bb..6b6166c 100644 (file)
@@ -30,7 +30,7 @@ class HostCLM03Model : public HostModel {
 public:
   HostCLM03Model(): HostModel(){}
   ~HostCLM03Model() {}
-  Host *createHost(const char *name);
+  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu);
   double shareResources(double now);
 
   void updateActionsState(double now, double delta);
index 204a583..978ed35 100644 (file)
@@ -64,7 +64,7 @@ public:
   HostModel() : Model() {}
   ~HostModel() {}
 
-  virtual Host *createHost(const char *name)=0;
+  virtual Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu)=0;
   void addTraces(){DIE_IMPOSSIBLE;}
 
   virtual void adjustWeightOfDummyCpuActions();
index 3dcb404..f1ca84d 100644 (file)
@@ -263,7 +263,7 @@ Action *HostL07Model::executeParallelTask(int host_nb,
   return action;
 }
 
-Host *HostL07Model::createHost(const char *name)
+Host *HostL07Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu)
 {
   HostL07 *wk = NULL;
   sg_host_t sg_host = sg_host_by_name(name);
@@ -272,9 +272,8 @@ Host *HostL07Model::createHost(const char *name)
               "Host '%s' declared several times in the platform file.",
               name);
 
-  wk = new HostL07(this, name, NULL,
-                                 sg_host_edge(sg_host),
-                                                 sg_host_surfcpu(sg_host));
+  wk = new HostL07(this, name, NULL, netElm, cpu);
+
   surf_callback_emit(hostCreatedCallbacks, wk);
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, wk);
 
index 221edf3..6092bfa 100644 (file)
@@ -38,7 +38,7 @@ public:
 
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  Host *createHost(const char *name);
+  Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
   Action *executeParallelTask(int host_nb,
                               sg_host_t *host_list,
                                                          double *flops_amount,
index df16227..820a60e 100644 (file)
@@ -137,10 +137,12 @@ void sg_platf_exit(void) {
 
 void sg_platf_new_host(sg_platf_host_cbarg_t host)
 {
+  RoutingEdge *net = NULL;
   As* current_routing = routing_get_current();
   if (current_routing)
-    routing_add_host(current_routing, host);
-  surf_cpu_model_pm->createCpu(
+    net = routing_add_host(current_routing, host);
+
+  Cpu *cpu = surf_cpu_model_pm->createCpu(
         host->id,
         host->power_peak,
         host->pstate,
@@ -150,7 +152,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
         host->initial_state,
         host->state_trace,
         host->properties);
-  surf_host_model->createHost(host->id);
+  surf_host_model->createHost(host->id, net, cpu);
 
   unsigned int iterator;
   sg_platf_host_cb_t fun;
index 7860de6..0dbf8e7 100644 (file)
@@ -108,7 +108,7 @@ public:
   VMModel() :HostModel(){}
   ~VMModel(){};
 
-  Host *createHost(const char *name){DIE_IMPOSSIBLE;}
+  Host *createHost(const char *name, RoutingEdge *netElm, Cpu *cpu){DIE_IMPOSSIBLE;}
 
   /**
    * @brief Create a new VM